epoc32/include/mw/eikcmbut.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 /*
     2 * Copyright (c) 2001-2006 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     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
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:  Command button class interfaces. Contains a common base class
    15 *  for command-generating buttons, plus several concrete, specialized classes
    16 * 
    17 *
    18 */
    19 
    20 
    21 #if !defined(__EIKCMBUT_H__)
    22 #define __EIKCMBUT_H__
    23 
    24 #if !defined(__EIKBUTB_H__)
    25 #include <eikbutb.h>
    26 #endif
    27 
    28 #if !defined(__COECCNTX_H__)
    29 #include <coeccntx.h>
    30 #endif
    31 
    32 #if !defined(__GULUTIL_H__)
    33 #include <gulutil.h>
    34 #endif
    35 
    36 class CEikLabel;
    37 class CEikImage;
    38 class CEikAlignedControl;
    39 class TResourceReader;
    40 class CEikCommandStack;
    41 
    42 /**
    43  *  Base class for buttons that generate commands.
    44  *
    45  *  MControlContext is mixed in. This class is used as the interface to the button member of 
    46  *  CEikLabeledButton, as well as being the base class for CEikCommandButton, CEikTextButton, and CEikBitmapButton
    47  *
    48  *  @lib eikcoctl.dll
    49  *  @since S60 1.0
    50  */
    51 class CEikCommandButtonBase : public CEikButtonBase, public MCoeControlContext
    52 	{
    53 public:
    54     /**
    55     * Enumeration to tag the components of a command button (text or image)
    56     */
    57     enum TWhichComponent
    58         {
    59         EFirst,
    60         ESecond
    61         };
    62     
    63     /**
    64     * Controls which of the components of the command button are shown.
    65     */    
    66     enum TDisplayContent
    67         {
    68         EFirstOnly	=0x0100,
    69         ESecondOnly	=0x0200,
    70         EBoth		=0x0300
    71         };
    72 
    73     /*
    74     * Layout and font options for the components of the command button
    75     */
    76     enum TLayout
    77         {
    78         EFirstRightSecondLeft=0x0000,
    79         EFirstBottomSecondTop=0x0001,
    80         EFirstTopSecondBottom=0x0002,
    81         EFirstLeftSecondRight=0x0003,
    82         EDenseFont			 =0x0008
    83     };
    84     
    85     /**
    86     * Options for where excess space between the two components of the command button is distrubuted
    87     */
    88     enum TExcess
    89 		{
    90 		EShare	=0x0000,
    91 		EToFirst	=0x0010,
    92 		EToSecond =0x0020
    93 		};
    94 
    95 public: // new functions
    96 
    97     /**
    98     * C++ destructor
    99     */
   100     IMPORT_C ~CEikCommandButtonBase();
   101 
   102     /**
   103     * Sets the layout of the button
   104     * @param aLayout    Layout enumeration
   105     */
   106     IMPORT_C void SetButtonLayout(TLayout aLayout);
   107 
   108     /**
   109     * Sets where excess space is to be put
   110     * @param aExcess    Excess space enumeration
   111     */
   112     IMPORT_C void SetExcessSpace(TExcess aExcess);
   113     
   114     /**
   115     * Sets the content of the button
   116     *
   117     * @param aContent
   118     */
   119     IMPORT_C void SetDisplayContent(TDisplayContent aContent);
   120     
   121     /**
   122     * Causes the content to be (re-)laid out.
   123     */
   124     IMPORT_C void LayoutComponents();
   125 
   126     /**
   127     * Read preamble part of the resource. This call can be followed by calls to 
   128     * ConstructLabelFromResourceL and/or ConstructImageFromResourceL to complete contruction.
   129     */
   130     IMPORT_C void StartConstructFromResourceL(TResourceReader& aReader);
   131 
   132     /**
   133     * Constructs a label component for the button
   134     * 
   135     * @aparam aWhich    Which component to construct in this call
   136     */
   137     IMPORT_C void ConstructLabelFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
   138 
   139     /**
   140     * Constructs an image component for the button
   141     *
   142     * @aparam aWhich    Which component to construct in this call
   143     */
   144     IMPORT_C void ConstructImageFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
   145 
   146     /**
   147     * Cause a recalculation of the components alignment
   148     */
   149     IMPORT_C virtual void UpdateComponentAlignment();
   150 
   151     /**
   152     * Sets this button to be the default.
   153     */
   154     IMPORT_C void SetDefault(TBool aIsDefault);
   155     
   156 public:	// from CCoeControl. See base class documentation
   157     /**
   158     * From CCoeControl
   159     *
   160     * Sets the button to be inactive. The button is drawn with a dimmed effect. 
   161     *
   162     *  @param aDimmed   If not EFalse, set the state to dimmed. Otherwise set to non-dimmed
   163     */
   164     IMPORT_C void SetDimmed(TBool aDimmed);
   165     
   166     /**
   167     * From CCoeControl
   168     *
   169     * Reports to the caller the minimum size that the control can be, given its contents.
   170     *
   171     *  @return  The minimum size
   172     */
   173     IMPORT_C TSize MinimumSize();
   174     
   175     /**
   176     * From CCoeControl
   177     *
   178     * Returns the number of component controls
   179     *
   180     *  @return  Number of component controls
   181     */
   182     IMPORT_C TInt CountComponentControls() const;
   183     
   184     /**
   185     * From CCoeControl
   186     *
   187     * Return a pointer to the component control at the give index.
   188     *
   189     *  @return  Pointer to the conponent control. No ownership is transferred
   190     */
   191     IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
   192 
   193     /**
   194     * From CCoeControl
   195     *
   196     * Make the control ready for display.
   197     */
   198     IMPORT_C void ActivateL();
   199 
   200     /**
   201     * From CCoeControl
   202     *
   203     * Sets the control whose window is to be used as a container for this control
   204     *
   205     *  @param aContainer control
   206     */
   207     IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer);
   208     
   209     /**
   210     * From CCoeControl
   211     *
   212     * Called when the focus has changed
   213     *
   214     *  @param aDrawNow  Iff not EFalse, then the control is requested to redraw.
   215     */
   216     IMPORT_C void FocusChanged(TDrawNow aDrawNow);
   217     
   218     /**
   219     * From CCoeControl
   220     *
   221     * CONE framework is requesting that the passed-in key be handled.
   222     *
   223     *  @param aKeyEvent     Wserv event type
   224     *  @param aKeyCode      Key code
   225     */
   226     IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode /*aType*/);
   227     
   228     /**
   229     * From CCoeControl
   230     *
   231     * Obtain the list of colors to be used by this control
   232     *
   233     *  @param aColorUseList
   234     */
   235     IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
   236 
   237     /**
   238     * From CCoeControl
   239     *
   240     * This is called when resource or layout or other display-affecting setting has changed.
   241     * Change the internals of the control so that it is ready for a subsequent SizeChanged call.
   242     *
   243     *  @param aType  Type of resource or setting that has changed
   244     */
   245     IMPORT_C virtual void HandleResourceChange(TInt aType);
   246 
   247     /**
   248     * From CCoeControl
   249     *
   250     * Handle a pointer event that has been routed to this control
   251     *
   252     *  @param aPointerEvent   Pointer event to handle
   253     */
   254     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
   255 
   256 public: // but not exported
   257     /**
   258     * Access to the command stack
   259     *
   260     * @return   pointer to the command stack
   261     */
   262     CEikCommandStack* CommandStack() const;
   263     
   264     /**
   265     * Access to the button flags
   266     * 
   267     *  @return  The button flag pattern
   268     */
   269     TInt ButFlags() const;
   270     
   271     /**
   272     * Access to whether the button is default
   273     * 
   274     * @return EFalse iff the button is not default.
   275     */
   276     TBool IsDefault() const;
   277 
   278 protected: 
   279 
   280     /**
   281     * From CEikButtonBase
   282     *
   283     * Framework method called when the state changes
   284     */ 
   285     IMPORT_C void StateChanged();
   286 
   287 protected:
   288     /**
   289     * Constructor
   290     */
   291     IMPORT_C CEikCommandButtonBase();
   292 
   293     /**
   294     *  Sets the label text for the button.
   295     * 
   296     *  @param aText                 The text to set
   297     *  @param aComponent      The component for which the text is to be set.
   298     */
   299     IMPORT_C void SetTextL(const TDesC& aText,CEikAlignedControl*& aComponent);
   300 
   301     /**
   302     *  Sets the bitmap and optional mask for the button
   303     * 
   304     *  @param aMain               The bitmap to use
   305     *  @param aMask               The mask. If null, then no mask will be used
   306     *  @param aComponent      The component for which the picture is to be set.
   307     */
   308     IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask,CEikAlignedControl*& aComponent);
   309 
   310     /**
   311     * Sets the bitmap and optional mask from an mbm file.
   312     *
   313     *  @param aFile                 Mbm filename 
   314     *  @param aMain               Index of the bitmap to use
   315     *  @param aMask               Index of the mask. If -1, then a null mask will be used
   316     *  @param aComponent      The component for which the picture is to be set.
   317     */
   318     IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask,CEikAlignedControl*& aComponent);
   319 
   320     /**
   321     * Utility routine. Calling this without a leave will ensure the internal command stack is constructed.
   322     */
   323     inline void CheckCreateCommandStackL();
   324     
   325 protected: // from CCoeControl
   326     /**
   327     * From CCoeControl
   328     *
   329     * Request for the control to draw itself within the given rectangle
   330     *
   331     * @param aRect TRect to draw
   332     */
   333     IMPORT_C void Draw(const TRect& aRect) const;
   334 
   335 protected:
   336 
   337     /**
   338     *  Utility routine. Sets additional look and feel attributes for the image
   339     */
   340     void SetImageAttributes(CEikImage* aImage);
   341 
   342     /**
   343     *  Access the behaviour set into the button
   344     */
   345     inline TInt Behavior() const;
   346 
   347 protected:
   348     /**
   349     * From CCoeControl
   350     *
   351     * Serialize the state of the control
   352     *
   353     * @param aWriteStream   Output stream for the serialization
   354     */
   355     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   356     
   357 private:
   358     /**
   359     * From CCoeControl
   360     *
   361     * Framework method called when the size or layout changes
   362     */ 
   363     IMPORT_C void SizeChanged();
   364     IMPORT_C void Reserved_2();
   365 
   366 private: // from CEikButtonBase
   367     IMPORT_C void Reserved_3();
   368 
   369 private: 
   370     /**
   371     * From MCoeControlContext
   372     * 
   373     * Modify the passed-in graphics context ready for use in this control
   374     * 
   375     * @param aGc    Graphics context to set up
   376     */
   377     IMPORT_C void PrepareContext(CWindowGc& aGc) const;
   378     
   379 private:
   380     IMPORT_C virtual void Reserved_4();
   381 private:
   382     /**
   383     * From CAknControl
   384     */
   385     IMPORT_C void* ExtensionInterface( TUid aInterface );
   386 
   387 // New methods
   388 private:
   389     void SetComponentExtents(const TRect& aRect);
   390     void SetNewComponentExtentL();
   391     TBool LayoutIsVertical() const;
   392 protected:
   393     TMargins8 iMargins;
   394     /**
   395     * The components of the button: the image or the text (order determined by construction)
   396     */
   397     CEikAlignedControl* iComponents[2];
   398     TInt iCmdFlags;
   399 private:
   400     TInt iDrawOffset;
   401     /**
   402     * Owned
   403     */
   404     CEikCommandStack* iCommandStack; 
   405     TInt iDummy;
   406     TBool iDefault;
   407     };
   408 
   409 /**
   410  *  Command button with a text and/or an image
   411  *
   412  *  This class in S60 does not function without derivation
   413  *  This class does NOT implement S60 look-and-feel and is not skinned.
   414  *
   415  *  @lib eikcoctl.dll
   416  *  @since S60 1.0
   417  */
   418 class CEikCommandButton : public CEikCommandButtonBase
   419 	{
   420 public:
   421     /** Layout options for a command button*/
   422     enum TLayout
   423         {
   424         ETextRightPictureLeft=0x000,
   425         ETextBottomPictureTop=0x001,
   426         ETextTopPictureBottom=0x002,
   427         ETextLeftPictureRight=0x003
   428         };
   429 
   430     /**
   431     * Where to put excess space in the layout
   432     */
   433     enum TExcess
   434         {
   435         EShare		=0x0000,
   436         EToText		=0x0010,
   437         EToPicture	=0x0020
   438         };
   439     
   440     /**
   441     * Content to diplay for this button
   442     */ 
   443     enum TDisplayContent
   444         {
   445         ETextOnly		=0x0100,
   446         EPictureOnly	=0x0200,
   447         ETextAndPicture	=0x0300
   448         };
   449 
   450 public:
   451 
   452     /**
   453     * Constructor
   454     */
   455     IMPORT_C CEikCommandButton();
   456 
   457     /**
   458     * C++ destructor
   459     */
   460     IMPORT_C ~CEikCommandButton();
   461 
   462     /**
   463     *  Sets the label text for the button.
   464     * 
   465     *  @param aText                 The text to set
   466     */
   467     IMPORT_C void SetTextL(const TDesC& aText);
   468 
   469     /**
   470     *  Sets the bitmap and optional mask for the button
   471     * 
   472     *  @param aMain               The bitmap to use
   473     *  @param aMask               The mask. If null, then no mask will be used
   474     */
   475     IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL);
   476 
   477     /**
   478     * Set bitmap and mask from file.
   479     */
   480     IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
   481 
   482     /**
   483     * Access the label control that implements the text label of the button.  Ownership is not transferred.
   484     *
   485     * @return   A pointer to the CEikLabel control used to implement the text display
   486     */
   487     IMPORT_C CEikLabel* Label() const;
   488 
   489     /**
   490     * Access the CEikImage that implements the picture component of the button.  Ownership is not transferred.
   491     *
   492     * @return   A pointer to the CEikImage used to implement the image display.
   493     */
   494     IMPORT_C CEikImage* Picture() const;
   495 
   496     /**
   497     * Set the layout of the button
   498     *
   499     * @param aLayout    Layout to be used
   500     */
   501     IMPORT_C void SetButtonLayout(TLayout aLayout);
   502 
   503     /**
   504     * Sets where the excess space in the layout is to be distributed
   505     *
   506     * @param aExcess    Enum value to say where the excess space is to go
   507     */
   508     IMPORT_C void SetExcessSpace(TExcess aExcess);
   509 
   510     /**
   511     * Set what content is to be displayed in the button
   512     *
   513     * @param aContent   Enum value saying what content to display
   514     */
   515     IMPORT_C void SetDisplayContent(TDisplayContent aContent);
   516 
   517     /**
   518     * Sets the command button's text, bitmap and bitmap mask.
   519     *
   520     * @param aCommandId     Command ID to be generated by pressing this button
   521     * @param aText                 Text to display on the button
   522     * @param aBitmap             Bitmap to display on the button
   523     * @param aMask               Mask to use. May be Null
   524     */	
   525     IMPORT_C void SetCommandL(TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
   526 
   527     /**
   528     * Push a command ID + text + image binding onto the command stack.
   529     * 
   530     * @param aCommandId     Command ID to be generated by pressing this button
   531     * @param aText                 Text to display on the button
   532     * @param aBitmap             Bitmap to display on the button
   533     * @param aMask               Mask to use. May be Null
   534     */
   535     IMPORT_C void AddCommandToStackL(TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
   536 
   537     /**
   538     * Find the stacked command with a given command ID and remove it from the stack
   539     *
   540     * @param aCommandId      ID of the command to be removed
   541     * @return                           EFalse iff the comand is not found
   542     */
   543     IMPORT_C TBool RemoveCommandFromStack(TInt aCommandId);
   544 
   545     /**
   546     * Remove the top (most recently added) command binding from the command stack
   547     * 
   548     * @return the number of commands left on the stack.
   549     */
   550     IMPORT_C TInt PopCommandFromStack();
   551 
   552 public: // from CCoeControl
   553     /**
   554     * From CCoeControl
   555     *
   556     * Construct the object from resource
   557     * 
   558     * @param aReader  Fully constructed resource reader
   559     */
   560     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
   561     
   562     /**
   563     * From CCoeControl
   564     *
   565     * Handle a pointer event coming from the CONE framework
   566     * 
   567     * @param aPointerEvent  Event to handle
   568     */
   569      IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
   570 
   571 public:
   572     /**
   573     * From CEikCommandButtonBase
   574     *
   575     * Cause a recalculation of the components alignment
   576     */
   577     IMPORT_C void UpdateComponentAlignment();
   578 
   579 private:
   580     void UpdateLabelReserveLengthL(const TDesC* aText);
   581 
   582 private:
   583     /**
   584     * From CAknControl
   585     */
   586     IMPORT_C void* ExtensionInterface( TUid aInterface );
   587 private:
   588     TInt iDummy;
   589     };
   590 
   591 /**
   592  * The CEikTwoPictureCommandButton class is a command button which can hold two pictures as
   593  * well as label text. If a second picture is set for the button it is shown when the button
   594  * is pressed.
   595  *
   596  * @lib     eikcoctl.dll
   597  * @since S60 1.0
   598  */
   599 class CEikTwoPictureCommandButton : public CEikCommandButtonBase
   600     {
   601 public:
   602 
   603     /**
   604     * Layout options for the Two Picture botton
   605     */
   606     enum TLayout
   607         {
   608         ETextRightPictureLeft=0x000,
   609         ETextBottomPictureTop=0x001,
   610         ETextTopPictureBottom=0x002,
   611         ETextLeftPictureRight=0x003
   612         };
   613 
   614     /**
   615     * Where to put the excess space when laying out the bitmaps or text
   616     */
   617     enum TExcess
   618         {
   619         EShare		=0x0000,
   620         EToText		=0x0010,
   621         EToPicture	=0x0020
   622         };
   623 
   624     /**
   625     * Content to display for the text
   626     */
   627     enum TDisplayContent
   628         {
   629         ETextOnly		=0x0100,
   630         EPictureOnly	=0x0200,
   631         ETextAndPicture	=0x0300
   632         };
   633 
   634 private:
   635     /**
   636     * Options for the type of button
   637     */
   638     enum TPictureButtonType
   639         {
   640         EPictureButWithBorders		=0x0000,
   641         EPictureButWithoutBorders	=0x1000
   642         };
   643         
   644     /**
   645     * Sets the ownership of the pictures bitmap and mask objects. If owned externally, then no copy is made of the objects
   646     * in the setter functions.  It must be, in this case, ensured by the client that that the button is destroyed before
   647     * deleting the externally-owned objects.
   648     */
   649     enum TExternalPicture
   650         {
   651         EPictureNotOwnedExternally	=0x00,
   652         EPictureOwnedExternally		=0x01
   653         };
   654         
   655     public:
   656 
   657     /**
   658     * Two picture command button constructor
   659     */
   660     IMPORT_C CEikTwoPictureCommandButton();
   661 
   662     /**
   663     * Two picture command button C++ destructor
   664     */
   665     IMPORT_C ~CEikTwoPictureCommandButton();
   666 
   667     /**
   668     * Accesses ownership of the second picture' bitmap and mask (if present)
   669     *
   670     * @return EFalse iff and if the second picture is not owned externally
   671     */
   672     IMPORT_C TBool IsSecondPictureOwnedExternally();
   673 
   674     /**
   675     * Access the picture image.
   676     *
   677     * @return   The picture as a CEikImage. No ownership transferred.
   678     */
   679     IMPORT_C CEikImage* Picture() const;
   680 
   681     /**
   682     * Constructs the two images from resource
   683     *
   684     * @param aReader    Constructed resource reader.
   685     * @param aWhich     Which picture to be constructing
   686     */
   687     IMPORT_C void ConstructImagesFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
   688 
   689     /**
   690     * Sets the label text on the button
   691     *
   692     * @param aText  The text to set
   693     */
   694     IMPORT_C void SetTextL(const TDesC& aText);
   695 
   696     /**
   697     *  Sets the bitmap and optional mask for the button's two pictures. Optionally, only the first button's
   698     *  picture may be set up.
   699     * 
   700     *  @param aMain               The bitmap to use for the first picture
   701     *  @param aMask               The mask. If null, then no mask will be used
   702     *  @param aSecondMain     The bitmap to use for the second picture
   703     *  @param aSecondMask     The mask. If null, then no mask will be used
   704     */
   705     IMPORT_C void SetTwoPicturesL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL,const CFbsBitmap* aSecondMain=NULL, const CFbsBitmap* aSecondMask=NULL);
   706 
   707     /**
   708     *  Sets the bitmap and optional mask for the button's second picture
   709     * 
   710     *  @param aMain               The bitmap to use
   711     *  @param aMask               The mask. If null, then no mask will be used
   712     */
   713     IMPORT_C void SetSecondPicture(const CFbsBitmap* aSecondMain, const CFbsBitmap* aSecondMask=NULL);
   714 
   715     /**
   716     * Sets the bitmap and optional mask for the first picture from an mbm file.
   717     *
   718     *  @param aFile                 Mbm filename 
   719     *  @param aMain               Index of the bitmap to use
   720     *  @param aMask               Index of the mask. If -1, then a null mask will be used
   721     */
   722     IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
   723 
   724     /**
   725     * Sets the bitmap and optional mask for the second picture from an mbm file.
   726     *
   727     *  @param aFile                 Mbm filename 
   728     *  @param aMain               Index of the bitmap to use
   729     *  @param aMask               Index of the mask. If -1, then a null mask will be used
   730     */
   731     IMPORT_C void SetSecondPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
   732 
   733     /**
   734     * Sets the ownership of the second picture object
   735     *
   736     * @param aOwnership     Set to EFalse if bitmaps associated with the object are owned by the button
   737     */
   738     IMPORT_C void SetSecondPictureOwnedExternally(TBool aOwnership);
   739 
   740 public: // from CCoeControl. 
   741 
   742     /**
   743     * From CCoeControl
   744     *
   745     * @param aReader    Fully constructed resource reader
   746     */
   747     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
   748 
   749     /**
   750     * From CCoeControl
   751     *
   752     * Make the control ready for display
   753     */
   754     IMPORT_C void ActivateL();
   755 
   756     /**
   757     * From CCoeControl
   758     *
   759     * Handle a pointer event coming from the CONE framework
   760     * 
   761     * @param aPointerEvent  Event to handle
   762     */
   763     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 
   764     
   765 protected: 
   766     /**
   767     * From CCoeControl
   768     *
   769     * Serialize the state of the control
   770     *
   771     * @param aWriteStream   Output stream for the serialization
   772     */
   773     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   774 
   775 private: // from CCoeControl
   776 
   777     /**
   778     * From CCoeControl
   779     *
   780     * Request for the control to draw itself within the given rectangle
   781     *
   782     * @param aRect TRect to draw
   783     */
   784     IMPORT_C void Draw(const TRect& /*aRect*/) const;
   785 
   786     /**
   787     * From CEikButtonBase
   788     *
   789     * Framework method called when the state changes
   790     */ 
   791     IMPORT_C void StateChanged();
   792 
   793 private:
   794     /**
   795     * From CAknControl
   796     */
   797     IMPORT_C void* ExtensionInterface( TUid aInterface );
   798 
   799 private:
   800     /**
   801     * From MCoeControlContext
   802     * 
   803     * Modify the passed-in graphics context ready for use in this control
   804     * 
   805     * @param aGc    Graphics context to set up
   806     */
   807     IMPORT_C void PrepareContext(CWindowGc& aGc) const;
   808 
   809 private:
   810     void SwapPictures(CEikImage* aImage);
   811 
   812 private:
   813     /**
   814     * Ownership dependent on state of flags
   815     */
   816     const CFbsBitmap* iSecondBitmap;
   817     /**
   818     * Ownership dependent on state of flags
   819     */
   820     const CFbsBitmap* iSecondMaskBitmap;
   821     TInt iPictureFlags;
   822     TInt iDummy;
   823     };
   824 
   825 /**
   826  * The CEikInverterCommandButton class is a command button which swaps the foreground and background
   827  * colors used to draw the button contents when the button is pressed.
   828  *
   829  * @since S60 1.0
   830  */
   831 class CEikInverterCommandButton : public CEikCommandButton
   832 	{
   833 public:
   834 
   835     /**
   836     * Constructor
   837     */
   838     IMPORT_C CEikInverterCommandButton();
   839 
   840     /**
   841     * C++ destructor
   842     */
   843     IMPORT_C ~CEikInverterCommandButton();
   844     
   845 public: // From CCoeControl
   846 
   847     /**
   848     * From CCoeControl
   849     *
   850     * Handle a pointer event coming from the CONE framework
   851     * 
   852     * @param aPointerEvent  Event to handle
   853     */
   854     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
   855     
   856 protected:
   857 
   858     /**
   859     * From CCoeControl
   860     *
   861     * Serialize the state of the control
   862     *
   863     * @param aWriteStream   Output stream for the serialization
   864     */
   865     IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
   866     
   867 private:
   868     /**
   869     * From MCoeControlContext
   870     * 
   871     * Modify the passed-in graphics context ready for use in this control
   872     * 
   873     * @param aGc    Graphics context to set up
   874     */
   875     IMPORT_C void PrepareContext(CWindowGc& aGc) const;
   876     
   877 private:
   878     /**
   879     * From CAknControl
   880     */
   881     IMPORT_C void* ExtensionInterface( TUid aInterface );
   882 private:
   883     TInt iFlag; 
   884     TInt iDummy;
   885     };
   886 
   887 /**
   888  * A command button with a text label
   889  * 
   890  * This specialization of CEikCommandButtonBase supports a single text label.
   891  *
   892  *  @lib eikcoctl.dll
   893  *  @since S60 1.0
   894  */
   895 class CEikTextButton : public CEikCommandButtonBase
   896     {
   897 public:
   898 
   899     /**
   900     * Constructor
   901     */
   902     IMPORT_C CEikTextButton();
   903 
   904     /**
   905     * C++ destructor
   906     */
   907     IMPORT_C ~CEikTextButton();
   908 
   909     /**
   910     *  Sets the label text for the button.
   911     * 
   912     *  @param aText             The text to set
   913     *  @param aWhich          The component for which the text is to be set.
   914     */
   915     IMPORT_C void SetTextL(const TDesC& aText,TWhichComponent aWhich=EFirst);
   916 
   917     /**
   918     * Access the label control that implements the text label of the button.  Ownership is not transferred.
   919     *
   920     * @return   A pointer to the CEikLabel control used to implement the text display
   921     */
   922     IMPORT_C CEikLabel* Label(TWhichComponent aWhich=EFirst) const;
   923 
   924 // from CCoeControl
   925 public: 
   926 
   927     /**
   928     * From CCoeControl
   929     *
   930     * Construct the object from resource
   931     * 
   932     * @param aReader  Fully constructed resource reader
   933     */
   934     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
   935 
   936     /**
   937     * From CCoeControl
   938     *
   939     * Handle a pointer event coming from the CONE framework
   940     * 
   941     * @param aPointerEvent  Event to handle
   942     */
   943     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
   944 
   945 // From CAknControl
   946 private:
   947     IMPORT_C void* ExtensionInterface( TUid aInterface );
   948 
   949 private: // data
   950     TInt iDummy;
   951     };
   952 
   953 /**
   954  * A command button with a single bitmap
   955  * 
   956  * This specialization of CEikCommandButtonBase supports a single bitmap, optionally with a mask.
   957  *
   958  *  @lib eikcoctl.dll
   959  *  @since S60 1.0
   960  */
   961 class CEikBitmapButton : public CEikCommandButtonBase
   962     {
   963 public:
   964 
   965     /**
   966     * Constructor
   967     */
   968     IMPORT_C CEikBitmapButton();
   969 
   970     /**
   971     * C++ Destructor
   972     */
   973     IMPORT_C ~CEikBitmapButton();
   974 
   975     /**
   976     *  Sets the bitmap and optional mask for the button
   977     * 
   978     *  @param aMain               The bitmap to use
   979     *  @param aMask               The mask. If null, then no mask will be used
   980     *  @param aWhich             The component for which the picture is to be set.
   981     */
   982     IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL,TWhichComponent aWhich=EFirst);
   983 
   984     /**
   985     * Sets the bitmap and optional mask from an mbm file.
   986     *
   987     *  @param aFile                 Mbm filename 
   988     *  @param aMain               Index of the bitmap to use
   989     *  @param aMask               Index of the mask. If -1, then a null mask will be used
   990     *  @param aWhich             The component for which the picture is to be set.
   991     */
   992    IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1,TWhichComponent aWhich=EFirst);
   993 
   994     /**
   995     * Access to the image
   996     *
   997     * @param aWhich     Which picture to access
   998     * @return                 pointer to the image.  No ownership is transferred
   999     */
  1000     IMPORT_C CEikImage* Picture(TWhichComponent aWhich=EFirst) const;
  1001 
  1002 // from CCoeControl
  1003 public: 
  1004     /**
  1005     * From CCoeControl
  1006     *
  1007     * Construct the object from resource
  1008     * 
  1009     * @param aReader  Fully constructed resource reader
  1010     */
  1011     IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
  1012 
  1013     /**
  1014     * From CCoeControl
  1015     *
  1016     * Handle a pointer event coming from the CONE framework
  1017     * 
  1018     * @param aPointerEvent  Event to handle
  1019     */
  1020     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);	
  1021 
  1022 private:
  1023     /**
  1024     * From CAknControl
  1025     */
  1026     IMPORT_C void* ExtensionInterface( TUid aInterface );
  1027     
  1028 private: // data
  1029     TInt iDummy;
  1030     };
  1031 
  1032 #endif // __EIKCMBUT_H__