epoc32/include/mw/eikprogi.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/eikprogi.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/eikprogi.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,358 @@
     1.4 -eikprogi.h
     1.5 +/*
     1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#if !defined(__EIKPROGI_H__)
    1.24 +#define __EIKPROGI_H__
    1.25 +
    1.26 +#if !defined(__EIKBCTRL_H__)
    1.27 +#include <eikbctrl.h>
    1.28 +#endif
    1.29 +
    1.30 +#if !defined(__EIKON_HRH__)
    1.31 +#include <eikon.hrh>
    1.32 +#endif
    1.33 +
    1.34 +class TGulBorder;
    1.35 +class CEikProgressInfoExtension;
    1.36 +
    1.37 +/**
    1.38 +* Control used to indicate the progress of an operation.
    1.39 +*
    1.40 +* Progress consists of a rectangular block that grows during an increment and 
    1.41 +* shrinks during a decrement. The control can have progress text within the bar 
    1.42 +* that provides updated information on how far the operation has progressed. 
    1.43 +* The text can be displayed as either a percentage or a fraction. The bar can 
    1.44 +* also have a series of invisible splits, or lines. These splits are displayed 
    1.45 +* by the rectangular blocks as it fills the bar. When the control is in this 
    1.46 +* mode progress text cannot be used. 
    1.47 +*
    1.48 +* This class has an associated @c PROGRESSINFO resource and @c EEikCtProgInfo 
    1.49 +* control factory identifier.
    1.50 +*/
    1.51 +class CEikProgressInfo : public CEikBorderedControl
    1.52 +	{
    1.53 +	
    1.54 +public:
    1.55 +    
    1.56 +    /**
    1.57 +     * Defines the progress control's type.
    1.58 +     */
    1.59 +    struct SInfo
    1.60 +        {
    1.61 +        /**
    1.62 +         * The type of text for the progress information control. This can be 
    1.63 +         * percentage or fraction. See the @c TEikProgressTextType enum.
    1.64 +         */
    1.65 +        TEikProgressTextType iTextType;
    1.66 +
    1.67 +        /** 
    1.68 +         * The total number of splits in the progress information control. This
    1.69 +         * is optional.
    1.70 +         */
    1.71 +        TInt iSplitsInBlock;
    1.72 +
    1.73 +        /** 
    1.74 +         * The final value of the progress information control that, when 
    1.75 +         * reached, indicates completion.
    1.76 +         */
    1.77 +        TInt iFinalValue;
    1.78 +
    1.79 +        /** The width of the control in pixels. */
    1.80 +        TInt iWidth;
    1.81 +    
    1.82 +        /** The height of the progress information control. */
    1.83 +        TInt iHeight;
    1.84 +        };
    1.85 +
    1.86 +    /**
    1.87 +     * Defines the layout and colours for a progress information control.
    1.88 +     */
    1.89 +    struct SLayout
    1.90 +        {
    1.91 +        /** 
    1.92 +         * The colour for the part of the control that indicates the progress
    1.93 +         * that has been made. By default, the value of the @c TLogicalColor 
    1.94 +         * enum's @c EColorControlHighlightBackground datum.
    1.95 +         */
    1.96 +        TRgb iFillColor;
    1.97 +
    1.98 +        /**
    1.99 +         * The colour for sections of the control that indicate the progress yet
   1.100 +         * to be made. By default, the value of the @c TLogicalColor enum's 
   1.101 +         * @c EColorControlBackground datum.
   1.102 +         */
   1.103 +        TRgb iEmptyColor;
   1.104 +
   1.105 +        /**
   1.106 +         * The colour for the optional progress text that is displayed i.e. 
   1.107 +         * the filled portion of the control. By default, the value of the 
   1.108 +         * @c TLogicalColor enum's @c EColorControlHighlightText datum.
   1.109 +         */
   1.110 +        TRgb iFillTextColor;
   1.111 +
   1.112 +        /**
   1.113 +         * Optional progress text that appears in the empty portion of the 
   1.114 +         * control. By default, the value of the @c TLogicalColor enum's 
   1.115 +         * @c EColorControlText datum.
   1.116 +         */
   1.117 +        TRgb iEmptyTextColor;
   1.118 +
   1.119 +        /**
   1.120 +         * The font to use for the optional progress text. By default, the 
   1.121 +         * environment's normal font.
   1.122 +         */
   1.123 +        const CFont* iFont;
   1.124 +
   1.125 +        /**
   1.126 +         * The gap between the blocks in the control that indicate the progress 
   1.127 +         * made. By default, one pixel.
   1.128 +         */
   1.129 +        TInt iGapBetweenBlocks;
   1.130 +        };
   1.131 +
   1.132 +    /**
   1.133 +     * Destructor.
   1.134 +     */
   1.135 +    IMPORT_C ~CEikProgressInfo();
   1.136 +    
   1.137 +    /** 
   1.138 +     * C++ default constructor.
   1.139 +     */
   1.140 +    IMPORT_C CEikProgressInfo();
   1.141 +    
   1.142 +    /**
   1.143 +     * Constructs a progress information control using the information held in 
   1.144 +     * the specified @c SInfo struct. Uses default layout values.
   1.145 +     *
   1.146 +     * @param aProgInfo Holds information about the type of progress 
   1.147 +     *        information control.
   1.148 +     */
   1.149 +    IMPORT_C CEikProgressInfo(const SInfo& aProgInfo);
   1.150 +    
   1.151 +    /**
   1.152 +     * Adds the specified increment to the current progress value and, if the 
   1.153 +     * progress value has increased, redraws the control.
   1.154 +     *
   1.155 +     * @param aInc The increment to add to the current progress value.
   1.156 +     */
   1.157 +    IMPORT_C void IncrementAndDraw(TInt aInc);
   1.158 +    
   1.159 +    /**
   1.160 +     * Sets the specified value as the new progress value and redraws the 
   1.161 +     * control if the new value differs from the old value.
   1.162 +     *
   1.163 +     * @param aValue The new progress value.
   1.164 +     */
   1.165 +    IMPORT_C void SetAndDraw(TInt aValue);
   1.166 +    
   1.167 +    /**
   1.168 +     * From @c CCoeControl.
   1.169 +     *
   1.170 +     * Constructs a progress information control from a @c PROGRESSINFO 
   1.171 +     * resource. Uses default layout values.
   1.172 +     * 
   1.173 +     * @param aReader The resource reader to use.
   1.174 +     */
   1.175 +    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
   1.176 +    
   1.177 +    /**
   1.178 +     * Sets the layout for the control.
   1.179 +     *
   1.180 +     * @param aLayout The layout for the control.
   1.181 +     */
   1.182 +    IMPORT_C void SetLayout(const SLayout& aLayout);
   1.183 +    
   1.184 +    /**
   1.185 +     * Sets the control's border.
   1.186 +     *
   1.187 +     * @param aBorder The control's border.
   1.188 +     */
   1.189 +    IMPORT_C void SetBorder(const TGulBorder& aBorder);
   1.190 +    
   1.191 +    /**
   1.192 +     * Sets the final value for the progress information control. This value 
   1.193 +     * indicates the operation being monitored is complete.
   1.194 +     *
   1.195 +     * @param aFinalValue The final value for the progress information control.
   1.196 +     *        If this is specified as zero, the value is set to one.
   1.197 +     */
   1.198 +    IMPORT_C void SetFinalValue(TInt aFinalValue);
   1.199 +    
   1.200 +    /**
   1.201 +     * By default Symbian 2nd phase constructor is private.
   1.202 +     */
   1.203 +    IMPORT_C void ConstructL(); // AKNLAF
   1.204 +
   1.205 +    /**
   1.206 +     * Gets a pointer to the information used to define the progress information
   1.207 +     * control's type.
   1.208 +     *
   1.209 +     * @return The information that defines the type of progress 
   1.210 +     *         information control.
   1.211 +     */
   1.212 +    inline const SInfo& Info() const { return(iInfo); }
   1.213 +    
   1.214 +    /**
   1.215 +     * Gets a pointer to the colours and layout of the progress information 
   1.216 +     * control.
   1.217 +     *
   1.218 +     * @return Defines the layout of the control.
   1.219 +     */
   1.220 +    inline const SLayout& Layout() const { return(iLayout); }
   1.221 +    
   1.222 +    /**
   1.223 +     * Gets the current value, indicating how far the operation has progressed.
   1.224 +     *
   1.225 +     * @return The value for how far the operation has progressed.
   1.226 +     */
   1.227 +    inline TInt CurrentValue() const { return(iCurrentValue); }
   1.228 +
   1.229 +protected:
   1.230 +    
   1.231 +    /**
   1.232 +     * Evaluates the progress text.
   1.233 +     *
   1.234 +     * @param[out] aTextBuf On return, the evaluted text. This is the same
   1.235 +     *                 as the return value.
   1.236 +     * @return The evaluated text. Null if progress information is not 
   1.237 +     *         held as text. A percentage if it is held as a percentage. 
   1.238 +     *         Otherwise, the current value and final value separated by 
   1.239 +     *         a slash. Subclassers may wish to use their own buffer.
   1.240 +     **/
   1.241 +    IMPORT_C virtual const TDesC* EvaluateText(TDes& aTextBuf) const;
   1.242 +
   1.243 +public: // from CCoeControl
   1.244 +
   1.245 +    /**
   1.246 +     * From @c CCoeControl.
   1.247 +     *
   1.248 +     * Activates the progress information control.
   1.249 +     */
   1.250 +    IMPORT_C void ActivateL();
   1.251 +
   1.252 +    /**
   1.253 +     * From @c CCoeControl.
   1.254 +     *
   1.255 +     * Gets the minimum size required to draw the control.
   1.256 +     *
   1.257 +     * @return Two-dimensional size as a width and a height value.
   1.258 +     */
   1.259 +    IMPORT_C TSize MinimumSize();
   1.260 +
   1.261 +    /**
   1.262 +     * From @c CCoeControl.
   1.263 +     *
   1.264 +     * Recalculates the control's size in response to a size change.
   1.265 +     */
   1.266 +    IMPORT_C void SizeChanged();
   1.267 +
   1.268 +    /**
   1.269 +     * From @c CCoeControl.
   1.270 +     *
   1.271 +     * Gets a list of the logical colours used to draw the control, appended 
   1.272 +     * to @c aColorUseList.
   1.273 +     *
   1.274 +     * @param[out] aColorUseList On return, the colours used to draw 
   1.275 +     *             the control.
   1.276 +     */
   1.277 +    IMPORT_C virtual void GetColorUseListL(
   1.278 +                                CArrayFix<TCoeColorUse>& aColorUseList) const;
   1.279 +
   1.280 +    /**
   1.281 +     * From @c CCoeControl.
   1.282 +     *
   1.283 +     * Handles a change to the control's resources.
   1.284 +     *
   1.285 +     * @param aType A message UID value.
   1.286 +     */
   1.287 +    IMPORT_C virtual void HandleResourceChange(TInt aType);
   1.288 +
   1.289 +    /**
   1.290 +     * From @c CCoeControl.
   1.291 +     *
   1.292 +     * Handles pointer events. This function gets called whenever a pointer
   1.293 +     * event occurs in the control, i.e. when the pointer is within 
   1.294 +     * the control's extent, or when the control has grabbed the pointer. 
   1.295 +     * The control should implement this function to handle pointer events.
   1.296 +     *
   1.297 +     * Note: events of type @c EButton1Down are processed before 
   1.298 +     * @c HandlePointerEventL() is called, in order to transfer keyboard focus 
   1.299 +     * to the control in which the @c EButton1Down event occurred.
   1.300 +     * If overriding @c HandlePointerEventL(), the implementation must include 
   1.301 +     * a base call to @c CCoeControl's @c HandlePointerEventL().
   1.302 +     *
   1.303 +     * @param aPointerEvent The pointer event.
   1.304 +     */
   1.305 +    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
   1.306 +
   1.307 +protected: //from CCoeControl
   1.308 +
   1.309 +    /**
   1.310 +     * From @c CCoeControl.
   1.311 +     *
   1.312 +     * Writes the internal state of the control and its components to a stream.
   1.313 +     * This function is empty in release builds. It is intended to be overridden
   1.314 +     * and base called by subclasses.
   1.315 +     *
   1.316 +     * @since App-Framework_6.1
   1.317 +     * @param aWriteStream The internal state of the control and its components.
   1.318 +     */
   1.319 +    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   1.320 +
   1.321 +private: // from CCoeControl
   1.322 +
   1.323 +    IMPORT_C void Draw(const TRect& aRect) const;
   1.324 +    IMPORT_C void Reserved_2();	
   1.325 +
   1.326 +private:
   1.327 +
   1.328 +    /**
   1.329 +    * From CAknControl
   1.330 +    */
   1.331 +    IMPORT_C void* ExtensionInterface( TUid aInterface );
   1.332 +
   1.333 +private: // internal use
   1.334 +
   1.335 +	void Construct();
   1.336 +	void CheckSizeCalculated();
   1.337 +	void DrawPartial()const; // AKNLAF
   1.338 +	void DrawProgressBarForeground(CWindowGc& aGc) const; //AKNLAF
   1.339 +	void DrawProgressBarBackground(CWindowGc& aGc) const; //AKNLAF
   1.340 +	TInt FilledWidth() const; //AKNLAF
   1.341 +    
   1.342 +private:
   1.343 +
   1.344 +	SInfo iInfo;
   1.345 +	SLayout iLayout;
   1.346 +	TInt iCurrentValue;
   1.347 +	TBool iHeightWasSupplied;
   1.348 +	CFbsBitmap* iBitmap; // AKNLAF
   1.349 +	CFbsBitmap* iBackgroundBitmap; // AKNLAF Not used, extension!
   1.350 +	CFbsBitmap* iBitmapMask; // AKNLAF
   1.351 +	//CFbsBitmap* iBackgroundBitmapMask; // AKNLAF
   1.352 +    CEikProgressInfoExtension* iExtension;
   1.353 +
   1.354 +private:
   1.355 +
   1.356 +    void LoadBitmapsL();
   1.357 +    void SetBitmapSizes();
   1.358 +    void DeleteBitmaps();
   1.359 +	};
   1.360 +
   1.361 +
   1.362 +#endif  // __EIKPROGI_H__