2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKBTPAN_H__)
20 #define __EIKBTPAN_H__
22 #if !defined(__EIKBTGRP_H__)
26 #include <AknControl.h>
28 #if !defined(__COECOBS_H__)
32 #if !defined(__EIKLBBUT_H__)
38 class MEikCommandObserver;
44 class CEikButtonPanel : public CAknControl, public MCoeControlObserver, public MEikButtonGroup
46 public: // new functions
47 IMPORT_C CEikButtonPanel();
48 IMPORT_C ~CEikButtonPanel();
49 IMPORT_C void ConstructL();
50 IMPORT_C void AddButtonL(CEikLabeledButton* aButton,TInt aId);
51 IMPORT_C void AddButtonL(CEikLabeledButton* aButton,TInt aId, TInt aRow);
52 IMPORT_C void SetHorizontal();
53 IMPORT_C TInt ButtonId(CCoeControl* aControl) const;
54 IMPORT_C CEikCommandButtonBase* ButtonById(TInt aButtonId) const;
55 IMPORT_C CEikLabeledButton* LabeledButtonById(TInt aButtonId) const;
56 IMPORT_C void MakeButtonVisible(TInt aButtonId,TBool aVisible);
57 IMPORT_C CEikCommandButtonBase* ButtonForKey(TInt aChar,TInt& aButtonId) const;
58 IMPORT_C void ResetMinimumSize();
59 IMPORT_C void SetMinButtonWidth(TInt aWidth);
60 IMPORT_C void SetCommandObserver(MEikCommandObserver* aCommandObserver);
61 void UpdateHotKeyL(TInt aCommandId,CEikLabeledButton::TFlags aFlags,TInt aKeyCode);
62 public: // from CCoeControl
63 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
64 IMPORT_C TSize MinimumSize();
65 IMPORT_C void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
66 IMPORT_C void HandleResourceChange(TInt aType); // not available before Release 005u
67 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
68 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
69 protected: // from CCoeControl
70 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
71 public: // from MCoeControlObserver
72 IMPORT_C void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
73 private: // from MEikButtonGroup
74 void SetCommandL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
75 void SetCommandL(TInt aPosition,TInt aResourceId);
76 void SetCommandSetL(TInt aResourceId);
77 void AddCommandL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
78 void AddCommandToStackL(TInt aPosition,TInt aCommandId,const TDesC* aText,const CFbsBitmap* aBitmap,const CFbsBitmap* aMask);
79 void AddCommandToStackL(TInt aPosition,TInt aResourceId);
80 void AddCommandSetToStackL(TInt aResourceId);
81 void SetDefaultCommand(TInt aCommandId);
82 TSize CalcMinimumSizeL(TInt aResourceId);
83 void RemoveCommandFromStack(TInt aPosition,TInt aCommandId);
84 TInt CommandPos(TInt aCommandId) const;
85 void DimCommand(TInt aCommandId,TBool aDimmed);
86 TBool IsCommandDimmed(TInt aCommandId) const;
87 void MakeCommandVisible(TInt aCommandId,TBool aVisible);
88 TBool IsCommandVisible(TInt aCommandId) const;
89 CCoeControl* AsControl();
90 const CCoeControl* AsControl() const;
91 void SetBoundingRect(const TRect& aBoundingRect);
92 void ReduceRect(TRect& aBoundingRect) const;
93 CCoeControl* GroupControlById(TInt aCommandId) const;
94 CEikCommandButton* GroupControlAsButton(TInt aCommandId) const;
95 TInt CommandId(TInt aCommandPos) const;
96 TInt ButtonCount() const;
97 TUint ButtonGroupFlags() const;
99 void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver);
100 void DimCommandByPosition(TInt aPosition,TBool aDimmed);
101 TBool IsCommandDimmedByPosition(TInt aPosition) const;
102 void MakeCommandVisibleByPosition(TInt aPosition,TBool aVisible);
103 TBool IsCommandVisibleByPosition(TInt aPosition) const;
104 void AnimateCommandByPosition(TInt aPosition);
105 private: // from CCoeControl
106 IMPORT_C void ActivateL();
107 IMPORT_C TInt CountComponentControls() const;
108 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
109 IMPORT_C void SizeChanged();
110 IMPORT_C void Reserved_2();
115 IMPORT_C void* ExtensionInterface( TUid aInterface );
116 private: // new functions
117 TInt RelativePosition(TInt aCommandPos, TInt& aGroupIndex) const;
118 TBool ButtonsConsumedKeyL(TInt aCode);
119 void AppendNewLineL();
120 CEikLabeledButton* LabeledButtonByPosition(TInt aPosition, TInt& aGroupIndex) const;
121 CEikLabeledButton* LabeledButtonByPosition(TInt aPosition) const;
122 void AdjustMarginsToFit(TInt8& aLeftBorder, TInt8& aRightBorder, TInt& aGapBetweenButtons);
123 void SetButtonWidths();
125 CArrayPtrFlat<CEikControlGroup>* iControlGroups;
129 TInt iCount; // for efficiency
130 MEikCommandObserver* iCommandObserver;