epoc32/include/mw/eikprogi.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* 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
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKPROGI_H__)
williamr@2
    20
#define __EIKPROGI_H__
williamr@2
    21
williamr@2
    22
#if !defined(__EIKBCTRL_H__)
williamr@2
    23
#include <eikbctrl.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
#if !defined(__EIKON_HRH__)
williamr@2
    27
#include <eikon.hrh>
williamr@2
    28
#endif
williamr@2
    29
williamr@2
    30
class TGulBorder;
williamr@2
    31
class CEikProgressInfoExtension;
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
* Control used to indicate the progress of an operation.
williamr@2
    35
*
williamr@2
    36
* Progress consists of a rectangular block that grows during an increment and 
williamr@2
    37
* shrinks during a decrement. The control can have progress text within the bar 
williamr@2
    38
* that provides updated information on how far the operation has progressed. 
williamr@2
    39
* The text can be displayed as either a percentage or a fraction. The bar can 
williamr@2
    40
* also have a series of invisible splits, or lines. These splits are displayed 
williamr@2
    41
* by the rectangular blocks as it fills the bar. When the control is in this 
williamr@2
    42
* mode progress text cannot be used. 
williamr@2
    43
*
williamr@2
    44
* This class has an associated @c PROGRESSINFO resource and @c EEikCtProgInfo 
williamr@2
    45
* control factory identifier.
williamr@2
    46
*/
williamr@2
    47
