|
1 /* |
|
2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: EIKON control button array and cba button class definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __EIKCBA_H__ |
|
20 #define __EIKCBA_H__ |
|
21 |
|
22 #include <eikctgrp.h> |
|
23 #include <badesca.h> |
|
24 #include <eikbtgrp.h> |
|
25 #include <eiksbobs.h> |
|
26 #include <eiksbfrm.h> |
|
27 |
|
28 #include <eikimage.h> |
|
29 #include <AknControl.h> |
|
30 #include <AknsItemData.h> // TAknsItemID |
|
31 #include <babitflags.h> // TBitFlags |
|
32 |
|
33 class CEikLabel; |
|
34 class CEikCbaButton; |
|
35 class CCoeBrushAndPenContext; |
|
36 class MEikCommandObserver; |
|
37 class TCoeColorUse; |
|
38 |
|
39 class CAknScrollBar; |
|
40 class TEikScrollBarModel; |
|
41 |
|
42 class CEikEnhancedCbaButton; |
|
43 class CEikCommandTable; |
|
44 |
|
45 class CAknsBasicBackgroundControlContext; |
|
46 class CAknsLayeredBackgroundControlContext; |
|
47 class CAknsMaskedLayerBackgroundControlContext; |
|
48 class CEikCbaExtension; |
|
49 |
|
50 const TInt KMaxCbaLabelLength = 32; |
|
51 const TInt KMaxButtonsInCommandTable = 4; |
|
52 |
|
53 /** |
|
54 * Defines a Control Button Array control, used in Avkon to define the softkeys in the |
|
55 * control pane. |
|
56 * |
|
57 * @lib eikcoctl.lib |
|
58 * @since S60 0.9 |
|
59 */ |
|
60 NONSHARABLE_CLASS(CEikCba) : |
|
61 public CEikControlGroup, |
|
62 public MEikEnhancedButtonGroup, |
|
63 public MEikScrollBarObserver, |
|
64 public MCoeControlObserver |
|
65 { |
|
66 public: |
|
67 /** |
|
68 * Declares an object type for a class, in order to allow the object |
|
69 * provider mechanism to locate and provide objects from the class. |
|
70 */ |
|
71 DECLARE_TYPE_ID(0x101F4105) |
|
72 |
|
73 /** |
|
74 * Creates a new control button array. |
|
75 * |
|
76 * @internal |
|
77 * @param aPrevious Previous Cba, used in MinimumSize(). |
|
78 * @param aCommandObserver Command observer for softkey events. |
|
79 * @param aParentWg The parent window group. |
|
80 * @return Control button array object. |
|
81 */ |
|
82 static CEikCba* NewL( |
|
83 const CEikCba* aPrevious, |
|
84 MEikCommandObserver* aCommandObserver, |
|
85 RWindowGroup* aParentWg); |
|
86 |
|
87 /** |
|
88 * Creates a new control button array. |
|
89 * |
|
90 * @internal |
|
91 * @param aResourceId A resource describing the Cba. |
|
92 * @param aPrevious Previous Cba, used in MinimumSize(). |
|
93 * @param aCommandObserver Command observer for softkey events. |
|
94 * @param aParentWg The parent window group. |
|
95 * @return Control button array object. |
|
96 */ |
|
97 static CEikCba* NewL( |
|
98 TInt aResourceId, |
|
99 const CEikCba* aPrevious, |
|
100 MEikCommandObserver* aCommandObserver, |
|
101 RWindowGroup* aParentWg); |
|
102 |
|
103 /** |
|
104 * Creates a new control button array. |
|
105 * |
|
106 * @internal |
|
107 * @param aPrevious Previous Cba, used in MinimumSize(). |
|
108 * @param aCommandObserver Command observer for softkey events. |
|
109 * @param aParentWg The parent window group. |
|
110 * @return Control button array object. |
|
111 */ |
|
112 static CEikCba* NewLC( |
|
113 const CEikCba* aPrevious, |
|
114 MEikCommandObserver* aCommandObserver, |
|
115 RWindowGroup* aParentWg); |
|
116 |
|
117 /** |
|
118 * Creates a new control button array |
|
119 * |
|
120 * @since S60 5.2 |
|
121 * @internal |
|
122 * @param aPrevious Previous Cba, used in MinimumSize() |
|
123 * @param aCommandObserver Command observer for softkey events |
|
124 * @param aParentWg The parent window group |
|
125 * @param aFlags CEikButtonGroupContainer::EIsEmbedded if CBA is embedded |
|
126 * inside another control (popup/dialog/setting page) |
|
127 * @return Control button array object |
|
128 */ |
|
129 static CEikCba* NewLC( |
|
130 const CEikCba* aPrevious, |
|
131 MEikCommandObserver* aCommandObserver, |
|
132 RWindowGroup* aParentWg, TUint aFlags ); |
|
133 |
|
134 /** |
|
135 * Creates a new control button array. |
|
136 * |
|
137 * @internal |
|
138 * @param aResourceId A resource describing the Cba. |
|
139 * @param aPrevious Previous Cba, used in MinimumSize(). |
|
140 * @param aCommandObserver Command observer for softkey events. |
|
141 * @param aParentWg The parent window group. |
|
142 * @return Control button array object. |
|
143 */ |
|
144 static CEikCba* NewLC( |
|
145 TInt aResourceId, |
|
146 const CEikCba* aPrevious, |
|
147 MEikCommandObserver* aCommandObserver, |
|
148 RWindowGroup* aParentWg); |
|
149 |
|
150 /** |
|
151 * Creates a new control button array |
|
152 * |
|
153 * @since S60 5.2 |
|
154 * @internal |
|
155 * @param aResourceId A resource describing the Cba |
|
156 * @param aPrevious Previous Cba, used in MinimumSize() |
|
157 * @param aCommandObserver Command observer for softkey events |
|
158 * @param aParentWg The parent window group |
|
159 * @param aFlags CEikButtonGroupContainer::EIsEmbedded if CBA is embedded |
|
160 * inside another control (popup/dialog/setting page) |
|
161 * @return Control button array object |
|
162 */ |
|
163 static CEikCba* NewLC( |
|
164 TInt aResourceId, |
|
165 const CEikCba* aPrevious, |
|
166 MEikCommandObserver* aCommandObserver, |
|
167 RWindowGroup* aParentWg, TUint aFlags ); |
|
168 |
|
169 /** |
|
170 * Destructor. |
|
171 */ |
|
172 ~CEikCba(); |
|
173 |
|
174 public: // new methods |
|
175 /** |
|
176 * Gets the maximum number of buttons that can be supported by the device. |
|
177 * |
|
178 * @internal |
|
179 * @return The number of command buttons supported. |
|
180 */ |
|
181 TInt MaxCommands() const; |
|
182 |
|
183 /** |
|
184 * Updates the cba labels. |
|
185 * |
|
186 * @internal |
|
187 * @param aScrollerOn If this is set, the short labels are used instead |
|
188 * of the long ones. To be used if there is an (old style) |
|
189 * scroller between the softkeys. |
|
190 */ |
|
191 void UpdateCbaLabels(TBool aScrollerOn); |
|
192 |
|
193 /** |
|
194 * For checking whether the middle softkey is supported in the platform. |
|
195 * |
|
196 * @internal |
|
197 * @return ETrue if the middle softkey is supported in the plaftorm. |
|
198 */ |
|
199 TInt MSKEnabledInPlatform() const; |
|
200 |
|
201 /** |
|
202 * Sets the scroll bar frame observer. |
|
203 * |
|
204 * @internal |
|
205 * @param aObserver The scroll bar frame observer. |
|
206 */ |
|
207 void SetSBFrameObserver(MEikScrollBarObserver* aObserver); |
|
208 |
|
209 /** |
|
210 * Sets the scroll bar model. |
|
211 * |
|
212 * @internal |
|
213 * @param aModel The scroll bar model. |
|
214 */ |
|
215 void SetScrollBarModelL(TEikScrollBarModel* aModel); |
|
216 |
|
217 /** |
|
218 * Returns the scroll bar frame. |
|
219 * |
|
220 * @internal |
|
221 * @return The scroll bar frame. |
|
222 */ |
|
223 const CEikCbaScrollBarFrame* ScrollBarFrame() const; |
|
224 |
|
225 /** |
|
226 * Returns the vertical scroll bar as a control. |
|
227 * |
|
228 * @internal The vertical scroll bar as a control |
|
229 */ |
|
230 CAknScrollBar* VScrollBarAsControl(); |
|
231 |
|
232 /** |
|
233 * Replaces empty scroll bar with actual arrow head scroll bar. |
|
234 * |
|
235 * @internal |
|
236 * @since S60 3.0 |
|
237 */ |
|
238 void CreateArrowHeadScrollBarL(); |
|
239 |
|
240 /** |
|
241 * For external set the MSK icon |
|
242 * Returns ETrue if option is ok, EFalse is not. |
|
243 * @param aId icon bitmap IID |
|
244 * @param aBmpFile file path. |
|
245 * @param aBmp Bitmap ID. |
|
246 * @param aBmpM Bitmap mask ID. |
|
247 * @param aEnable ETrue for set icon, EFalse for use default icon. |
|
248 */ |
|
249 IMPORT_C TBool UpdateMSKIconL( |
|
250 const TAknsItemID& aId, |
|
251 const TDesC& aBmpFile, |
|
252 const TInt32 aBmp, |
|
253 const TInt32 aBmpM, |
|
254 TBool aEnable); |
|
255 |
|
256 /** |
|
257 * Enables or disables item specific softkey. If enabled then SK1's |
|
258 * visibility is determined by the screen content. If there's a list or |
|
259 * grid with visible highlight (i.e. highlight is brought visible via |
|
260 * hardware keys) on the display or SK1's associated command is |
|
261 * @c EAknSoftkeyOptions then SK1 is visible, otherwise it's hidden. This |
|
262 * method has no effect if the the application isn't single click enabled. |
|
263 * Item specific softkey is enabled by default. |
|
264 * |
|
265 * @since S60 5.2 |
|
266 * |
|
267 * @param aEnable ETrue to enable item specific softkey, EFalse to disable. |
|
268 */ |
|
269 IMPORT_C void EnableItemSpecificSoftkey( TBool aEnable ); |
|
270 |
|
271 public: |
|
272 /** |
|
273 * From CEikControlGroup. |
|
274 * Adds a wrapped control to the control group array at the given index position. |
|
275 * Overridden to prevent setting container window. |
|
276 * |
|
277 * @param aGroupControl The control to add to the group. |
|
278 * @param aIndex The index for the added control. |
|
279 */ |
|
280 void InsertControlL(TEikGroupControl& aGroupControl, TInt aIndex); |
|
281 |
|
282 /** |
|
283 * From MEikButtonGroup. |
|
284 * Sets a command button's text and command ID. Note that this implementation does |
|
285 * not support bitmap and mask. |
|
286 * |
|
287 * @param aPosition The position within the button group of the button to change. |
|
288 * @param aCommandId Command ID the button will send. |
|
289 * @param aText The text for the button. |
|
290 * @param aBitmap Not used. |
|
291 * @param aMask Not used. |
|
292 */ |
|
293 void SetCommandL( |
|
294 TInt aPosition, |
|
295 TInt aCommandId, |
|
296 const TDesC* aText, |
|
297 const CFbsBitmap* aBitmap, |
|
298 const CFbsBitmap* aMask); |
|
299 |
|
300 /** |
|
301 * From MEikButtonGroup. |
|
302 * Sets a command button's text label and command ID. The text and command ID are all |
|
303 * read from resource. Note that this implementation does not support bitmap and mask. |
|
304 * |
|
305 * @internal |
|
306 * |
|
307 * @param aPosition The position within the button group of the button to change. |
|
308 * @param aResourceId Resource ID specifying the text and command ID. |
|
309 * |
|
310 */ |
|
311 void SetCommandL(TInt aPosition, TInt aResourceId); |
|
312 |
|
313 /** |
|
314 * From MEikButtonGroup. |
|
315 * Initialises the group of command buttons from a resource. |
|
316 * Note that this implementation does not support bitmap and mask. |
|
317 * |
|
318 * @internal |
|
319 * |
|
320 * @param aResourceId ID of the resource structure specifying the command buttons. |
|
321 */ |
|
322 void SetCommandSetL(TInt aResourceId); |
|
323 |
|
324 /** |
|
325 * From MEikButtonGroup. |
|
326 * Not supported. |
|
327 * |
|
328 * @internal |
|
329 * |
|
330 * @param aPosition Not used. |
|
331 * @param aCommandId Not used. |
|
332 * @param aText Not used. |
|
333 * @param aBitmap Not used. |
|
334 * @param aMask Not used. |
|
335 * @leave KErrNotSupported If called. |
|
336 */ |
|
337 void AddCommandL( |
|
338 TInt aPosition, |
|
339 TInt aCommandId, |
|
340 const TDesC* aText, |
|
341 const CFbsBitmap* aBitmap, |
|
342 const CFbsBitmap* aMask); |
|
343 |
|
344 /** |
|
345 * From MEikButtonGroup. |
|
346 * Pushes a command button with text and a command ID onto a position's button stack. |
|
347 * Note that this implementation does not support bitmap and mask. |
|
348 * |
|
349 * @internal |
|
350 * |
|
351 * @param aPosition The position in the button group at which to add the command button. |
|
352 * @param aCommandId Command ID the button will send. |
|
353 * @param aText Text for the button. |
|
354 * @param aBitmap Not used. |
|
355 * @param aMask Not used. |
|
356 */ |
|
357 void AddCommandToStackL( |
|
358 TInt aPosition, |
|
359 TInt aCommandId, |
|
360 const TDesC* aText, |
|
361 const CFbsBitmap* aBitmap, |
|
362 const CFbsBitmap* aMask); |
|
363 |
|
364 /** |
|
365 * From MEikButtonGroup. |
|
366 * Pushes a command button onto a position's button stack. The text and command ID are all |
|
367 * read from resource. Note that this implementation does not support bitmap and mask. |
|
368 * |
|
369 * @internal |
|
370 * |
|
371 * @param aPosition The position in the button group at which to push the command button. |
|
372 * @param aResourceId ID of a resource specifying the text and command ID. |
|
373 */ |
|
374 void AddCommandToStackL(TInt aPosition, TInt aResourceId); |
|
375 |
|
376 /** |
|
377 * From MEikButtonGroup. |
|
378 * As with SetCommandL() but for a set of buttons, also allows the previous command button |
|
379 * to be retrieved by calling RemoveCommand(). Note that this implementation does not |
|
380 * support bitmap and mask. |
|
381 * |
|
382 * @internal |
|
383 * |
|
384 * @param aResourceId Resource describing the set of command buttons. |
|
385 */ |
|
386 void AddCommandSetToStackL(TInt aResourceId); |
|
387 |
|
388 /** |
|
389 * From MEikButtonGroup. |
|
390 * Not supported. |
|
391 * |
|
392 * @internal |
|
393 * |
|
394 * @param aCommandId Not used. |
|
395 */ |
|
396 void SetDefaultCommand(TInt aCommandId); |
|
397 |
|
398 /** |
|
399 * From MEikButtonGroup. |
|
400 * Calculates minimum size required to display the buttons defined in the |
|
401 * specified resource structure. |
|
402 * |
|
403 * @internal |
|
404 * |
|
405 * @param aResourceId The ID of the resource structure describing the button group. |
|
406 * @return Minimum size required to display the button group defined in the specified |
|
407 * resource structure. |
|
408 */ |
|
409 TSize CalcMinimumSizeL(TInt aResourceId); |
|
410 |
|
411 /** |
|
412 * From MEikButtonGroup. |
|
413 * Removes the command identified by aCommandId, in position aPosition in the |
|
414 * group, from the command stack. Automatically retrieves the previous command |
|
415 * details. Commands are added to the stack by calling AddCommandToStackL. |
|
416 * |
|
417 * @internal |
|
418 * |
|
419 * @param aPosition The position in the button group from which to remove the |
|
420 * command button. |
|
421 * @param aCommandId Command ID. |
|
422 */ |
|
423 void RemoveCommandFromStack(TInt aPosition, TInt aCommandId); |
|
424 |
|
425 /** |
|
426 * From MEikButtonGroup. |
|
427 * Returns the command position by command id. |
|
428 * |
|
429 * @internal |
|
430 * |
|
431 * @param aCommandId The button's command id. |
|
432 * @return The command position in the button group. |
|
433 */ |
|
434 TInt CommandPos(TInt aCommandId) const; |
|
435 |
|
436 /** |
|
437 * From MEikButtonGroup. |
|
438 * Dims or undims a button without drawing it. |
|
439 * |
|
440 * @internal |
|
441 * |
|
442 * @param aCommandId Command ID of the button to change. |
|
443 * @param aDimmed ETrue to dim the specified command. EFalse to undim the specified command. |
|
444 */ |
|
445 void DimCommand(TInt aCommandId, TBool aDimmed); |
|
446 |
|
447 /** |
|
448 * From MEikButtonGroup. |
|
449 * Determines whether the button with the specified command ID is dimmed. |
|
450 * |
|
451 * @internal |
|
452 * |
|
453 * @param aCommandId The command ID. |
|
454 * @return ETrue if the specified command is dimmed. EFalse if the specified command is |
|
455 * not dimmed. |
|
456 */ |
|
457 TBool IsCommandDimmed(TInt aCommandId) const; |
|
458 |
|
459 /** |
|
460 * From MEikButtonGroup. |
|
461 * Makes the button with the specified id either visible, or invisible. |
|
462 * |
|
463 * @internal |
|
464 * |
|
465 * @param aCommandId Specifies the button to alter. |
|
466 |
|
467 * @param aVisible ETrue to make the specified button visible. EFalse to make the specified |
|
468 * button invisible. |
|
469 */ |
|
470 void MakeCommandVisible(TInt aCommandId, TBool aVisible); |
|
471 |
|
472 /** |
|
473 * From MEikButtonGroup. |
|
474 * Tests whether the button with the specified command ID is visible. |
|
475 * |
|
476 * @internal |
|
477 * |
|
478 * @param aCommandId Specifies the button. |
|
479 * @return ETrue if the specified button is visible. EFalse if the specified button is |
|
480 * not visible. |
|
481 */ |
|
482 TBool IsCommandVisible(TInt aCommandId) const; |
|
483 |
|
484 /** |
|
485 * From MEikButtonGroup. |
|
486 * Not supported. |
|
487 * |
|
488 * @internal |
|
489 * |
|
490 * @param aCommandId Not used. |
|
491 */ |
|
492 void AnimateCommand(TInt aCommandId); |
|
493 |
|
494 /** |
|
495 * From MEikButtonGroup. |
|
496 * Returns the button group as a control. |
|
497 * |
|
498 * @internal |
|
499 * |
|
500 * @return The button group as a control. |
|
501 */ |
|
502 CCoeControl* AsControl(); |
|
503 |
|
504 /** |
|
505 * From MEikButtonGroup. |
|
506 * Returns the button group as a control. |
|
507 * |
|
508 * @internal |
|
509 * |
|
510 * @return The button group as a control. |
|
511 */ |
|
512 const CCoeControl* AsControl() const; |
|
513 |
|
514 /** |
|
515 * From MEikButtonGroup. |
|
516 * Sets the boundary rectangle for externally-positioned button groups. |
|
517 * For use by EExternal button groups only. |
|
518 * |
|
519 * @internal |
|
520 * |
|
521 * @param aBoundingRect Not used. |
|
522 */ |
|
523 void SetBoundingRect(const TRect& aBoundingRect); |
|
524 |
|
525 /** |
|
526 * From MEikButtonGroup. |
|
527 * Subtracts the area occupied by the button group from the specified bounding rectangle. |
|
528 * This method should be used in preference to querying the container's area at all times. |
|
529 * For use by EExternal button groups only. |
|
530 * |
|
531 * @internal |
|
532 * |
|
533 * @param aBoundingRect Rectangle to be modified. |
|
534 */ |
|
535 void ReduceRect(TRect& aBoundingRect) const; |
|
536 |
|
537 /** |
|
538 * Returns a group control (a button) as a control. |
|
539 * |
|
540 * @internal |
|
541 * |
|
542 * @param aCommandId The button's command id. |
|
543 * @return The group control as a control. |
|
544 */ |
|
545 CCoeControl* GroupControlById(TInt aCommandId); |
|
546 |
|
547 /** |
|
548 * From MEikButtonGroup. |
|
549 * Returns a group control (a button) as a control. |
|
550 * |
|
551 * @internal |
|
552 * |
|
553 * @param aCommandId The button's command id. |
|
554 * @return The group control as a control. |
|
555 */ |
|
556 CCoeControl* GroupControlById(TInt aCommandId) const; |
|
557 |
|
558 /** |
|
559 * From MEikButtonGroup. |
|
560 * Returns the command id by position. |
|
561 * |
|
562 * @internal |
|
563 * |
|
564 * @param aCommandPos The command's position. |
|
565 * @return The command id. |
|
566 */ |
|
567 TInt CommandId(TInt aCommandPos) const; |
|
568 |
|
569 /** |
|
570 * From MEikButtonGroup. |
|
571 * Gets the total number of buttons currently present in the group. |
|
572 * |
|
573 * @internal |
|
574 * |
|
575 * @return The number of buttons. |
|
576 */ |
|
577 TInt ButtonCount() const; |
|
578 |
|
579 /** |
|
580 * Removes previous command. |
|
581 * |
|
582 * @internal |
|
583 * |
|
584 * @param aPosition The command's position. |
|
585 */ |
|
586 void RemovePreviousCommand(TInt aPosition); |
|
587 |
|
588 /** |
|
589 * From MEikButtonGroup. |
|
590 * Not supported, because it is not possible to convert a CBA button to a |
|
591 * CEikCommandButton. Calling this in debug build causes a panic, otherwise |
|
592 * NULL is just returned. |
|
593 * |
|
594 * @internal |
|
595 * |
|
596 * @param aCommandId Not used. |
|
597 */ |
|
598 CEikCommandButton* GroupControlAsButton(TInt aCommandId) const; |
|
599 |
|
600 /** |
|
601 * From MEikButtonGroup. |
|
602 * Gets the button group flags. |
|
603 * |
|
604 * @internal |
|
605 * |
|
606 * @return The button group flags. |
|
607 */ |
|
608 TUint ButtonGroupFlags() const; |
|
609 |
|
610 /** |
|
611 * Sets the button group flags. |
|
612 * |
|
613 * @internal |
|
614 * |
|
615 * @param aFlags The button group flags. |
|
616 */ |
|
617 IMPORT_C void SetButtonGroupFlags(TInt aFlags); |
|
618 |
|
619 /** |
|
620 * Sets the skin background for this control button array. The new background is used |
|
621 * for all the subsequent drawing operations. This method does not itself cause a repaint. |
|
622 * |
|
623 * @internal |
|
624 * |
|
625 * @param aIID Skin item ID of the new background. This is one of the constants |
|
626 * defined in AknsConstants.h, and the usual values are KAknsIIDQsnBgAreaControl, |
|
627 * KAknsIIDQsnBgAreaControlPopup, and KAknsIIDQsnBgAreaControlIdle. |
|
628 * @since S60 2.0 |
|
629 */ |
|
630 IMPORT_C void SetSkinBackgroundId(const TAknsItemID& aIID); |
|
631 |
|
632 /** |
|
633 * Sets the middle softkey icon. |
|
634 * |
|
635 * @internal |
|
636 * |
|
637 * @since S60 3.1 |
|
638 */ |
|
639 void SetMSKIconL(); |
|
640 |
|
641 /** |
|
642 * From MEikButtonGroup. |
|
643 * Sets the middle softkey command observer. |
|
644 * |
|
645 * @internal |
|
646 * |
|
647 * @param aCommandObserver The middle softkey command observer. |
|
648 * @since S60 3.1 |
|
649 */ |
|
650 void SetMSKCommandObserver(MEikCommandObserver* aCommandObserver); |
|
651 |
|
652 /** |
|
653 * From MEikButtonGroup. |
|
654 * Dims (but doesn't draw) the button with position aPosition. |
|
655 * |
|
656 * @internal |
|
657 * |
|
658 * @param aPosition The position for command to be dimmed. |
|
659 * @param aDimmed ETrue for dimming. |
|
660 */ |
|
661 void DimCommandByPosition(TInt aPosition, TBool aDimmed); |
|
662 |
|
663 /** |
|
664 * From MEikButtonGroup. |
|
665 * Returns ETrue if the button with position aPosition is dimmed. |
|
666 * |
|
667 * @internal |
|
668 * |
|
669 * @param aPosition The position for command to be checked. |
|
670 * @return The state of the button. |
|
671 */ |
|
672 TBool IsCommandDimmedByPosition(TInt aPosition) const; |
|
673 |
|
674 /** |
|
675 * From MEikButtonGroup. |
|
676 * Sets the the button with position aPosition to be visible if aVisible is ETrue. |
|
677 * |
|
678 * @internal |
|
679 * |
|
680 * @param aPosition The position for command to be made visible. |
|
681 * @param aVisible EFalse for making button invisible. |
|
682 */ |
|
683 void MakeCommandVisibleByPosition(TInt aPosition, TBool aVisible); |
|
684 |
|
685 /** |
|
686 * From MEikButtonGroup. |
|
687 * Returns ETrue if the button with position aPosition is visible. |
|
688 * |
|
689 * @internal |
|
690 * |
|
691 * @param aPosition The position for command to be checked. |
|
692 * @return The state of the button. |
|
693 */ |
|
694 TBool IsCommandVisibleByPosition(TInt aPosition) const; |
|
695 |
|
696 /** |
|
697 * From MEikButtonGroup. |
|
698 * Not supported. |
|
699 * |
|
700 * @internal |
|
701 * |
|
702 * @param aPosition Not used. |
|
703 */ |
|
704 void AnimateCommandByPosition(TInt aPosition); |
|
705 |
|
706 /** |
|
707 * Returns a group control (a button) as a control. |
|
708 * |
|
709 * @internal |
|
710 * |
|
711 * @param aPosition The button's position. |
|
712 * @return The group control as a control. |
|
713 */ |
|
714 // CCoeControl* GroupControlByPosition(TInt aPosition) const; |
|
715 |
|
716 /** |
|
717 * Gets a CBA button rectangle. This can be used in touch layouts to |
|
718 * get the whole rectangle of the CBA button, as the button areas |
|
719 * are larger than the actual button control in touch layouts. |
|
720 * |
|
721 * @param aPosition Position of the button. |
|
722 * @param aRelativeToScreen If @c ETrue, the returned rectangle |
|
723 * coordinates are relative to the screen |
|
724 * rectangle, otherwise they are relative |
|
725 * to the CBA area. Note that this parameter is |
|
726 * only taken into account in touch layouts, and |
|
727 * in nHD landscape mode the returned rectangle |
|
728 * is always relative to the screen regardless |
|
729 * of this parameter. |
|
730 * |
|
731 * @return Rectangle of the specified button. |
|
732 */ |
|
733 TRect ButtonRectByPosition( TInt aPosition, |
|
734 TBool aRelativeToScreen ); |
|
735 |
|
736 /** |
|
737 * Enable or disable transparent rendering. |
|
738 * |
|
739 * @internal |
|
740 * @since S60 v5.0 |
|
741 * @param aEnable ETrue to enable transparency, |
|
742 * EFalse to disable. |
|
743 */ |
|
744 void EnablePostingTransparency( TBool aEnable ); |
|
745 |
|
746 /** |
|
747 * Returns TBitFlags. |
|
748 * |
|
749 * @internal |
|
750 * @since S60 v5.2 |
|
751 * @return TBitFlags. |
|
752 */ |
|
753 TBitFlags Flags(); |
|
754 |
|
755 /** |
|
756 * Sets content observer. |
|
757 * |
|
758 * @internal |
|
759 * @since S60 v5.2 |
|
760 * @param aCallBack call back to notify of content changes. |
|
761 */ |
|
762 void SetContentObserver( TCallBack aCallBack ); |
|
763 |
|
764 public: |
|
765 /** |
|
766 * Formerly from MTopSetMember<CEikCba>, now reserved. |
|
767 */ |
|
768 virtual void Reserved_MtsmPosition(); |
|
769 |
|
770 /** |
|
771 * Formerly from MTopSetMember<CEikCba>, now reserved. |
|
772 */ |
|
773 virtual void Reserved_MtsmObject(); |
|
774 |
|
775 public: // from CCoeControl |
|
776 /** |
|
777 * From CCoeControl. |
|
778 * Handles key events. |
|
779 * |
|
780 * @param aKeyEvent The key event. |
|
781 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown. |
|
782 * @return Indicates whether or not the key event was used by this control. |
|
783 */ |
|
784 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
785 |
|
786 /** |
|
787 * From CCoeControl. |
|
788 * Sets the control's minimum required size. |
|
789 * |
|
790 * @return The minimum size required by the control. |
|
791 */ |
|
792 TSize MinimumSize(); |
|
793 |
|
794 /** |
|
795 * From CCoeControl. |
|
796 * Gets the list of logical colours used to draw the control. |
|
797 * The list includes an explanation of how each colour is used. |
|
798 * |
|
799 * @param aColorUseList The colour list. |
|
800 */ |
|
801 void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; |
|
802 |
|
803 /** |
|
804 * From CCoeControl. |
|
805 * Handles a change to the control's resources. |
|
806 * |
|
807 * @param aType A message UID value. |
|
808 */ |
|
809 void HandleResourceChange(TInt aType); |
|
810 |
|
811 /** |
|
812 * From CCoeControl. |
|
813 * Sets this control as visible or invisible. |
|
814 * |
|
815 * @param aVisible ETrue to make the control visible, EFalse to make it invisible. |
|
816 */ |
|
817 void MakeVisible(TBool aVisible); |
|
818 |
|
819 /** |
|
820 * From CCoeControl. |
|
821 * Handles pointer events. |
|
822 * |
|
823 * @param aPointerEvent The pointer event |
|
824 */ |
|
825 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
826 |
|
827 /** |
|
828 * From CCoeControl. |
|
829 * Sets the control's containing window by copying it from aContainer. |
|
830 * |
|
831 * @param aContainer The compound control that is the container for this control |
|
832 */ |
|
833 void SetContainerWindowL( const CCoeControl& aContainer ); |
|
834 |
|
835 void ActivateL(); |
|
836 |
|
837 public: // from MEikEnhancedButtonGroup |
|
838 /** |
|
839 * From MEikEnhancedButtonGroup. |
|
840 * Used to offer list of commands for softkeys. |
|
841 * |
|
842 * @param aCommandList A list of command ids to be offered for softkeys. |
|
843 */ |
|
844 IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList); |
|
845 |
|
846 /** |
|
847 * From MEikEnhancedButtonGroup. |
|
848 * Used to offer list of commands for softkeys. |
|
849 * |
|
850 * @param aResourceId Id for CBA resource that defines enhanced cba buttons. |
|
851 */ |
|
852 IMPORT_C void OfferCommandListL(const TInt aResourceId); |
|
853 |
|
854 /** |
|
855 * From MEikEnhancedButtonGroup. |
|
856 * Used to check if a certain command have been approved to the current command set. |
|
857 * |
|
858 * @param aCommandId The id for command which existence should be checked. |
|
859 * @return ETrue if command is in control group, otherwise EFalse. |
|
860 */ |
|
861 IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const; |
|
862 |
|
863 /** |
|
864 * From MEikEnhancedButtonGroup. |
|
865 * Replace existing command with a new command. |
|
866 * |
|
867 * @param aCommandId Id for command that should be replaced. |
|
868 * @param aResourceId Resource id for new enhanced cba button. |
|
869 */ |
|
870 IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId); |
|
871 |
|
872 public: // From MCoeControlObserver |
|
873 void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ); |
|
874 |
|
875 private: |
|
876 /** |
|
877 * From CAknControl |
|
878 */ |
|
879 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
880 |
|
881 protected: |
|
882 /** |
|
883 * From MEikScrollBarObserver |
|
884 * Handles scroll events. This function is called by the CEikScrollBar object with which |
|
885 * this scroll bar observer object is registered. Implementations should handle scroll |
|
886 * events appropriately. |
|
887 * |
|
888 * @param aScrollBar Pointer to the originating scroll bar object. |
|
889 * @param aEventType A scroll event. |
|
890 */ |
|
891 virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); |
|
892 |
|
893 /** |
|
894 * From CCoeControl |
|
895 * Retrieves an object of the same type as that encapsulated in aId. |
|
896 * This function is used to allow controls to ask their owners for access to other |
|
897 * objects that they own. |
|
898 * |
|
899 * @param aId An encapsulated object type ID. |
|
900 * @return Encapsulates the pointer to the object provided. Note that the encapsulated |
|
901 * pointer may be NULL. |
|
902 */ |
|
903 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
904 |
|
905 /** |
|
906 * From CCoeControl. |
|
907 * Draws the control. |
|
908 * |
|
909 * @param aRect Rectangle to draw on. |
|
910 */ |
|
911 void Draw(const TRect& aRect) const; |
|
912 |
|
913 public: |
|
914 |
|
915 /** |
|
916 * Checks if the CBA contains no commands. |
|
917 * Note that this returns always @c EFalse if the CBA belongs |
|
918 * to a full screen query. |
|
919 * |
|
920 * @internal |
|
921 * |
|
922 * @return @c ETrue if the CBA buttons are empty, @c EFalse otherwise. |
|
923 * |
|
924 * @since 5.0 |
|
925 */ |
|
926 IMPORT_C TBool IsEmpty() const; |
|
927 |
|
928 /** |
|
929 * Returns ETrue if softkey status change is allowed. |
|
930 * |
|
931 * @param aSofkeyPosition Softkey position. |
|
932 * @param aDisabled ETrue if softkey is to be disabled. |
|
933 * @return ETrue if softkey status change is allowed. |
|
934 */ |
|
935 TBool SoftkeyStatusChangeAllowed( |
|
936 TInt aSofkeyPosition, TBool aDisabled ); |
|
937 |
|
938 /** |
|
939 * Returns item specific softkey if it state should be updated. |
|
940 * |
|
941 * @return Item specific softkey. |
|
942 */ |
|
943 TEikGroupControl* ItemSpecificSoftkey() const; |
|
944 |
|
945 /** |
|
946 * Updates item specific softkey. |
|
947 * |
|
948 * @param aVisibleCollection ETrue if state should be updated according |
|
949 * to visible collection. |
|
950 */ |
|
951 void UpdateItemSpecificSoftkey( TBool aVisibleCollection = ETrue ); |
|
952 |
|
953 |
|
954 private: // new methods |
|
955 |
|
956 CEikCba( |
|
957 const CEikCba* aPrevious, |
|
958 MEikCommandObserver* aCommandObserver, |
|
959 RWindowGroup* aParentWg, |
|
960 TUint aFlags = 0 ); |
|
961 void BaseConstructL(); |
|
962 void ConstructL(TInt aResourceId); |
|
963 void ConstructFromResourceL(TResourceReader& aReader); |
|
964 CCoeControl* ButtonById( TInt aCommandId ) const; |
|
965 void CreateScrollBarFrameL(); |
|
966 void InsertScrollBarL(); |
|
967 TEikGroupControl VScrollBarAsGroupControl(); |
|
968 void CheckSkinAndUpdateContext(); |
|
969 |
|
970 TInt AknLayoutFlags() const; |
|
971 void SizeChangedInControlPane(); |
|
972 void SizeChangedInStaconPane(); |
|
973 void SizeChangedInRightPane(); |
|
974 void UpdateFonts(); |
|
975 |
|
976 void DoSkinChange(); |
|
977 void DoColorChange(); |
|
978 void DoLayoutChange(); |
|
979 |
|
980 void SizeChangedInsideDialog(); |
|
981 |
|
982 /** |
|
983 * Handles size change events in case of embedded softkeys. |
|
984 */ |
|
985 void SizeChangedInPopup(); |
|
986 |
|
987 /** |
|
988 * Updates softkey labels in case of embedded softkeys. |
|
989 * |
|
990 * @param aDrawDeferred ETrue to cause a redraw event. |
|
991 */ |
|
992 void UpdateLabels( TBool aDrawDeferred ); |
|
993 |
|
994 /** |
|
995 * Layouts given cba control to it's rect correctly. This function is |
|
996 * used to layout every text and image inside of @c CEikCba. |
|
997 * |
|
998 * @param aControl CBA Control that is to be layouted |
|
999 * @param aRect the rect where control should be layouted. |
|
1000 */ |
|
1001 void LayoutControl(CCoeControl* aControl, const TRect& aRect); |
|
1002 |
|
1003 void DoSetLayers( const TAknsItemID& aIID ); |
|
1004 |
|
1005 /** |
|
1006 * Broadcasts transparency information |
|
1007 * to CEikCbaButtons. |
|
1008 */ |
|
1009 void BroadcastPostingTransparency( TBool aEnable ); |
|
1010 |
|
1011 /** |
|
1012 * Sets the CBA fading according to button content. |
|
1013 */ |
|
1014 void SetFadeState(); |
|
1015 |
|
1016 /** |
|
1017 * A better version of AddCommandToStackL |
|
1018 * Pushes a command button with text and a command ID onto a position's button stack. |
|
1019 * SizeChanged() is not called, so it need to be done after that. |
|
1020 * Note that this implementation does not support bitmap and mask. |
|
1021 * |
|
1022 * @internal |
|
1023 * |
|
1024 * @param aPosition The position in the button group at which to add the command button. |
|
1025 * @param aCommandId Command ID the button will send. |
|
1026 * @param aText Text for the button. |
|
1027 */ |
|
1028 void AddCommandToStackWithoutSizeChangedL( |
|
1029 TInt aPosition, |
|
1030 TInt aCommandId, |
|
1031 const TDesC* aText); |
|
1032 |
|
1033 /** |
|
1034 * Removes previous command but do not call SizeChanged And SetMSKIconL. |
|
1035 * |
|
1036 * @internal |
|
1037 * |
|
1038 * @param aPosition The command's position. |
|
1039 */ |
|
1040 void RemovePreviousCommandWithoutSizeChanged(TInt aPosition); |
|
1041 |
|
1042 /** |
|
1043 * Reports state changed event if cba changed from empty to non-empty |
|
1044 * or vice versa. |
|
1045 */ |
|
1046 void ReportContentChangedEvent(); |
|
1047 |
|
1048 /** |
|
1049 * Draws embedded softkey. |
|
1050 * |
|
1051 * @internal |
|
1052 * |
|
1053 * @param aGroupControl TEikGroupControl used to get access to CBA button. |
|
1054 * @param aRect Softkey rectangle |
|
1055 * @param aGc Graphics context |
|
1056 * @param aMask Mask |
|
1057 */ |
|
1058 void DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl, |
|
1059 const TRect& aRect, |
|
1060 CWindowGc& aGc, |
|
1061 CFbsBitmap* aMask ) const; |
|
1062 TBool UpdateIconL(); |
|
1063 |
|
1064 /** |
|
1065 * Checks if the middle softkey should be used. |
|
1066 * |
|
1067 * @internal |
|
1068 * |
|
1069 * @return @c ETrue if MSK is to be used, @c EFalse otherwise. |
|
1070 */ |
|
1071 TBool MskAllowed() const; |
|
1072 |
|
1073 /** |
|
1074 * Updates item specific softkey. |
|
1075 * |
|
1076 * @param aControl Item specifc softkey control. |
|
1077 * @param aEnable ETrue if control should be enabled, EFalse if disabled. |
|
1078 */ |
|
1079 void UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable ); |
|
1080 |
|
1081 private: // from CCoeControl |
|
1082 void SizeChanged(); |
|
1083 |
|
1084 private: // data |
|
1085 TUint iCbaFlags; |
|
1086 |
|
1087 /** Used to maintain the original settings if a client needs to temporarily change its cba. */ |
|
1088 const CEikCba* iLink; |
|
1089 |
|
1090 CCoeBrushAndPenContext* iBrushAndPenContext; |
|
1091 MEikCommandObserver* iCommandObserver; |
|
1092 CEikCbaScrollBarFrame* iSBFrame; |
|
1093 RWindowGroup* iParentWg; |
|
1094 |
|
1095 /** New member variable that stores commands in correct order. */ |
|
1096 CEikCommandTable* iCommandTable; |
|
1097 |
|
1098 /** For MSK. */ |
|
1099 TBool iMSKset; |
|
1100 |
|
1101 /** For MSK, caches CenRep value. */ |
|
1102 TBool iMSKEnabledInPlatform; |
|
1103 |
|
1104 /** Additional observer for MSK. This is called first and default observer after that. */ |
|
1105 MEikCommandObserver* iMSKCommandObserver; |
|
1106 |
|
1107 // From extension. |
|
1108 const CFont* iLabelFont; |
|
1109 const CFont* iStaconLabelFont; |
|
1110 const CFont* iRightPaneLabelFont; |
|
1111 TBool iPopupVisible; |
|
1112 TBitFlags iFlags; |
|
1113 |
|
1114 /** Old background context. */ |
|
1115 CAknsBasicBackgroundControlContext* iBgContext; |
|
1116 |
|
1117 /** Old stacon background context. */ |
|
1118 CAknsLayeredBackgroundControlContext* iStaconBgContext; |
|
1119 |
|
1120 /** Masked layer backgrounds. */ |
|
1121 CAknsMaskedLayerBackgroundControlContext* iMLBgContext; |
|
1122 CAknsMaskedLayerBackgroundControlContext* iStaconBgContextTop; |
|
1123 CAknsMaskedLayerBackgroundControlContext* iStaconBgContextBottom; |
|
1124 |
|
1125 TAknsItemID iBgIID; |
|
1126 |
|
1127 /** |
|
1128 * Skin background ID for the status pane controlled region |
|
1129 * of the CBA area in bottom softkey landscape mode. |
|
1130 */ |
|
1131 TAknsItemID iClockIndicBgIID; |
|
1132 TBool iIsClockIndicBgIIDSet; |
|
1133 |
|
1134 CEikCbaExtension* iExtension; |
|
1135 }; |
|
1136 |
|
1137 /** |
|
1138 * EIKON CBA button class definition. |
|
1139 * |
|
1140 * @internal |
|
1141 * @lib eikcoctl.lib |
|
1142 * @since S60 0.9 |
|
1143 */ |
|
1144 class CEikCbaButton : public CAknControl |
|
1145 { |
|
1146 public: |
|
1147 /** |
|
1148 * Holds information about command id and dimming status for a button. |
|
1149 */ |
|
1150 struct SButtonOptions |
|
1151 { |
|
1152 TInt iCommandId; |
|
1153 TBool iDimmed; |
|
1154 }; |
|
1155 public: |
|
1156 /** |
|
1157 * Destructor. |
|
1158 */ |
|
1159 ~CEikCbaButton(); |
|
1160 |
|
1161 /** |
|
1162 * Constructs a new CBA button instance. |
|
1163 * |
|
1164 * @param aAlignment Alignment for label. |
|
1165 */ |
|
1166 void ConstructL(TGulAlignmentValue aAlignment); |
|
1167 public: |
|
1168 /** |
|
1169 * Updates the label text with the given label. |
|
1170 * |
|
1171 * @param aText The new label text. |
|
1172 */ |
|
1173 void AddCommandL(const TDesC& aText); |
|
1174 |
|
1175 /** |
|
1176 * Pushes a command into button stack. |
|
1177 * |
|
1178 * @param aCommandId The command to be pushed. |
|
1179 * @param aText Text for the button. |
|
1180 */ |
|
1181 void PushCommandL(TInt aCommandId, const TDesC& aText); |
|
1182 |
|
1183 /** |
|
1184 * Pops a command from the button stack. |
|
1185 * |
|
1186 * @return The button's command id. KErrNotFound if the button stack is empty. |
|
1187 */ |
|
1188 TInt PopCommand(); |
|
1189 |
|
1190 /** |
|
1191 * Removes a command from the button stack. |
|
1192 * |
|
1193 * @param aCommandId The command to be removed. |
|
1194 */ |
|
1195 void RemoveCommand(TInt aCommandId); |
|
1196 |
|
1197 /** |
|
1198 * Removes the previous command from the button stack. |
|
1199 */ |
|
1200 void RemovePreviousCommand(); |
|
1201 |
|
1202 /** |
|
1203 * Switches the button's text to short or long depending on the parameter given. |
|
1204 * |
|
1205 * @param aShortText ETrue for short text, EFalse for the long text. |
|
1206 */ |
|
1207 void SwitchToShortTextL(TBool aShortText); |
|
1208 |
|
1209 /** |
|
1210 * Sets the labels font. |
|
1211 * |
|
1212 * @param aLabelFont The font to be used. |
|
1213 */ |
|
1214 void SetLabelFont(const CFont* aLabelFont); |
|
1215 |
|
1216 /** |
|
1217 * Truncates the label. This is done by CEikLabel. |
|
1218 */ |
|
1219 void TruncateLabelText(); |
|
1220 |
|
1221 /** |
|
1222 * Checks if text is empty in this button. |
|
1223 */ |
|
1224 TBool IsEmptyText() const; |
|
1225 |
|
1226 public: |
|
1227 /** |
|
1228 * From CCoeControl. |
|
1229 * Sets the control's containing window by copying it from aContainer. |
|
1230 * |
|
1231 * @param aContainer The compound control that is the container for this control. |
|
1232 */ |
|
1233 void SetContainerWindowL(const CCoeControl& aContainer); |
|
1234 |
|
1235 /** |
|
1236 * Constructs the control from a resource file. |
|
1237 * |
|
1238 * @param aReader The resource reader. |
|
1239 * @param anAlignment Alignment for label. |
|
1240 */ |
|
1241 void ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment); |
|
1242 |
|
1243 /** |
|
1244 * From CCoeControl. |
|
1245 * Sets the control's minimum required size. |
|
1246 * |
|
1247 * @return The minimum size required by the control. |
|
1248 */ |
|
1249 TSize MinimumSize(); |
|
1250 |
|
1251 /** |
|
1252 * From CCoeControl. |
|
1253 * Sets the control to be dimmed. |
|
1254 * |
|
1255 * @param aDimmed ETrue to dim the control, EFalse to set the control as not dimmed. |
|
1256 */ |
|
1257 void SetDimmed(TBool aDimmed); |
|
1258 |
|
1259 /** |
|
1260 * From CCoeControl. |
|
1261 * Handles pointer events. |
|
1262 * |
|
1263 * @param aPointerEvent The pointer event. |
|
1264 */ |
|
1265 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
1266 |
|
1267 public: |
|
1268 /** |
|
1269 * Sets the button's image. |
|
1270 * |
|
1271 * @param aImage The image to be set. |
|
1272 */ |
|
1273 void SetImage(CEikImage &aImage); |
|
1274 |
|
1275 /** |
|
1276 * Replaces the buttons image with label. |
|
1277 */ |
|
1278 void ReplaceImageByLabel(); |
|
1279 |
|
1280 /** |
|
1281 * Returns whether the button has image set. |
|
1282 * |
|
1283 * @return ETrue if the button has image set, EFalse otherwise. |
|
1284 */ |
|
1285 inline TBool IsImageOn() const {return iDoImage;}; |
|
1286 |
|
1287 /** |
|
1288 * Constructs empty button with id EAknSoftkeyEmpty |
|
1289 */ |
|
1290 void ConstructEmptyButtonL(); |
|
1291 |
|
1292 protected: |
|
1293 /** |
|
1294 * Returns the button's index by command id. |
|
1295 * |
|
1296 * @param aCommandId The button's command id. |
|
1297 * @return The button's index. |
|
1298 */ |
|
1299 TInt IndexFromCommandId(TInt aCommandId); |
|
1300 |
|
1301 /** |
|
1302 * Updates the label text with the given label. |
|
1303 * |
|
1304 * @param aText The new label text. |
|
1305 */ |
|
1306 void UpdateLabelText(TPtrC aLabelText); |
|
1307 |
|
1308 private: |
|
1309 /** |
|
1310 * From CCoeControl. |
|
1311 * Gets the number of controls contained in a compound control. |
|
1312 * |
|
1313 * @return The number of component controls contained by this control. |
|
1314 */ |
|
1315 TInt CountComponentControls() const; |
|
1316 |
|
1317 /** |
|
1318 * From CCoeControl. |
|
1319 * Gets an indexed component of a compound control. |
|
1320 * |
|
1321 * @param The index of the control. |
|
1322 * @return The component control with an index of aIndex. |
|
1323 */ |
|
1324 CCoeControl* ComponentControl(TInt aIndex) const; |
|
1325 |
|
1326 /** |
|
1327 * From CCoeControl. |
|
1328 * Responds to changes to the size and position of the contents of this control. |
|
1329 */ |
|
1330 void SizeChanged(); |
|
1331 |
|
1332 /** |
|
1333 * From CAknControl. |
|
1334 */ |
|
1335 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
1336 |
|
1337 public: // new functions |
|
1338 /** |
|
1339 * Returns the state of @c CEikCbaButton. |
|
1340 * |
|
1341 * @return Boolean value for CEikCbaButtons state. ETrue if button is |
|
1342 * pressed down. Otherwise returns EFalse. |
|
1343 */ |
|
1344 TBool PressedDown() const; |
|
1345 |
|
1346 /** |
|
1347 * Changes the state of @c CEikCbaButton. Button's state is stored in a |
|
1348 * member variable. |
|
1349 * |
|
1350 * @param aPressedDown The state that button has. @c ETrue if button's |
|
1351 * state is pressed down. @c EFalse for normal, |
|
1352 * not pressed state. |
|
1353 */ |
|
1354 void SetPressedDown( const TBool aPressedDown ); |
|
1355 |
|
1356 /** |
|
1357 * Enables bitmap mode and hides the label. The text is drawn by CEikCba |
|
1358 * in bitmap mode. |
|
1359 * @internal |
|
1360 * @since S60 v5.0 |
|
1361 * @param aEnableBitmap ETrue to enable bitmap mode. EFalse to work in the |
|
1362 * standard way. |
|
1363 */ |
|
1364 void SetTextBitmapMode( TBool aEnableBitmap ); |
|
1365 |
|
1366 /** |
|
1367 * Draws the button text and mask to give graphics contexts. Background |
|
1368 * is not drawn. |
|
1369 * @internal |
|
1370 * @since S60 v5.0 |
|
1371 * @param aContext Graphics context to render the text itself into. |
|
1372 * @param aMaskContext Graphics context to render the text mask into. |
|
1373 * @param aOffset Offset between the coordinate system of the target |
|
1374 * bitmap context relative to screen coordinates. |
|
1375 */ |
|
1376 void DrawToContext( |
|
1377 CBitmapContext& aContext, |
|
1378 CBitmapContext& aMaskContext, |
|
1379 const TPoint& aOffset ) const; |
|
1380 |
|
1381 /** |
|
1382 * Returns the textual value of the button |
|
1383 * @internal |
|
1384 * @since S60 v5.0 |
|
1385 */ |
|
1386 inline TPtrC FullLabelText() { return iFullLabelText;}; |
|
1387 |
|
1388 private: |
|
1389 void PrepareImageL(); |
|
1390 |
|
1391 protected: |
|
1392 TBuf<KMaxCbaLabelLength> iFullLabelText; |
|
1393 TPtrC iLongLabelText; |
|
1394 TPtrC iShortLabelText; |
|
1395 CEikLabel* iLabel; |
|
1396 CDesCArray* iText; |
|
1397 CArrayFix<SButtonOptions>* iButtonOptions; |
|
1398 CEikImage* iImage; |
|
1399 /** Original mask for softkey image. */ |
|
1400 const CFbsBitmap* iMask; |
|
1401 /** Feedback effects transparency mask for softkey image. */ |
|
1402 CFbsBitmap* iSfeMask; |
|
1403 TBool iDoImage; |
|
1404 /** ETrue if should use text bitmap mode. */ |
|
1405 TBool iUseTextBitmap; |
|
1406 /** Buttons state. */ |
|
1407 TBool iPressedDown; |
|
1408 }; |
|
1409 |
|
1410 /** |
|
1411 * Specialization of CEikCbaButton for the new Enhanced CBA button. |
|
1412 * |
|
1413 * @lib eikcoctl.lib |
|
1414 * @since S60 3.0 |
|
1415 */ |
|
1416 class CEikEnhancedCbaButton : public CEikCbaButton |
|
1417 { |
|
1418 public: |
|
1419 /** |
|
1420 * Default constructor. |
|
1421 */ |
|
1422 CEikEnhancedCbaButton(); |
|
1423 |
|
1424 /** |
|
1425 * Destructor. |
|
1426 */ |
|
1427 ~CEikEnhancedCbaButton(); |
|
1428 |
|
1429 /** |
|
1430 * Returns the command type for current button. |
|
1431 * |
|
1432 * @return The command type. |
|
1433 */ |
|
1434 TInt CommandType() const; |
|
1435 |
|
1436 /** |
|
1437 * Sets command type for current button. |
|
1438 * |
|
1439 * @param aCommandType Command type to be set. |
|
1440 */ |
|
1441 void SetCommandType(const TInt aCommandType); |
|
1442 |
|
1443 /** |
|
1444 * Returns the command id for current button. |
|
1445 * |
|
1446 * @return The command id. |
|
1447 */ |
|
1448 TInt CommandId() const; |
|
1449 |
|
1450 /** |
|
1451 * Constructs a button based on resource definition. |
|
1452 * |
|
1453 * @param aReader Resource reader for reading information from resource file. |
|
1454 */ |
|
1455 void ConstructFromResourceL(TResourceReader& aReader); |
|
1456 |
|
1457 /** |
|
1458 * Constructs empty button with id EAknSoftkeyEmpty. |
|
1459 */ |
|
1460 void ConstructEmptyButtonL(); |
|
1461 |
|
1462 /** |
|
1463 * Used to get the label text for the button. |
|
1464 * |
|
1465 * @return Pointer to the label text. |
|
1466 */ |
|
1467 TPtrC* LabelText(); |
|
1468 |
|
1469 private: // data |
|
1470 TInt iCommandType; |
|
1471 TInt iCommandId; |
|
1472 }; |
|
1473 |
|
1474 /** |
|
1475 * Holds (enhanced) CBA commands and handles command ordering due to placement rules. |
|
1476 * |
|
1477 * @lib eikcoctl.lib |
|
1478 * @since S60 3.0 |
|
1479 * |
|
1480 * @internal |
|
1481 */ |
|
1482 NONSHARABLE_CLASS(CEikCommandTable) : public CBase |
|
1483 { |
|
1484 public: |
|
1485 /** |
|
1486 * Constructs a new command table instance. |
|
1487 * |
|
1488 * @return The new command table. |
|
1489 */ |
|
1490 static CEikCommandTable* NewL(); |
|
1491 |
|
1492 /** |
|
1493 * Constructs a new command table instance. |
|
1494 * |
|
1495 * @return The new command table. |
|
1496 */ |
|
1497 static CEikCommandTable* NewLC(); |
|
1498 |
|
1499 /** |
|
1500 * Destructor. |
|
1501 */ |
|
1502 ~CEikCommandTable(); |
|
1503 |
|
1504 /** |
|
1505 * Used to add a command to CommandTable. |
|
1506 * |
|
1507 * @param aButton The button to be added. |
|
1508 * @return KErrNone if addition was successful. |
|
1509 */ |
|
1510 TInt AddCommandL(CEikEnhancedCbaButton* aButton); |
|
1511 |
|
1512 /** |
|
1513 * Used to check if command table has a button with a certain id. |
|
1514 * |
|
1515 * @param aCommandId The id to be checked. |
|
1516 * @return ETrue if command is placed in the command table. |
|
1517 */ |
|
1518 TBool IsCommandPlaced(const TInt aCommandId) const; |
|
1519 |
|
1520 /** |
|
1521 * Used to replace command with a new command. |
|
1522 * |
|
1523 * @param aCommandId Id for command that should be replaced. |
|
1524 * @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the |
|
1525 * CommandTable. |
|
1526 */ |
|
1527 void ReplaceCommandL(const TInt aCommandId, const TInt aResourceId); |
|
1528 |
|
1529 /** |
|
1530 * Used to get CEikEnhancedCbaButton for current control button (1-4). |
|
1531 * |
|
1532 * @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions. |
|
1533 * @return CEikCbaButton for current position, NULL if no button placed in that position. |
|
1534 */ |
|
1535 CEikEnhancedCbaButton* Command(const TInt aCommandIndex); |
|
1536 |
|
1537 /** |
|
1538 * Reset CommandTable. |
|
1539 */ |
|
1540 void Reset(); |
|
1541 |
|
1542 private: // member functions |
|
1543 /** |
|
1544 * Constructor. |
|
1545 */ |
|
1546 CEikCommandTable(); |
|
1547 |
|
1548 /** |
|
1549 * Constructs command table with device button priorities. |
|
1550 */ |
|
1551 void ConstructL(); |
|
1552 |
|
1553 private: // data |
|
1554 /** Displayed commands. */ |
|
1555 TFixedArray<CEikEnhancedCbaButton*, KMaxButtonsInCommandTable> iCommandButtons; |
|
1556 |
|
1557 /** Priority order for each button. */ |
|
1558 RArray< RArray<TInt> > iPriorities; |
|
1559 }; |
|
1560 |
|
1561 #endif // __EIKCBA_H__ |