00001
00002
00003
00004
00005
00006 #if !defined(__EIKBTPAN_H__)
00007 #define __EIKBTPAN_H__
00008
00009 #if !defined(__EIKBTGRP_H__)
00010 #include <eikbtgrp.h>
00011 #endif
00012
00013 #include <AknControl.h>
00014
00015 #if !defined(__COECOBS_H__)
00016 #include <coecobs.h>
00017 #endif
00018
00019 #if !defined(__EIKLBBUT_H__)
00020 #include <eiklbbut.h>
00021 #endif
00022
00023 #include <eikctgrp.h>
00024
00025 class MEikCommandObserver;
00026
00031 class CEikButtonPanel : public CAknControl, public MCoeControlObserver, public MEikButtonGroup
00032 {
00033 public:
00034 IMPORT_C CEikButtonPanel();
00035 IMPORT_C ~CEikButtonPanel();
00036 IMPORT_C void ConstructL();
00037 IMPORT_C void AddButtonL(CEikLabeledButton* aButton,TInt aId);
00038 IMPORT_C void AddButtonL(CEikLabeledButton* aButton,TInt aId, TInt aRow);
00039 IMPORT_C void SetHorizontal();
00040 IMPORT_C TInt ButtonId(CCoeControl* aControl) const;
00041 IMPORT_C CEikCommandButtonBase* ButtonById(TInt aButtonId) const;
00042 IMPORT_C CEikLabeledButton* LabeledButtonById(TInt aButtonId) const;
00043 IMPORT_C void MakeButtonVisible(TInt aButtonId,TBool aVisible);
00044 IMPORT_C CEikCommandButtonBase* ButtonForKey(TInt aChar,TInt& aButtonId) const;
00045 IMPORT_C void ResetMinimumSize();
00046 IMPORT_C void SetMinButtonWidth(TInt aWidth);
00047 IMPORT_C void SetCommandObserver(MEikCommandObserver* aCommandObserver);
00048 void UpdateHotKeyL(TInt aCommandId,CEikLabeledButton::TFlags aFlags,TInt aKeyCode);
00049 public:
00050 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00051 IMPORT_C TSize MinimumSize();
00052 IMPORT_C void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const;
00053 IMPORT_C void HandleResourceChange(TInt aType);
00054 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00055 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00056 protected:
00057 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
00058 public:
00059 IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
00060 private:
00061 void SetCommandL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
00062 void SetCommandL(TInt aPosition,TInt aResourceId);
00063 void SetCommandSetL(TInt aResourceId);
00064 void AddCommandL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
00065 void AddCommandToStackL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
00066 void AddCommandToStackL(TInt aPosition,TInt aResourceId);
00067 void AddCommandSetToStackL(TInt aResourceId);
00068 void SetDefaultCommand(TInt aCommandId);
00069 TSize CalcMinimumSizeL(TInt aResourceId);
00070 void RemoveCommandFromStack(TInt aPosition,TInt aCommandId);
00071 TInt CommandPos(TInt aCommandId) const;
00072 void DimCommand(TInt aCommandId,TBool aDimmed);
00073 TBool IsCommandDimmed(TInt aCommandId) const;
00074 void MakeCommandVisible(TInt aCommandId,TBool aVisible);
00075 TBool IsCommandVisible(TInt aCommandId) const;
00076 CCoeControl* AsControl();
00077 const CCoeControl* AsControl() const;
00078 void SetBoundingRect(const TRect& aBoundingRect);
00079 void ReduceRect(TRect& aBoundingRect) const;
00080 CCoeControl* GroupControlById(TInt aCommandId) const;
00081 CEikCommandButton* GroupControlAsButton(TInt aCommandId) const;
00082 TInt CommandId(TInt aCommandPos) const;
00083 TInt ButtonCount() const;
00084 TUint ButtonGroupFlags() const;
00085
00086 void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver);
00087 void DimCommandByPosition(TInt aPosition,TBool aDimmed);
00088 TBool IsCommandDimmedByPosition(TInt aPosition) const;
00089 void MakeCommandVisibleByPosition(TInt aPosition,TBool aVisible);
00090 TBool IsCommandVisibleByPosition(TInt aPosition) const;
00091 void AnimateCommandByPosition(TInt aPosition);
00092 private:
00093 IMPORT_C void ActivateL();
00094 IMPORT_C TInt CountComponentControls() const;
00095 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
00096 IMPORT_C void SizeChanged();
00097 IMPORT_C void Reserved_2();
00098 private:
00102 IMPORT_C void* ExtensionInterface( TUid aInterface );
00103 private:
00104 TInt RelativePosition(TInt aCommandPos, TInt& aGroupIndex) const;
00105 TBool ButtonsConsumedKeyL(TInt aCode);
00106 void AppendNewLineL();
00107 CEikLabeledButton* LabeledButtonByPosition(TInt aPosition, TInt& aGroupIndex) const;
00108 CEikLabeledButton* LabeledButtonByPosition(TInt aPosition) const;
00109 void AdjustMarginsToFit(TInt8& aLeftBorder, TInt8& aRightBorder, TInt& aGapBetweenButtons);
00110 void SetButtonWidths();
00111 private:
00112 CArrayPtrFlat<CEikControlGroup>* iControlGroups;
00113 TSize iMinSize;
00114 TInt iButWidth;
00115 TInt iMinButWidth;
00116 TInt iCount;
00117 MEikCommandObserver* iCommandObserver;
00118 TInt iSpare;
00119 };
00120
00121 #endif