class CEikProgressInfo : public CEikBorderedControl
williamr@2
    48
	{
williamr@2
    49
	
williamr@2
    50
public:
williamr@2
    51
    
williamr@2
    52
    /**
williamr@2
    53
     * Defines the progress control's type.
williamr@2
    54
     */
williamr@2
    55
    struct SInfo
williamr@2
    56
        {
williamr@2
    57
        /**
williamr@2
    58
         * The type of text for the progress information control. This can be 
williamr@2
    59
         * percentage or fraction. See the @c TEikProgressTextType enum.
williamr@2
    60
         */
williamr@2
    61
        TEikProgressTextType iTextType;
williamr@2
    62
williamr@2
    63
        /** 
williamr@2
    64
         * The total number of splits in the progress information control. This
williamr@2
    65
         * is optional.
williamr@2
    66
         */
williamr@2
    67
        TInt iSplitsInBlock;
williamr@2
    68
williamr@2
    69
        /** 
williamr@2
    70
         * The final value of the progress information control that, when 
williamr@2
    71
         * reached, indicates completion.
williamr@2
    72
         */
williamr@2
    73
        TInt iFinalValue;
williamr@2
    74
williamr@2
    75
        /** The width of the control in pixels. */
williamr@2
    76
        TInt iWidth;
williamr@2
    77
    
williamr@2
    78
        /** The height of the progress information control. */
williamr@2
    79
        TInt iHeight;
williamr@2
    80
        };
williamr@2
    81
williamr@2
    82
    /**
williamr@2
    83
     * Defines the layout and colours for a progress information control.
williamr@2
    84
     */
williamr@2
    85
    struct SLayout
williamr@2
    86
        {
williamr@2
    87
        /** 
williamr@2
    88
         * The colour for the part of the control that indicates the progress
williamr@2
    89
         * that has been made. By default, the value of the @c TLogicalColor 
williamr@2
    90
         * enum's @c EColorControlHighlightBackground datum.
williamr@2
    91
         */
williamr@2
    92
        TRgb iFillColor;
williamr@2
    93
williamr@2
    94
        /**
williamr@2
    95
         * The colour for sections of the control that indicate the progress yet
williamr@2
    96
         * to be made. By default, the value of the @c TLogicalColor enum's 
williamr@2
    97
         * @c EColorControlBackground datum.
williamr@2
    98
         */
williamr@2
    99
        TRgb iEmptyColor;
williamr@2
   100
williamr@2
   101
        /**
williamr@2
   102
         * The colour for the optional progress text that is displayed i.e. 
williamr@2
   103
         * the filled portion of the control. By default, the value of the 
williamr@2
   104
         * @c TLogicalColor enum's @c EColorControlHighlightText datum.
williamr@2
   105
         */
williamr@2
   106
        TRgb iFillTextColor;
williamr@2
   107
williamr@2
   108
        /**
williamr@2
   109
         * Optional progress text that appears in the empty portion of the 
williamr@2
   110
         * control. By default, the value of the @c TLogicalColor enum's 
williamr@2
   111
         * @c EColorControlText datum.
williamr@2
   112
         */
williamr@2
   113
        TRgb iEmptyTextColor;
williamr@2
   114
williamr@2
   115
        /**
williamr@2
   116
         * The font to use for the optional progress text. By default, the 
williamr@2
   117
         * environment's normal font.
williamr@2
   118
         */
williamr@2
   119
        const CFont* iFont;
williamr@2
   120
williamr@2
   121
        /**
williamr@2
   122
         * The gap between the blocks in the control that indicate the progress 
williamr@2
   123
         * made. By default, one pixel.
williamr@2
   124
         */
williamr@2
   125
        TInt iGapBetweenBlocks;
williamr@2
   126
        };
williamr@2
   127
williamr@2
   128
    /**
williamr@2
   129
     * Destructor.
williamr@2
   130
     */
williamr@2
   131
    IMPORT_C ~CEikProgressInfo();
williamr@2
   132
    
williamr@2
   133
    /** 
williamr@2
   134
     * C++ default constructor.
williamr@2
   135
     */
williamr@2
   136
    IMPORT_C CEikProgressInfo();
williamr@2
   137
    
williamr@2
   138
    /**
williamr@2
   139
     * Constructs a progress information control using the information held in 
williamr@2
   140
     * the specified @c SInfo struct. Uses default layout values.
williamr@2
   141
     *
williamr@2
   142
     * @param aProgInfo Holds information about the type of progress 
williamr@2
   143
     *        information control.
williamr@2
   144
     */
williamr@2
   145
    IMPORT_C CEikProgressInfo(const SInfo& aProgInfo);
williamr@2
   146
    
williamr@2
   147
    /**
williamr@2
   148
     * Adds the specified increment to the current progress value and, if the 
williamr@2
   149
     * progress value has increased, redraws the control.
williamr@2
   150
     *
williamr@2
   151
     * @param aInc The increment to add to the current progress value.
williamr@2
   152
     */
williamr@2
   153
    IMPORT_C void IncrementAndDraw(TInt aInc);
williamr@2
   154
    
williamr@2
   155
    /**
williamr@2
   156
     * Sets the specified value as the new progress value and redraws the 
williamr@2
   157
     * control if the new value differs from the old value.
williamr@2
   158
     *
williamr@2
   159
     * @param aValue The new progress value.
williamr@2
   160
     */
williamr@2
   161
    IMPORT_C void SetAndDraw(TInt aValue);
williamr@2
   162
    
williamr@2
   163
    /**
williamr@2
   164
     * From @c CCoeControl.
williamr@2
   165
     *
williamr@2
   166
     * Constructs a progress information control from a @c PROGRESSINFO 
williamr@2
   167
     * resource. Uses default layout values.
williamr@2
   168
     * 
williamr@2
   169
     * @param aReader The resource reader to use.
williamr@2
   170
     */
williamr@2
   171
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   172
    
williamr@2
   173
    /**
williamr@2
   174
     * Sets the layout for the control.
williamr@2
   175
     *
williamr@2
   176
     * @param aLayout The layout for the control.
williamr@2
   177
     */
williamr@2
   178
    IMPORT_C void SetLayout(const SLayout& aLayout);
williamr@2
   179
    
williamr@2
   180
    /**
williamr@2
   181
     * Sets the control's border.
williamr@2
   182
     *
williamr@2
   183
     * @param aBorder The control's border.
williamr@2
   184
     */
williamr@2
   185
    IMPORT_C void SetBorder(const TGulBorder& aBorder);
williamr@2
   186
    
williamr@2
   187
    /**
williamr@2
   188
     * Sets the final value for the progress information control. This value 
williamr@2
   189
     * indicates the operation being monitored is complete.
williamr@2
   190
     *
williamr@2
   191
     * @param aFinalValue The final value for the progress information control.
williamr@2
   192
     *        If this is specified as zero, the value is set to one.
williamr@2
   193
     */
williamr@2
   194
    IMPORT_C void SetFinalValue(TInt aFinalValue);
williamr@2
   195
    
williamr@2
   196
    /**
williamr@2
   197
     * By default Symbian 2nd phase constructor is private.
williamr@2
   198
     */
williamr@2
   199
    IMPORT_C void ConstructL(); // AKNLAF
williamr@2
   200
williamr@2
   201
    /**
williamr@2
   202
     * Gets a pointer to the information used to define the progress information
williamr@2
   203
     * control's type.
williamr@2
   204
     *
williamr@2
   205
     * @return The information that defines the type of progress 
williamr@2
   206
     *         information control.
williamr@2
   207
     */
williamr@2
   208
    inline const SInfo& Info() const { return(iInfo); }
williamr@2
   209
    
williamr@2
   210
    /**
williamr@2
   211
     * Gets a pointer to the colours and layout of the progress information 
williamr@2
   212
     * control.
williamr@2
   213
     *
williamr@2
   214
     * @return Defines the layout of the control.
williamr@2
   215
     */
williamr@2
   216
    inline const SLayout& Layout() const { return(iLayout); }
williamr@2
   217
    
williamr@2
   218
    /**
williamr@2
   219
     * Gets the current value, indicating how far the operation has progressed.
williamr@2
   220
     *
williamr@2
   221
     * @return The value for how far the operation has progressed.
williamr@2
   222
     */
williamr@2
   223
    inline TInt CurrentValue() const { return(iCurrentValue); }
williamr@2
   224
williamr@2
   225
protected:
williamr@2
   226
    
williamr@2
   227
    /**
williamr@2
   228
     * Evaluates the progress text.
williamr@2
   229
     *
williamr@2
   230
     * @param[out] aTextBuf On return, the evaluted text. This is the same
williamr@2
   231
     *                 as the return value.
williamr@2
   232
     * @return The evaluated text. Null if progress information is not 
williamr@2
   233
     *         held as text. A percentage if it is held as a percentage. 
williamr@2
   234
     *         Otherwise, the current value and final value separated by 
williamr@2
   235
     *         a slash. Subclassers may wish to use their own buffer.
williamr@2
   236
     **/
williamr@2
   237
    IMPORT_C virtual const TDesC* EvaluateText(TDes& aTextBuf) const;
williamr@2
   238
williamr@2
   239
public: // from CCoeControl
williamr@2
   240
williamr@2
   241
    /**
williamr@2
   242
     * From @c CCoeControl.
williamr@2
   243
     *
williamr@2
   244
     * Activates the progress information control.
williamr@2
   245
     */
williamr@2
   246
    IMPORT_C void ActivateL();
williamr@2
   247
williamr@2
   248
    /**
williamr@2
   249
     * From @c CCoeControl.
williamr@2
   250
     *
williamr@2
   251
     * Gets the minimum size required to draw the control.
williamr@2
   252
     *
williamr@2
   253
     * @return Two-dimensional size as a width and a height value.
williamr@2
   254
     */
williamr@2
   255
    IMPORT_C TSize MinimumSize();
williamr@2
   256
williamr@2
   257
    /**
williamr@2
   258
     * From @c CCoeControl.
williamr@2
   259
     *
williamr@2
   260
     * Recalculates the control's size in response to a size change.
williamr@2
   261
     */
williamr@2
   262
    IMPORT_C void SizeChanged();
williamr@2
   263
williamr@2
   264
    /**
williamr@2
   265
     * From @c CCoeControl.
williamr@2
   266
     *
williamr@2
   267
     * Gets a list of the logical colours used to draw the control, appended 
williamr@2
   268
     * to @c aColorUseList.
williamr@2
   269
     *
williamr@2
   270
     * @param[out] aColorUseList On return, the colours used to draw 
williamr@2
   271
     *             the control.
williamr@2
   272
     */
williamr@2
   273
    IMPORT_C virtual void GetColorUseListL(
williamr@2
   274
                                CArrayFix<TCoeColorUse>& aColorUseList) const;
williamr@2
   275
williamr@2
   276
    /**
williamr@2
   277
     * From @c CCoeControl.
williamr@2
   278
     *
williamr@2
   279
     * Handles a change to the control's resources.
williamr@2
   280
     *
williamr@2
   281
     * @param aType A message UID value.
williamr@2
   282
     */
williamr@2
   283
    IMPORT_C virtual void HandleResourceChange(TInt aType);
williamr@2
   284
williamr@2
   285
    /**
williamr@2
   286
     * From @c CCoeControl.
williamr@2
   287
     *
williamr@2
   288
     * Handles pointer events. This function gets called whenever a pointer
williamr@2
   289
     * event occurs in the control, i.e. when the pointer is within 
williamr@2
   290
     * the control's extent, or when the control has grabbed the pointer. 
williamr@2
   291
     * The control should implement this function to handle pointer events.
williamr@2
   292
     *
williamr@2
   293
     * Note: events of type @c EButton1Down are processed before 
williamr@2
   294
     * @c HandlePointerEventL() is called, in order to transfer keyboard focus 
williamr@2
   295
     * to the control in which the @c EButton1Down event occurred.
williamr@2
   296
     * If overriding @c HandlePointerEventL(), the implementation must include 
williamr@2
   297
     * a base call to @c CCoeControl's @c HandlePointerEventL().
williamr@2
   298
     *
williamr@2
   299
     * @param aPointerEvent The pointer event.
williamr@2
   300
     */
williamr@2
   301
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
williamr@2
   302
williamr@2
   303
protected: //from CCoeControl
williamr@2
   304
williamr@2
   305
    /**
williamr@2
   306
     * From @c CCoeControl.
williamr@2
   307
     *
williamr@2
   308
     * Writes the internal state of the control and its components to a stream.
williamr@2
   309
     * This function is empty in release builds. It is intended to be overridden
williamr@2
   310
     * and base called by subclasses.
williamr@2
   311
     *
williamr@2
   312
     * @since App-Framework_6.1
williamr@2
   313
     * @param aWriteStream The internal state of the control and its components.
williamr@2
   314
     */
williamr@2
   315
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   316
williamr@2
   317
private: // from CCoeControl
williamr@2
   318
williamr@2
   319
    IMPORT_C void Draw(const TRect& aRect) const;
williamr@2
   320
    IMPORT_C void Reserved_2();	
williamr@2
   321
williamr@2
   322
private:
williamr@2
   323
williamr@2
   324
    /**
williamr@2
   325
    * From CAknControl
williamr@2
   326
    */
williamr@2
   327
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   328
williamr@2
   329
private: // internal use
williamr@2
   330
williamr@2
   331
	void Construct();
williamr@2
   332
	void CheckSizeCalculated();
williamr@2
   333
	void DrawPartial()const; // AKNLAF
williamr@2
   334
	void DrawProgressBarForeground(CWindowGc& aGc) const; //AKNLAF
williamr@2
   335
	void DrawProgressBarBackground(CWindowGc& aGc) const; //AKNLAF
williamr@2
   336
	TInt FilledWidth() const; //AKNLAF
williamr@2
   337
    
williamr@2
   338
private:
williamr@2
   339
williamr@2
   340
	SInfo iInfo;
williamr@2
   341
	SLayout iLayout;
williamr@2
   342
	TInt iCurrentValue;
williamr@2
   343
	TBool iHeightWasSupplied;
williamr@2
   344
	CFbsBitmap* iBitmap; // AKNLAF
williamr@2
   345
	CFbsBitmap* iBackgroundBitmap; // AKNLAF Not used, extension!
williamr@2
   346
	CFbsBitmap* iBitmapMask; // AKNLAF
williamr@2
   347
	//CFbsBitmap* iBackgroundBitmapMask; // AKNLAF
williamr@2
   348
    CEikProgressInfoExtension* iExtension;
williamr@2
   349
williamr@2
   350
private:
williamr@2
   351
williamr@2
   352
    void LoadBitmapsL();
williamr@2
   353
    void SetBitmapSizes();
williamr@2
   354
    void DeleteBitmaps();
williamr@2
   355
	};
williamr@2
   356
williamr@2
   357
williamr@2
   358
#endif  // __EIKPROGI_H__