00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(__EIKCMBUT_H__)
00023 #define __EIKCMBUT_H__
00024
00025 #if !defined(__EIKBUTB_H__)
00026 #include <eikbutb.h>
00027 #endif
00028
00029 #if !defined(__COECCNTX_H__)
00030 #include <coeccntx.h>
00031 #endif
00032
00033 #if !defined(__GULUTIL_H__)
00034 #include <gulutil.h>
00035 #endif
00036
00037 class CEikLabel;
00038 class CEikImage;
00039 class CEikAlignedControl;
00040 class TResourceReader;
00041 class CEikCommandStack;
00042
00052 class CEikCommandButtonBase : public CEikButtonBase, public MCoeControlContext
00053 {
00054 public:
00058 enum TWhichComponent
00059 {
00060 EFirst,
00061 ESecond
00062 };
00063
00067 enum TDisplayContent
00068 {
00069 EFirstOnly =0x0100,
00070 ESecondOnly =0x0200,
00071 EBoth =0x0300
00072 };
00073
00074
00075
00076
00077 enum TLayout
00078 {
00079 EFirstRightSecondLeft=0x0000,
00080 EFirstBottomSecondTop=0x0001,
00081 EFirstTopSecondBottom=0x0002,
00082 EFirstLeftSecondRight=0x0003,
00083 EDenseFont =0x0008
00084 };
00085
00089 enum TExcess
00090 {
00091 EShare =0x0000,
00092 EToFirst =0x0010,
00093 EToSecond =0x0020
00094 };
00095
00096 public:
00097
00101 IMPORT_C ~CEikCommandButtonBase();
00102
00107 IMPORT_C void SetButtonLayout(TLayout aLayout);
00108
00113 IMPORT_C void SetExcessSpace(TExcess aExcess);
00114
00120 IMPORT_C void SetDisplayContent(TDisplayContent aContent);
00121
00125 IMPORT_C void LayoutComponents();
00126
00131 IMPORT_C void StartConstructFromResourceL(TResourceReader& aReader);
00132
00138 IMPORT_C void ConstructLabelFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
00139
00145 IMPORT_C void ConstructImageFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
00146
00150 IMPORT_C virtual void UpdateComponentAlignment();
00151
00155 IMPORT_C void SetDefault(TBool aIsDefault);
00156
00157 public:
00165 IMPORT_C void SetDimmed(TBool aDimmed);
00166
00174 IMPORT_C TSize MinimumSize();
00175
00183 IMPORT_C TInt CountComponentControls() const;
00184
00192 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00193
00199 IMPORT_C void ActivateL();
00200
00208 IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer);
00209
00217 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00218
00227 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode );
00228
00236 IMPORT_C virtual void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00237
00246 IMPORT_C virtual void HandleResourceChange(TInt aType);
00247
00255 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00256
00257 public:
00263 CEikCommandStack* CommandStack() const;
00264
00270 TInt ButFlags() const;
00271
00277 TBool IsDefault() const;
00278
00279 protected:
00280
00286 IMPORT_C void StateChanged();
00287
00288 protected:
00292 IMPORT_C CEikCommandButtonBase();
00293
00300 IMPORT_C void SetTextL(const TDesC& aText,CEikAlignedControl*& aComponent);
00301
00309 IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask,CEikAlignedControl*& aComponent);
00310
00319 IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask,CEikAlignedControl*& aComponent);
00320
00324 inline void CheckCreateCommandStackL();
00325
00326 protected:
00334 IMPORT_C void Draw(const TRect& aRect) const;
00335
00336 protected:
00337
00341 void SetImageAttributes(CEikImage* aImage);
00342
00346 inline TInt Behavior() const;
00347
00348 protected:
00356 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00357
00358 private:
00364 IMPORT_C void SizeChanged();
00365 IMPORT_C void Reserved_2();
00366
00367 private:
00368 IMPORT_C void Reserved_3();
00369
00370 private:
00378 IMPORT_C void PrepareContext(CWindowGc& aGc) const;
00379
00380 private:
00381 IMPORT_C virtual void Reserved_4();
00382 private:
00386 IMPORT_C void* ExtensionInterface( TUid aInterface );
00387
00388
00389 private:
00390 void SetComponentExtents(const TRect& aRect);
00391 void SetNewComponentExtentL();
00392 TBool LayoutIsVertical() const;
00393 protected:
00394 TMargins8 iMargins;
00398 CEikAlignedControl* iComponents[2];
00399 TInt iCmdFlags;
00400 private:
00401 TInt iDrawOffset;
00405 CEikCommandStack* iCommandStack;
00406 TInt iDummy;
00407 TBool iDefault;
00408 };
00409
00419 class CEikCommandButton : public CEikCommandButtonBase
00420 {
00421 public:
00423 enum TLayout
00424 {
00425 ETextRightPictureLeft=0x000,
00426 ETextBottomPictureTop=0x001,
00427 ETextTopPictureBottom=0x002,
00428 ETextLeftPictureRight=0x003
00429 };
00430
00434 enum TExcess
00435 {
00436 EShare =0x0000,
00437 EToText =0x0010,
00438 EToPicture =0x0020
00439 };
00440
00444 enum TDisplayContent
00445 {
00446 ETextOnly =0x0100,
00447 EPictureOnly =0x0200,
00448 ETextAndPicture =0x0300
00449 };
00450
00451 public:
00452
00456 IMPORT_C CEikCommandButton();
00457
00461 IMPORT_C ~CEikCommandButton();
00462
00468 IMPORT_C void SetTextL(const TDesC& aText);
00469
00476 IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL);
00477
00481 IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
00482
00488 IMPORT_C CEikLabel* Label() const;
00489
00495 IMPORT_C CEikImage* Picture() const;
00496
00502 IMPORT_C void SetButtonLayout(TLayout aLayout);
00503
00509 IMPORT_C void SetExcessSpace(TExcess aExcess);
00510
00516 IMPORT_C void SetDisplayContent(TDisplayContent aContent);
00517
00526 IMPORT_C void SetCommandL(TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
00527
00536 IMPORT_C void AddCommandToStackL(TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
00537
00544 IMPORT_C TBool RemoveCommandFromStack(TInt aCommandId);
00545
00551 IMPORT_C TInt PopCommandFromStack();
00552
00553 public:
00561 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00562
00570 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00571
00572 public:
00578 IMPORT_C void UpdateComponentAlignment();
00579
00580 private:
00581 void UpdateLabelReserveLengthL(const TDesC* aText);
00582
00583 private:
00587 IMPORT_C void* ExtensionInterface( TUid aInterface );
00588 private:
00589 TInt iDummy;
00590 };
00591
00600 class CEikTwoPictureCommandButton : public CEikCommandButtonBase
00601 {
00602 public:
00603
00607 enum TLayout
00608 {
00609 ETextRightPictureLeft=0x000,
00610 ETextBottomPictureTop=0x001,
00611 ETextTopPictureBottom=0x002,
00612 ETextLeftPictureRight=0x003
00613 };
00614
00618 enum TExcess
00619 {
00620 EShare =0x0000,
00621 EToText =0x0010,
00622 EToPicture =0x0020
00623 };
00624
00628 enum TDisplayContent
00629 {
00630 ETextOnly =0x0100,
00631 EPictureOnly =0x0200,
00632 ETextAndPicture =0x0300
00633 };
00634
00635 private:
00639 enum TPictureButtonType
00640 {
00641 EPictureButWithBorders =0x0000,
00642 EPictureButWithoutBorders =0x1000
00643 };
00644
00650 enum TExternalPicture
00651 {
00652 EPictureNotOwnedExternally =0x00,
00653 EPictureOwnedExternally =0x01
00654 };
00655
00656 public:
00657
00661 IMPORT_C CEikTwoPictureCommandButton();
00662
00666 IMPORT_C ~CEikTwoPictureCommandButton();
00667
00673 IMPORT_C TBool IsSecondPictureOwnedExternally();
00674
00680 IMPORT_C CEikImage* Picture() const;
00681
00688 IMPORT_C void ConstructImagesFromResourceL(TResourceReader& aReader,TWhichComponent aWhich);
00689
00695 IMPORT_C void SetTextL(const TDesC& aText);
00696
00706 IMPORT_C void SetTwoPicturesL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL,const CFbsBitmap* aSecondMain=NULL, const CFbsBitmap* aSecondMask=NULL);
00707
00714 IMPORT_C void SetSecondPicture(const CFbsBitmap* aSecondMain, const CFbsBitmap* aSecondMask=NULL);
00715
00723 IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
00724
00732 IMPORT_C void SetSecondPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1);
00733
00739 IMPORT_C void SetSecondPictureOwnedExternally(TBool aOwnership);
00740
00741 public:
00742
00748 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00749
00755 IMPORT_C void ActivateL();
00756
00764 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00765
00766 protected:
00774 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00775
00776 private:
00777
00785 IMPORT_C void Draw(const TRect& ) const;
00786
00792 IMPORT_C void StateChanged();
00793
00794 private:
00798 IMPORT_C void* ExtensionInterface( TUid aInterface );
00799
00800 private:
00808 IMPORT_C void PrepareContext(CWindowGc& aGc) const;
00809
00810 private:
00811 void SwapPictures(CEikImage* aImage);
00812
00813 private:
00817 const CFbsBitmap* iSecondBitmap;
00821 const CFbsBitmap* iSecondMaskBitmap;
00822 TInt iPictureFlags;
00823 TInt iDummy;
00824 };
00825
00832 class CEikInverterCommandButton : public CEikCommandButton
00833 {
00834 public:
00835
00839 IMPORT_C CEikInverterCommandButton();
00840
00844 IMPORT_C ~CEikInverterCommandButton();
00845
00846 public:
00847
00855 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00856
00857 protected:
00858
00866 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00867
00868 private:
00876 IMPORT_C void PrepareContext(CWindowGc& aGc) const;
00877
00878 private:
00882 IMPORT_C void* ExtensionInterface( TUid aInterface );
00883 private:
00884 TInt iFlag;
00885 TInt iDummy;
00886 };
00887
00896 class CEikTextButton : public CEikCommandButtonBase
00897 {
00898 public:
00899
00903 IMPORT_C CEikTextButton();
00904
00908 IMPORT_C ~CEikTextButton();
00909
00916 IMPORT_C void SetTextL(const TDesC& aText,TWhichComponent aWhich=EFirst);
00917
00923 IMPORT_C CEikLabel* Label(TWhichComponent aWhich=EFirst) const;
00924
00925
00926 public:
00927
00935 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00936
00944 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00945
00946
00947 private:
00948 IMPORT_C void* ExtensionInterface( TUid aInterface );
00949
00950 private:
00951 TInt iDummy;
00952 };
00953
00962 class CEikBitmapButton : public CEikCommandButtonBase
00963 {
00964 public:
00965
00969 IMPORT_C CEikBitmapButton();
00970
00974 IMPORT_C ~CEikBitmapButton();
00975
00983 IMPORT_C void SetPictureL(const CFbsBitmap* aMain,const CFbsBitmap* aMask=NULL,TWhichComponent aWhich=EFirst);
00984
00993 IMPORT_C void SetPictureFromFileL(const TDesC& aFilename,TInt aMain,TInt aMask=-1,TWhichComponent aWhich=EFirst);
00994
01001 IMPORT_C CEikImage* Picture(TWhichComponent aWhich=EFirst) const;
01002
01003
01004 public:
01012 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
01013
01021 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
01022
01023 private:
01027 IMPORT_C void* ExtensionInterface( TUid aInterface );
01028
01029 private:
01030 TInt iDummy;
01031 };
01032
01033
01034 #endif