00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __EIKCBA_H__
00021 #define __EIKCBA_H__
00022
00023 #include <eikctgrp.h>
00024 #include <badesca.h>
00025 #include <eikbtgrp.h>
00026 #include <eiksbobs.h>
00027 #include <eiksbfrm.h>
00028
00029 #include <eikimage.h>
00030 #include <akncontrol.h>
00031 #include <aknsitemdata.h>
00032 #include <babitflags.h>
00033
00034 class CEikLabel;
00035 class CEikCbaButton;
00036 class CCoeBrushAndPenContext;
00037 class MEikCommandObserver;
00038 class TCoeColorUse;
00039
00040 class CAknScrollBar;
00041 class TEikScrollBarModel;
00042
00043 class CEikEnhancedCbaButton;
00044 class CEikCommandTable;
00045
00046 class CAknsBasicBackgroundControlContext;
00047 class CAknsLayeredBackgroundControlContext;
00048 class CAknsMaskedLayerBackgroundControlContext;
00049
00050 const TInt KMaxCbaLabelLength = 32;
00051 const TInt KMaxButtonsInCommandTable = 4;
00052
00060 NONSHARABLE_CLASS(CEikCba) :
00061 public CEikControlGroup,
00062 public MEikEnhancedButtonGroup,
00063 public MEikScrollBarObserver
00064 {
00065 public:
00070 DECLARE_TYPE_ID(0x101F4105)
00071
00072
00081 static CEikCba* NewL(
00082 const CEikCba* aPrevious,
00083 MEikCommandObserver* aCommandObserver,
00084 RWindowGroup* aParentWg);
00085
00096 static CEikCba* NewL(
00097 TInt aResourceId,
00098 const CEikCba* aPrevious,
00099 MEikCommandObserver* aCommandObserver,
00100 RWindowGroup* aParentWg);
00101
00111 static CEikCba* NewLC(
00112 const CEikCba* aPrevious,
00113 MEikCommandObserver* aCommandObserver,
00114 RWindowGroup* aParentWg);
00115
00126 static CEikCba* NewLC(
00127 TInt aResourceId,
00128 const CEikCba* aPrevious,
00129 MEikCommandObserver* aCommandObserver,
00130 RWindowGroup* aParentWg);
00131
00135 ~CEikCba();
00136
00137 public:
00144 TInt MaxCommands() const;
00145
00154 void UpdateCbaLabels(TBool aScrollerOn);
00155
00162 TInt MSKEnabledInPlatform() const;
00163
00170 void SetSBFrameObserver(MEikScrollBarObserver* aObserver);
00171
00178 void SetScrollBarModelL(TEikScrollBarModel* aModel);
00179
00186 const CEikCbaScrollBarFrame* ScrollBarFrame() const;
00187
00193 CAknScrollBar* VScrollBarAsControl();
00194
00201 void CreateArrowHeadScrollBarL();
00202
00203 public:
00212 void InsertControlL(TEikGroupControl& aGroupControl, TInt aIndex);
00213
00225 void SetCommandL(
00226 TInt aPosition,
00227 TInt aCommandId,
00228 const TDesC* aText,
00229 const CFbsBitmap* aBitmap,
00230 const CFbsBitmap* aMask);
00231
00243 void SetCommandL(TInt aPosition, TInt aResourceId);
00244
00254 void SetCommandSetL(TInt aResourceId);
00255
00269 void AddCommandL(
00270 TInt aPosition,
00271 TInt aCommandId,
00272 const TDesC* aText,
00273 const CFbsBitmap* aBitmap,
00274 const CFbsBitmap* aMask);
00275
00289 void AddCommandToStackL(
00290 TInt aPosition,
00291 TInt aCommandId,
00292 const TDesC* aText,
00293 const CFbsBitmap* aBitmap,
00294 const CFbsBitmap* aMask);
00295
00306 void AddCommandToStackL(TInt aPosition, TInt aResourceId);
00307
00318 void AddCommandSetToStackL(TInt aResourceId);
00319
00328 void SetDefaultCommand(TInt aCommandId);
00329
00341 TSize CalcMinimumSizeL(TInt aResourceId);
00342
00355 void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
00356
00366 TInt CommandPos(TInt aCommandId) const;
00367
00377 void DimCommand(TInt aCommandId, TBool aDimmed);
00378
00389 TBool IsCommandDimmed(TInt aCommandId) const;
00390
00402 void MakeCommandVisible(TInt aCommandId, TBool aVisible);
00403
00414 TBool IsCommandVisible(TInt aCommandId) const;
00415
00424 void AnimateCommand(TInt aCommandId);
00425
00434 CCoeControl* AsControl();
00435
00444 const CCoeControl* AsControl() const;
00445
00455 void SetBoundingRect(const TRect& aBoundingRect);
00456
00467 void ReduceRect(TRect& aBoundingRect) const;
00468
00477 CCoeControl* GroupControlById(TInt aCommandId);
00478
00488 CCoeControl* GroupControlById(TInt aCommandId) const;
00489
00499 TInt CommandId(TInt aCommandPos) const;
00500
00509 TInt ButtonCount() const;
00510
00518 void RemovePreviousCommand(TInt aPosition);
00519
00530 CEikCommandButton* GroupControlAsButton(TInt aCommandId) const;
00531
00540 TUint ButtonGroupFlags() const;
00541
00549 IMPORT_C void SetButtonGroupFlags(TInt aFlags);
00550
00562 IMPORT_C void SetSkinBackgroundId(const TAknsItemID& aIID);
00563
00571 void SetMSKIconL();
00572
00582 void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver);
00583
00593 void DimCommandByPosition(TInt aPosition, TBool aDimmed);
00594
00604 TBool IsCommandDimmedByPosition(TInt aPosition) const;
00605
00615 void MakeCommandVisibleByPosition(TInt aPosition, TBool aVisible);
00616
00626 TBool IsCommandVisibleByPosition(TInt aPosition) const;
00627
00636 void AnimateCommandByPosition(TInt aPosition);
00637
00646 CCoeControl* GroupControlByPosition(TInt aPosition) const;
00647
00648 public:
00652 virtual void Reserved_MtsmPosition();
00653
00657 virtual void Reserved_MtsmObject();
00658
00659 public:
00668 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00669
00676 TSize MinimumSize();
00677
00685 void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00686
00693 void HandleResourceChange(TInt aType);
00694
00701 void MakeVisible(TBool aVisible);
00702
00709 void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00710
00711 public:
00718 IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
00719
00726 IMPORT_C void OfferCommandListL(const TInt aResourceId);
00727
00735 IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
00736
00744 IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
00745
00746 private:
00750 IMPORT_C void* ExtensionInterface( TUid aInterface );
00751
00752 protected:
00762 virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
00763
00774 TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00775
00782 void Draw(const TRect& aRect) const;
00783
00784 private:
00785 CEikCba(
00786 const CEikCba* aPrevious,
00787 MEikCommandObserver* aCommandObserver,
00788 RWindowGroup* aParentWg);
00789
00790 void BaseConstructL();
00791 void ConstructL(TInt aResourceId);
00792 void ConstructFromResourceL(TResourceReader& aReader);
00793 CEikCbaButton* ButtonById(TInt aCommandId) const;
00794 void CreateScrollBarFrameL();
00795 void InsertScrollBarL();
00796 TEikGroupControl VScrollBarAsGroupControl();
00797 void CheckSkinAndUpdateContext();
00798
00799 TInt AknLayoutFlags() const;
00800 void SizeChangedInControlPane();
00801 void SizeChangedInStaconPane();
00802 void UpdateFonts();
00803
00804 void DoSkinChange();
00805 void DoColorChange();
00806 void DoLayoutChange();
00807
00815 void LayoutControl(CCoeControl* aControl, const TRect& aRect);
00816
00817 void DoSetLayers( const TAknsItemID& aIID );
00818 private:
00819 void SizeChanged();
00820
00821
00822
00823
00824 private:
00825 TUint iCbaFlags;
00826
00828 const CEikCba* iLink;
00829
00830 CCoeBrushAndPenContext* iBrushAndPenContext;
00831 MEikCommandObserver* iCommandObserver;
00832 CEikCbaScrollBarFrame* iSBFrame;
00833 RWindowGroup* iParentWg;
00834
00836 CEikCommandTable* iCommandTable;
00837
00839 TBool iMSKset;
00840
00842 TBool iMSKEnabledInPlatform;
00843
00845 MEikCommandObserver* iMSKCommandObserver;
00846
00847
00848 const CFont* iLabelFont;
00849 const CFont* iStaconLabelFont;
00850 TBool iPopupVisible;
00851 TBitFlags iFlags;
00852
00853
00854 CAknsBasicBackgroundControlContext* iBgContext;
00855 CAknsLayeredBackgroundControlContext* iStaconBgContext;
00856
00857
00858 CAknsMaskedLayerBackgroundControlContext* iMLBgContext;
00859 CAknsMaskedLayerBackgroundControlContext* iStaconBgContextTop;
00860 CAknsMaskedLayerBackgroundControlContext* iStaconBgContextBottom;
00861
00862 TAknsItemID iBgIID;
00864 CPeriodic* iTimer;
00865
00870 TAknsItemID iClockIndicBgIID;
00871 TBool iIsClockIndicBgIIDSet;
00872 };
00873
00881 class CEikCbaButton : public CAknControl
00882 {
00883 public:
00887 struct SButtonOptions
00888 {
00889 TInt iCommandId;
00890 TBool iDimmed;
00891 };
00892 public:
00896 ~CEikCbaButton();
00897
00903 void ConstructL(TGulAlignmentValue aAlignment);
00904 public:
00910 void AddCommandL(const TDesC& aText);
00911
00918 void PushCommandL(TInt aCommandId, const TDesC& aText);
00919
00925 TInt PopCommand();
00926
00932 void RemoveCommand(TInt aCommandId);
00933
00937 void RemovePreviousCommand();
00938
00944 void SwitchToShortTextL(TBool aShortText);
00945
00951 void SetLabelFont(const CFont* aLabelFont);
00952
00956 void TruncateLabelText();
00957
00958 public:
00965 void SetContainerWindowL(const CCoeControl& aContainer);
00966
00973 void ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment);
00974
00981 TSize MinimumSize();
00982
00989 void SetDimmed(TBool aDimmed);
00990
00997 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00998
00999 public:
01005 void SetImage(CEikImage &aImage);
01006
01010 void ReplaceImageByLabel();
01011
01017 inline TBool IsImageOn() const {return iDoImage;};
01018
01022 void ConstructEmptyButtonL();
01023
01024 protected:
01031 TInt IndexFromCommandId(TInt aCommandId);
01032
01038 void UpdateLabelText(TPtrC aLabelText);
01039
01040 private:
01047 TInt CountComponentControls() const;
01048
01056 CCoeControl* ComponentControl(TInt aIndex) const;
01057
01062 void SizeChanged();
01063
01067 IMPORT_C void* ExtensionInterface( TUid aInterface );
01068
01069 public:
01076 TBool PressedDown() const;
01077
01085 void SetPressedDownL( const TBool aPressedDown );
01086
01087 private:
01088 void PrepareImageL();
01089
01090 protected:
01091 TBuf<KMaxCbaLabelLength> iFullLabelText;
01092 TPtrC iLongLabelText;
01093 TPtrC iShortLabelText;
01094 CEikLabel* iLabel;
01095 CDesCArray* iText;
01096 CArrayFix<SButtonOptions>* iButtonOptions;
01097 CEikImage* iImage;
01099 const CFbsBitmap* iMask;
01101 CFbsBitmap* iSfeMask;
01102 TBool iDoImage;
01103 TInt iSpare;
01105 TBool iPressedDown;
01106 };
01107
01114 class CEikEnhancedCbaButton : public CEikCbaButton
01115 {
01116 public:
01120 CEikEnhancedCbaButton();
01121
01125 ~CEikEnhancedCbaButton();
01126
01132 TInt CommandType() const;
01133
01139 void SetCommandType(const TInt aCommandType);
01140
01146 TInt CommandId() const;
01147
01153 void ConstructFromResourceL(TResourceReader& aReader);
01154
01158 void ConstructEmptyButtonL();
01159
01165 TPtrC* LabelText();
01166
01167 private:
01168 TInt iCommandType;
01169 TInt iCommandId;
01170 };
01171
01180 NONSHARABLE_CLASS(CEikCommandTable) : public CBase
01181 {
01182 public:
01188 static CEikCommandTable* NewL();
01189
01195 static CEikCommandTable* NewLC();
01196
01200 ~CEikCommandTable();
01201
01208 TInt AddCommandL(CEikEnhancedCbaButton* aButton);
01209
01216 TBool IsCommandPlaced(const TInt aCommandId) const;
01217
01225 void ReplaceCommandL(const TInt aCommandId, const TInt aResourceId);
01226
01233 CEikEnhancedCbaButton* Command(const TInt aCommandIndex);
01234
01238 void Reset();
01239
01240 private:
01244 CEikCommandTable();
01245
01249 void ConstructL();
01250
01251 private:
01253 TFixedArray<CEikEnhancedCbaButton*, KMaxButtonsInCommandTable> iCommandButtons;
01254
01256 RArray< RArray<TInt> > iPriorities;
01257 };
01258
01259
01260 #endif