2 * Copyright (c) 2002-2007 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.
14 * Description: EIKON button group base class definitions.
19 #ifndef __EIKBTGRP_H__
20 #define __EIKBTGRP_H__
25 class CEikCommandButton;
27 class MEikCommandObserver;
30 * Abstract base class for EIKON button group.
46 * Sets a command button's bitmap, text and command ID.
48 * @param aPosition The position within the button group of the button to change.
49 * @param aCommandId Command ID the button will send.
50 * @param aText The text for the button.
51 * @param aBitmap The bitmap for the button.
52 * @param aMask The mask bitmap for aBitmap.
54 virtual void SetCommandL(
58 const CFbsBitmap* aBitmap,
59 const CFbsBitmap* aMask) = 0;
62 * Sets a command button's bitmap, text label and command ID.
63 * The bitmap, mask, text and command ID are all read from resource.
65 * @param aPosition The position within the button group of the button to change.
66 * @param aResourceId Resource ID specifying the text, bitmaps and command ID.
68 virtual void SetCommandL(TInt aPosition,
69 TInt aResourceId) = 0;
72 * Initialises the group of command buttons from a resource.
74 * @param aResourceId ID of the resource structure specifying the command buttons.
76 virtual void SetCommandSetL(TInt aResourceId) = 0;
79 * Adds a command button with a command ID and a label containing both a bitmap and text.
81 * @param aPosition The position in the button group for the new button.
82 * @param aCommandId Command ID for the new button.
83 * @param aText Text for the button.
84 * @param aBitmap Bitmap for the button.
85 * @param aMask Mask bitmap for aBitmap.
87 virtual void AddCommandL(
91 const CFbsBitmap* aBitmap,
92 const CFbsBitmap* aMask) = 0;
95 * Pushes a command button with text, bitmap, mask and a command ID onto a
96 * position's button stack.
98 * @param aPosition The position in the button group at which to add the command button.
99 * @param aCommandId Command ID the button will send.
100 * @param aText Text for the button.
101 * @param aBitmap Bitmap for the button.
102 * @param aMask Mask bitmap for aBitmap.
104 virtual void AddCommandToStackL(
108 const CFbsBitmap* aBitmap,
109 const CFbsBitmap* aMask) = 0;
112 * Pushes a command button onto a position's button stack.
113 * The text, bitmap, mask and command ID are all read from resource.
115 * @param aPosition The position in the button group at which to push the command button.
116 * @param aResourceId ID of a resource specifying the text, bitmaps and command ID.
118 virtual void AddCommandToStackL(TInt aPosition,
119 TInt aResourceId) = 0;
122 * As with SetCommandL() but for a set of buttons, also allows the previous
123 * command button to be retrieved by calling RemoveCommand().
125 * @param aResourceId Resource describing the set of command buttons.
127 virtual void AddCommandSetToStackL(TInt aResourceId) = 0;
130 * Sets the default command ID for buttons in this button group.
132 * @param aCommandId Command to issue if no other is specified.
134 virtual void SetDefaultCommand(TInt aCommandId) = 0;
137 * Calculates minimum size required to display the buttons defined in the
138 * specified resource structure.
140 * @param aResourceId The ID of the resource structure describing the button group.
141 * @return Minimum size required to display the button group defined in the specified
142 * resource structure.
144 virtual TSize CalcMinimumSizeL(TInt aResourceId) = 0;
147 * Removes the command identified by aCommandId, in position aPosition in the
148 * group, from the command stack. Automatically retrieves the previous command
149 * details. Commands are added to the stack by calling AddCommandToStackL.
151 * @param aPosition The position in the button group from which to remove the
153 * @param aCommandId Command ID.
155 virtual void RemoveCommandFromStack(TInt aPosition,
156 TInt aCommandId) = 0;
159 * Returns the command position by command id.
161 * @param aCommandId The button's command id.
162 * @return The command position in the button group.
164 virtual TInt CommandPos(TInt aCommandId) const = 0;
167 * Dims or undims a button without drawing it.
169 * @param aCommandId Command ID of the button to change.
170 * @param aDimmed ETrue to dim the specified command. EFalse to undim the specified command.
172 virtual void DimCommand(TInt aCommandId,
176 * Determines whether the button with the specified command ID is dimmed.
178 * @param aCommandId The command ID.
179 * @return ETrue if the specified command is dimmed. EFalse if the specified command is
182 virtual TBool IsCommandDimmed(TInt aCommandId) const = 0;
185 * Makes the button with the specified id either visible, or invisible.
187 * @param aCommandId Specifies the button to alter.
189 * @param aVisible ETrue to make the specified button visible. EFalse to make the specified
192 virtual void MakeCommandVisible(TInt aCommandId,
196 * Tests whether the button with the specified command ID is visible.
198 * @param aCommandId Specifies the button.
199 * @return ETrue if the specified button is visible. EFalse if the specified button is
202 virtual TBool IsCommandVisible(TInt aCommandId) const = 0;
205 * Animates the button with the specified id.
207 * @param aCommandId The button to animate.
209 IMPORT_C virtual void AnimateCommand(TInt aCommandId);
212 * Returns the button group as a control.
214 * @return The button group as a control.
216 virtual CCoeControl* AsControl() = 0;
219 * Returns the button group as a control.
221 * @return The button group as a control.
223 virtual const CCoeControl* AsControl() const = 0;
226 * Sets the boundary rectangle for externally-positioned button groups.
227 * For use by EExternal button groups only.
229 * @param aBoundingRect The boundary rectangle to use. The button group attaches itself
230 * to the inside of this rectangle.
232 virtual void SetBoundingRect(const TRect& aBoundingRect) = 0;
235 * Subtracts the area occupied by the button group from the specified bounding rectangle.
236 * This method should be used in preference to querying the container's area at all times.
237 * For use by EExternal button groups only.
239 * @param aBoundingRect Rectangle to be modified.
241 virtual void ReduceRect(TRect& aBoundingRect) const = 0;
244 * Returns a group control (a button) as a control.
246 * @param aCommandId The button's command id.
247 * @return The group control as a control.
249 virtual CCoeControl* GroupControlById(TInt aCommandId) const = 0;
252 * Returns a group control (a button) as a command button.
254 * @param aCommandId The button's command id.
255 * @return The group control as a command button.
257 virtual CEikCommandButton* GroupControlAsButton(TInt aCommandId) const = 0;
260 * Returns the command id by position.
262 * @param aCommandPos The command's position.
263 * @return The command id.
265 virtual TInt CommandId(TInt aCommandPos) const = 0;
268 * Gets the total number of buttons currently present in the group.
270 * @return The number of buttons.
272 virtual TInt ButtonCount() const = 0;
275 * Gets the button group flags.
277 * @return The button group flags.
279 virtual TUint ButtonGroupFlags() const = 0;
282 * Sets the middle softkey command observer.
284 * @param aCommandObserver The middle softkey command observer.
286 virtual void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver) = 0;
289 * Dims (but doesn't draw) the button with position aPosition.
291 * @param aPosition The position for command to be dimmed.
292 * @param aDimmed ETrue for dimming.
294 virtual void DimCommandByPosition(TInt aPosition,
298 * Returns ETrue if the button with position aPosition is dimmed.
300 * @param aPosition The position for command to be checked.
301 * @return The state of the button.
303 virtual TBool IsCommandDimmedByPosition(TInt aPosition) const = 0;
306 * Sets the the button with position aPosition to be visible if aVisible is ETrue.
308 * @param aPosition The position for command to be made visible.
309 * @param aVisible EFalse for making button invisible.
311 virtual void MakeCommandVisibleByPosition(TInt aPosition,
315 * Returns ETrue if the button with position aPosition is visible.
317 * @param aPosition The position for command to be checked.
318 * @return The state of the button.
320 virtual TBool IsCommandVisibleByPosition(TInt aPosition) const = 0;
323 * Animates the button with position aPosition.
325 * @param aPosition The position for command to be animated.
327 virtual void AnimateCommandByPosition(TInt aPosition) = 0;
330 IMPORT_C void Reserved_1();
335 * Extends needed functions for enhanced cba.
340 class MEikEnhancedButtonGroup : public MEikButtonGroup
344 * Used to offer list of commands for softkeys.
346 * @param aCommandList A list of command ids to be offered for softkeys.
348 IMPORT_C virtual void OfferCommandListL(const RArray<TInt>& aCommandList) = 0;
351 * Used to offer list of commands for softkeys.
353 * @param aResourceId Id for CBA resource that defines enhanced cba buttons.
355 IMPORT_C virtual void OfferCommandListL(const TInt aResourceId) = 0;
358 * Used to check if a certain command have been approved to the current command set.
360 * @param aCommandId The id for command which existence should be checked.
361 * @return ETrue if command is in control group, otherwise EFalse.
363 IMPORT_C virtual TBool IsCommandInGroup(const TInt aCommandId) const = 0;
366 * Replace existing command with a new command.
368 * @param aCommandId Id for command that should be replaced.
369 * @param aResourceId Resource id for new enhanced cba button.
371 IMPORT_C virtual void ReplaceCommand(const TInt aCommandId, const TInt aResourceId) = 0;
374 #endif // __EIKBTGRP_H__