williamr@4
|
1 |
/*
|
williamr@4
|
2 |
* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@4
|
3 |
* All rights reserved.
|
williamr@4
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@4
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@4
|
8 |
*
|
williamr@4
|
9 |
* Initial Contributors:
|
williamr@4
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@4
|
11 |
*
|
williamr@4
|
12 |
* Contributors:
|
williamr@4
|
13 |
*
|
williamr@4
|
14 |
* Description: EIKON button group base class definitions.
|
williamr@4
|
15 |
*
|
williamr@4
|
16 |
*/
|
williamr@4
|
17 |
|
williamr@4
|
18 |
|
williamr@4
|
19 |
#ifndef __EIKBTGRP_H__
|
williamr@4
|
20 |
#define __EIKBTGRP_H__
|
williamr@4
|
21 |
|
williamr@4
|
22 |
#include <e32std.h>
|
williamr@4
|
23 |
|
williamr@4
|
24 |
class CCoeControl;
|
williamr@4
|
25 |
class CEikCommandButton;
|
williamr@4
|
26 |
class CFbsBitmap;
|
williamr@4
|
27 |
class MEikCommandObserver;
|
williamr@4
|
28 |
|
williamr@4
|
29 |
/**
|
williamr@4
|
30 |
* Abstract base class for EIKON button group.
|
williamr@4
|
31 |
*
|
williamr@4
|
32 |
* @lib eikcoctl.lib
|
williamr@4
|
33 |
* @since S60 0.9
|
williamr@4
|
34 |
*
|
williamr@4
|
35 |
* @internal
|
williamr@4
|
36 |
*/
|
williamr@4
|
37 |
class MEikButtonGroup
|
williamr@4
|
38 |
{
|
williamr@4
|
39 |
public:
|
williamr@4
|
40 |
/**
|
williamr@4
|
41 |
* Deletes the object.
|
williamr@4
|
42 |
*/
|
williamr@4
|
43 |
void Release();
|
williamr@4
|
44 |
|
williamr@4
|
45 |
/**
|
williamr@4
|
46 |
* Sets a command button's bitmap, text and command ID.
|
williamr@4
|
47 |
*
|
williamr@4
|
48 |
* @param aPosition The position within the button group of the button to change.
|
williamr@4
|
49 |
* @param aCommandId Command ID the button will send.
|
williamr@4
|
50 |
* @param aText The text for the button.
|
williamr@4
|
51 |
* @param aBitmap The bitmap for the button.
|
williamr@4
|
52 |
* @param aMask The mask bitmap for aBitmap.
|
williamr@4
|
53 |
*/
|
williamr@4
|
54 |
virtual void SetCommandL(
|
williamr@4
|
55 |
TInt aPosition,
|
williamr@4
|
56 |
TInt aCommandId,
|
williamr@4
|
57 |
const TDesC* aText,
|
williamr@4
|
58 |
const CFbsBitmap* aBitmap,
|
williamr@4
|
59 |
const CFbsBitmap* aMask) = 0;
|
williamr@4
|
60 |
|
williamr@4
|
61 |
/**
|
williamr@4
|
62 |
* Sets a command button's bitmap, text label and command ID.
|
williamr@4
|
63 |
* The bitmap, mask, text and command ID are all read from resource.
|
williamr@4
|
64 |
*
|
williamr@4
|
65 |
* @param aPosition The position within the button group of the button to change.
|
williamr@4
|
66 |
* @param aResourceId Resource ID specifying the text, bitmaps and command ID.
|
williamr@4
|
67 |
*/
|
williamr@4
|
68 |
virtual void SetCommandL(TInt aPosition,
|
williamr@4
|
69 |
TInt aResourceId) = 0;
|
williamr@4
|
70 |
|
williamr@4
|
71 |
/**
|
williamr@4
|
72 |
* Initialises the group of command buttons from a resource.
|
williamr@4
|
73 |
*
|
williamr@4
|
74 |
* @param aResourceId ID of the resource structure specifying the command buttons.
|
williamr@4
|
75 |
*/
|
williamr@4
|
76 |
virtual void SetCommandSetL(TInt aResourceId) = 0;
|
williamr@4
|
77 |
|
williamr@4
|
78 |
/**
|
williamr@4
|
79 |
* Adds a command button with a command ID and a label containing both a bitmap and text.
|
williamr@4
|
80 |
*
|
williamr@4
|
81 |
* @param aPosition The position in the button group for the new button.
|
williamr@4
|
82 |
* @param aCommandId Command ID for the new button.
|
williamr@4
|
83 |
* @param aText Text for the button.
|
williamr@4
|
84 |
* @param aBitmap Bitmap for the button.
|
williamr@4
|
85 |
* @param aMask Mask bitmap for aBitmap.
|
williamr@4
|
86 |
*/
|
williamr@4
|
87 |
virtual void AddCommandL(
|
williamr@4
|
88 |
TInt aPosition,
|
williamr@4
|
89 |
TInt aCommandId,
|
williamr@4
|
90 |
const TDesC* aText,
|
williamr@4
|
91 |
const CFbsBitmap* aBitmap,
|
williamr@4
|
92 |
const CFbsBitmap* aMask) = 0;
|
williamr@4
|
93 |
|
williamr@4
|
94 |
/**
|
williamr@4
|
95 |
* Pushes a command button with text, bitmap, mask and a command ID onto a
|
williamr@4
|
96 |
* position's button stack.
|
williamr@4
|
97 |
*
|
williamr@4
|
98 |
* @param aPosition The position in the button group at which to add the command button.
|
williamr@4
|
99 |
* @param aCommandId Command ID the button will send.
|
williamr@4
|
100 |
* @param aText Text for the button.
|
williamr@4
|
101 |
* @param aBitmap Bitmap for the button.
|
williamr@4
|
102 |
* @param aMask Mask bitmap for aBitmap.
|
williamr@4
|
103 |
*/
|
williamr@4
|
104 |
virtual void AddCommandToStackL(
|
williamr@4
|
105 |
TInt aPosition,
|
williamr@4
|
106 |
TInt aCommandId,
|
williamr@4
|
107 |
const TDesC* aText,
|
williamr@4
|
108 |
const CFbsBitmap* aBitmap,
|
williamr@4
|
109 |
const CFbsBitmap* aMask) = 0;
|
williamr@4
|
110 |
|
williamr@4
|
111 |
/**
|
williamr@4
|
112 |
* Pushes a command button onto a position's button stack.
|
williamr@4
|
113 |
* The text, bitmap, mask and command ID are all read from resource.
|
williamr@4
|
114 |
*
|
williamr@4
|
115 |
* @param aPosition The position in the button group at which to push the command button.
|
williamr@4
|
116 |
* @param aResourceId ID of a resource specifying the text, bitmaps and command ID.
|
williamr@4
|
117 |
*/
|
williamr@4
|
118 |
virtual void AddCommandToStackL(TInt aPosition,
|
williamr@4
|
119 |
TInt aResourceId) = 0;
|
williamr@4
|
120 |
|
williamr@4
|
121 |
/**
|
williamr@4
|
122 |
* As with SetCommandL() but for a set of buttons, also allows the previous
|
williamr@4
|
123 |
* command button to be retrieved by calling RemoveCommand().
|
williamr@4
|
124 |
*
|
williamr@4
|
125 |
* @param aResourceId Resource describing the set of command buttons.
|
williamr@4
|
126 |
*/
|
williamr@4
|
127 |
virtual void AddCommandSetToStackL(TInt aResourceId) = 0;
|
williamr@4
|
128 |
|
williamr@4
|
129 |
/**
|
williamr@4
|
130 |
* Sets the default command ID for buttons in this button group.
|
williamr@4
|
131 |
*
|
williamr@4
|
132 |
* @param aCommandId Command to issue if no other is specified.
|
williamr@4
|
133 |
*/
|
williamr@4
|
134 |
virtual void SetDefaultCommand(TInt aCommandId) = 0;
|
williamr@4
|
135 |
|
williamr@4
|
136 |
/**
|
williamr@4
|
137 |
* Calculates minimum size required to display the buttons defined in the
|
williamr@4
|
138 |
* specified resource structure.
|
williamr@4
|
139 |
*
|
williamr@4
|
140 |
* @param aResourceId The ID of the resource structure describing the button group.
|
williamr@4
|
141 |
* @return Minimum size required to display the button group defined in the specified
|
williamr@4
|
142 |
* resource structure.
|
williamr@4
|
143 |
*/
|
williamr@4
|
144 |
virtual TSize CalcMinimumSizeL(TInt aResourceId) = 0;
|
williamr@4
|
145 |
|
williamr@4
|
146 |
/**
|
williamr@4
|
147 |
* Removes the command identified by aCommandId, in position aPosition in the
|
williamr@4
|
148 |
* group, from the command stack. Automatically retrieves the previous command
|
williamr@4
|
149 |
* details. Commands are added to the stack by calling AddCommandToStackL.
|
williamr@4
|
150 |
*
|
williamr@4
|
151 |
* @param aPosition The position in the button group from which to remove the
|
williamr@4
|
152 |
* command button.
|
williamr@4
|
153 |
* @param aCommandId Command ID.
|
williamr@4
|
154 |
*/
|
williamr@4
|
155 |
virtual void RemoveCommandFromStack(TInt aPosition,
|
williamr@4
|
156 |
TInt aCommandId) = 0;
|
williamr@4
|
157 |
|
williamr@4
|
158 |
/**
|
williamr@4
|
159 |
* Returns the command position by command id.
|
williamr@4
|
160 |
*
|
williamr@4
|
161 |
* @param aCommandId The button's command id.
|
williamr@4
|
162 |
* @return The command position in the button group.
|
williamr@4
|
163 |
*/
|
williamr@4
|
164 |
virtual TInt CommandPos(TInt aCommandId) const = 0;
|
williamr@4
|
165 |
|
williamr@4
|
166 |
/**
|
williamr@4
|
167 |
* Dims or undims a button without drawing it.
|
williamr@4
|
168 |
*
|
williamr@4
|
169 |
* @param aCommandId Command ID of the button to change.
|
williamr@4
|
170 |
* @param aDimmed ETrue to dim the specified command. EFalse to undim the specified command.
|
williamr@4
|
171 |
*/
|
williamr@4
|
172 |
virtual void DimCommand(TInt aCommandId,
|
williamr@4
|
173 |
TBool aDimmed) = 0;
|
williamr@4
|
174 |
|
williamr@4
|
175 |
/**
|
williamr@4
|
176 |
* Determines whether the button with the specified command ID is dimmed.
|
williamr@4
|
177 |
*
|
williamr@4
|
178 |
* @param aCommandId The command ID.
|
williamr@4
|
179 |
* @return ETrue if the specified command is dimmed. EFalse if the specified command is
|
williamr@4
|
180 |
* not dimmed.
|
williamr@4
|
181 |
*/
|
williamr@4
|
182 |
virtual TBool IsCommandDimmed(TInt aCommandId) const = 0;
|
williamr@4
|
183 |
|
williamr@4
|
184 |
/**
|
williamr@4
|
185 |
* Makes the button with the specified id either visible, or invisible.
|
williamr@4
|
186 |
*
|
williamr@4
|
187 |
* @param aCommandId Specifies the button to alter.
|
williamr@4
|
188 |
|
williamr@4
|
189 |
* @param aVisible ETrue to make the specified button visible. EFalse to make the specified
|
williamr@4
|
190 |
* button invisible.
|
williamr@4
|
191 |
*/
|
williamr@4
|
192 |
virtual void MakeCommandVisible(TInt aCommandId,
|
williamr@4
|
193 |
TBool aVisible) = 0;
|
williamr@4
|
194 |
|
williamr@4
|
195 |
/**
|
williamr@4
|
196 |
* Tests whether the button with the specified command ID is visible.
|
williamr@4
|
197 |
*
|
williamr@4
|
198 |
* @param aCommandId Specifies the button.
|
williamr@4
|
199 |
* @return ETrue if the specified button is visible. EFalse if the specified button is
|
williamr@4
|
200 |
* not visible.
|
williamr@4
|
201 |
*/
|
williamr@4
|
202 |
virtual TBool IsCommandVisible(TInt aCommandId) const = 0;
|
williamr@4
|
203 |
|
williamr@4
|
204 |
/**
|
williamr@4
|
205 |
* Animates the button with the specified id.
|
williamr@4
|
206 |
*
|
williamr@4
|
207 |
* @param aCommandId The button to animate.
|
williamr@4
|
208 |
*/
|
williamr@4
|
209 |
IMPORT_C virtual void AnimateCommand(TInt aCommandId);
|
williamr@4
|
210 |
|
williamr@4
|
211 |
/**
|
williamr@4
|
212 |
* Returns the button group as a control.
|
williamr@4
|
213 |
*
|
williamr@4
|
214 |
* @return The button group as a control.
|
williamr@4
|
215 |
*/
|
williamr@4
|
216 |
virtual CCoeControl* AsControl() = 0;
|
williamr@4
|
217 |
|
williamr@4
|
218 |
/**
|
williamr@4
|
219 |
* Returns the button group as a control.
|
williamr@4
|
220 |
*
|
williamr@4
|
221 |
* @return The button group as a control.
|
williamr@4
|
222 |
*/
|
williamr@4
|
223 |
virtual const CCoeControl* AsControl() const = 0;
|
williamr@4
|
224 |
|
williamr@4
|
225 |
/**
|
williamr@4
|
226 |
* Sets the boundary rectangle for externally-positioned button groups.
|
williamr@4
|
227 |
* For use by EExternal button groups only.
|
williamr@4
|
228 |
*
|
williamr@4
|
229 |
* @param aBoundingRect The boundary rectangle to use. The button group attaches itself
|
williamr@4
|
230 |
* to the inside of this rectangle.
|
williamr@4
|
231 |
*/
|
williamr@4
|
232 |
virtual void SetBoundingRect(const TRect& aBoundingRect) = 0;
|
williamr@4
|
233 |
|
williamr@4
|
234 |
/**
|
williamr@4
|
235 |
* Subtracts the area occupied by the button group from the specified bounding rectangle.
|
williamr@4
|
236 |
* This method should be used in preference to querying the container's area at all times.
|
williamr@4
|
237 |
* For use by EExternal button groups only.
|
williamr@4
|
238 |
*
|
williamr@4
|
239 |
* @param aBoundingRect Rectangle to be modified.
|
williamr@4
|
240 |
*/
|
williamr@4
|
241 |
virtual void ReduceRect(TRect& aBoundingRect) const = 0;
|
williamr@4
|
242 |
|
williamr@4
|
243 |
/**
|
williamr@4
|
244 |
* Returns a group control (a button) as a control.
|
williamr@4
|
245 |
*
|
williamr@4
|
246 |
* @param aCommandId The button's command id.
|
williamr@4
|
247 |
* @return The group control as a control.
|
williamr@4
|
248 |
*/
|
williamr@4
|
249 |
virtual CCoeControl* GroupControlById(TInt aCommandId) const = 0;
|
williamr@4
|
250 |
|
williamr@4
|
251 |
/**
|
williamr@4
|
252 |
* Returns a group control (a button) as a command button.
|
williamr@4
|
253 |
*
|
williamr@4
|
254 |
* @param aCommandId The button's command id.
|
williamr@4
|
255 |
* @return The group control as a command button.
|
williamr@4
|
256 |
*/
|
williamr@4
|
257 |
virtual CEikCommandButton* GroupControlAsButton(TInt aCommandId) const = 0;
|
williamr@4
|
258 |
|
williamr@4
|
259 |
/**
|
williamr@4
|
260 |
* Returns the command id by position.
|
williamr@4
|
261 |
*
|
williamr@4
|
262 |
* @param aCommandPos The command's position.
|
williamr@4
|
263 |
* @return The command id.
|
williamr@4
|
264 |
*/
|
williamr@4
|
265 |
virtual TInt CommandId(TInt aCommandPos) const = 0;
|
williamr@4
|
266 |
|
williamr@4
|
267 |
/**
|
williamr@4
|
268 |
* Gets the total number of buttons currently present in the group.
|
williamr@4
|
269 |
*
|
williamr@4
|
270 |
* @return The number of buttons.
|
williamr@4
|
271 |
*/
|
williamr@4
|
272 |
virtual TInt ButtonCount() const = 0;
|
williamr@4
|
273 |
|
williamr@4
|
274 |
/**
|
williamr@4
|
275 |
* Gets the button group flags.
|
williamr@4
|
276 |
*
|
williamr@4
|
277 |
* @return The button group flags.
|
williamr@4
|
278 |
*/
|
williamr@4
|
279 |
virtual TUint ButtonGroupFlags() const = 0;
|
williamr@4
|
280 |
|
williamr@4
|
281 |
/**
|
williamr@4
|
282 |
* Sets the middle softkey command observer.
|
williamr@4
|
283 |
*
|
williamr@4
|
284 |
* @param aCommandObserver The middle softkey command observer.
|
williamr@4
|
285 |
*/
|
williamr@4
|
286 |
virtual void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver) = 0;
|
williamr@4
|
287 |
|
williamr@4
|
288 |
/**
|
williamr@4
|
289 |
* Dims (but doesn't draw) the button with position aPosition.
|
williamr@4
|
290 |
*
|
williamr@4
|
291 |
* @param aPosition The position for command to be dimmed.
|
williamr@4
|
292 |
* @param aDimmed ETrue for dimming.
|
williamr@4
|
293 |
*/
|
williamr@4
|
294 |
virtual void DimCommandByPosition(TInt aPosition,
|
williamr@4
|
295 |
TBool aDimmed) = 0;
|
williamr@4
|
296 |
|
williamr@4
|
297 |
/**
|
williamr@4
|
298 |
* Returns ETrue if the button with position aPosition is dimmed.
|
williamr@4
|
299 |
*
|
williamr@4
|
300 |
* @param aPosition The position for command to be checked.
|
williamr@4
|
301 |
* @return The state of the button.
|
williamr@4
|
302 |
*/
|
williamr@4
|
303 |
virtual TBool IsCommandDimmedByPosition(TInt aPosition) const = 0;
|
williamr@4
|
304 |
|
williamr@4
|
305 |
/**
|
williamr@4
|
306 |
* Sets the the button with position aPosition to be visible if aVisible is ETrue.
|
williamr@4
|
307 |
*
|
williamr@4
|
308 |
* @param aPosition The position for command to be made visible.
|
williamr@4
|
309 |
* @param aVisible EFalse for making button invisible.
|
williamr@4
|
310 |
*/
|
williamr@4
|
311 |
virtual void MakeCommandVisibleByPosition(TInt aPosition,
|
williamr@4
|
312 |
TBool aVisible) = 0;
|
williamr@4
|
313 |
|
williamr@4
|
314 |
/**
|
williamr@4
|
315 |
* Returns ETrue if the button with position aPosition is visible.
|
williamr@4
|
316 |
*
|
williamr@4
|
317 |
* @param aPosition The position for command to be checked.
|
williamr@4
|
318 |
* @return The state of the button.
|
williamr@4
|
319 |
*/
|
williamr@4
|
320 |
virtual TBool IsCommandVisibleByPosition(TInt aPosition) const = 0;
|
williamr@4
|
321 |
|
williamr@4
|
322 |
/**
|
williamr@4
|
323 |
* Animates the button with position aPosition.
|
williamr@4
|
324 |
*
|
williamr@4
|
325 |
* @param aPosition The position for command to be animated.
|
williamr@4
|
326 |
*/
|
williamr@4
|
327 |
virtual void AnimateCommandByPosition(TInt aPosition) = 0;
|
williamr@4
|
328 |
|
williamr@4
|
329 |
private:
|
williamr@4
|
330 |
IMPORT_C void Reserved_1();
|
williamr@4
|
331 |
};
|
williamr@4
|
332 |
|
williamr@4
|
333 |
|
williamr@4
|
334 |
/**
|
williamr@4
|
335 |
* Extends needed functions for enhanced cba.
|
williamr@4
|
336 |
*
|
williamr@4
|
337 |
* @internal
|
williamr@4
|
338 |
* @since S60 3.0
|
williamr@4
|
339 |
*/
|
williamr@4
|
340 |
class MEikEnhancedButtonGroup : public MEikButtonGroup
|
williamr@4
|
341 |
{
|
williamr@4
|
342 |
public:
|
williamr@4
|
343 |
/**
|
williamr@4
|
344 |
* Used to offer list of commands for softkeys.
|
williamr@4
|
345 |
*
|
williamr@4
|
346 |
* @param aCommandList A list of command ids to be offered for softkeys.
|
williamr@4
|
347 |
*/
|
williamr@4
|
348 |
IMPORT_C virtual void OfferCommandListL(const RArray<TInt>& aCommandList) = 0;
|
williamr@4
|
349 |
|
williamr@4
|
350 |
/**
|
williamr@4
|
351 |
* Used to offer list of commands for softkeys.
|
williamr@4
|
352 |
*
|
williamr@4
|
353 |
* @param aResourceId Id for CBA resource that defines enhanced cba buttons.
|
williamr@4
|
354 |
*/
|
williamr@4
|
355 |
IMPORT_C virtual void OfferCommandListL(const TInt aResourceId) = 0;
|
williamr@4
|
356 |
|
williamr@4
|
357 |
/**
|
williamr@4
|
358 |
* Used to check if a certain command have been approved to the current command set.
|
williamr@4
|
359 |
*
|
williamr@4
|
360 |
* @param aCommandId The id for command which existence should be checked.
|
williamr@4
|
361 |
* @return ETrue if command is in control group, otherwise EFalse.
|
williamr@4
|
362 |
*/
|
williamr@4
|
363 |
IMPORT_C virtual TBool IsCommandInGroup(const TInt aCommandId) const = 0;
|
williamr@4
|
364 |
|
williamr@4
|
365 |
/**
|
williamr@4
|
366 |
* Replace existing command with a new command.
|
williamr@4
|
367 |
*
|
williamr@4
|
368 |
* @param aCommandId Id for command that should be replaced.
|
williamr@4
|
369 |
* @param aResourceId Resource id for new enhanced cba button.
|
williamr@4
|
370 |
*/
|
williamr@4
|
371 |
IMPORT_C virtual void ReplaceCommand(const TInt aCommandId, const TInt aResourceId) = 0;
|
williamr@4
|
372 |
};
|
williamr@4
|
373 |
|
williamr@4
|
374 |
#endif // __EIKBTGRP_H__
|