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 container class definition.
19 #ifndef __EIKBTGPC_H__
20 #define __EIKBTGPC_H__
28 #include <AknControl.h>
30 class MEikCommandObserver;
31 class CEikButtonGroupStack;
32 class CEikCommandButton;
36 * The CEikButtonGroupContainer class provides a wrapper around the different button arrays
37 * used in pen and no-pen devices.
42 NONSHARABLE_CLASS(CEikButtonGroupContainer) : public CAknControl, public MEikCommandObserver
46 * Declares an object type for a class, in order to allow the object
47 * provider mechanism to locate and provide objects from the class.
49 DECLARE_TYPE_ID(0x101F4107)
52 * Describes how the container is being used.
54 * The enumeration is used by the system to create the appropriate (UI variant-specific)
55 * button group for the specified type.
59 EView = SLafButtonGroupContainer::EView, ///< In a view.
60 EDialog = SLafButtonGroupContainer::EDialog, ///< In a dialog.
61 EToolbar = SLafButtonGroupContainer::EToolbar, ///< In a toolbar.
62 ECba = SLafButtonGroupContainer::ECba, ///< In a control button array.
63 EDialogButtons = SLafButtonGroupContainer::EDialogButtons ///< In dialog buttons.
67 * Describes the orientation of the container.
71 EVertical = SLafButtonGroupContainer::EVertical, ///< Buttons are laid out vertically.
72 EHorizontal = SLafButtonGroupContainer::EHorizontal ///< Buttons are laid out horizontally.
76 * Relative positions of the container and the control which uses it.
80 /** The button group is internal to the control which is using it. E.g. dialog buttons. */
81 EInternal = SLafButtonGroupContainer::EInternal,
83 /** The button group is external to the control which is using it. E.g. toolbar or cba. */
84 EExternal = SLafButtonGroupContainer::EExternal
88 * Flags for the display of hotkeys.
92 EShowHotKey = 0x01, ///< Hotkeys for commands should be shown.
93 EPlainHotKey = 0x02 ///< Hotkeys for commands should not be shown.
101 EAddToStack = 0x01, ///< Not used.
102 EDelayActivation = 0x02, ///< If set, the container is not activated during construction.
103 EUseMaxSize = 0x04, ///< Not used.
104 EIsEmbedded = 0x08, ///< Embedded in a dialog or popup.
105 EParentIsControl = 0x10 ///< Parent window group is treated as CCoeControl.
109 * Defines the positions for each command.
111 enum TCommandPosition
113 ELeftSoftkeyPosition = 0, ///< Position for left softkey.
114 ERightSoftkeyPosition = 2, ///< Position for right softkey.
115 EMiddleSoftkeyPosition = 3 ///< Position for middle softkey.
120 * Creates a button group container in its own window.
122 * @param aUse The button group's type.
123 * @param aOrientation The button group's orientation. You need specify this
124 * only for devices that can layout their buttons either
125 * horizontally or vertically.
126 * @param aCommandObserver A command observer to be notified of commands on
128 * @param aResourceId A resource containing descriptions of buttons in the group.
129 * This can be NULL if buttons are to be added dynamically.
130 * @param aFlags The button group's flags.
131 * @return Button group container object.
133 IMPORT_C static CEikButtonGroupContainer* NewL(
135 TOrientation aOrientation,
136 MEikCommandObserver* aCommandObserver,
138 TUint aFlags = EAddToStack);
141 * Creates a button group container in its parent control's window.
143 * @param aUse The button group's type.
144 * @param aOrientation The button group's orientation. You need specify this
145 * only for devices that can layout their buttons either
146 * horizontally or vertically.
147 * @param aCommandObserver A command observer to be notified of commands on
149 * @param aResourceId A resource containing descriptions of buttons in the group.
150 * This can be NULL if buttons are to be added dynamically.
151 * @param aParent The control's parent.
152 * @param aFlags The button group's flags.
153 * @return Button group container object.
155 IMPORT_C static CEikButtonGroupContainer* NewL(
157 TOrientation aOrientation,
158 MEikCommandObserver* aCommandObserver,
160 const CCoeControl& aParent,
161 TUint aFlags = EAddToStack);
164 * Creates a button group container in given window group.
166 * @param aUse The button group's type.
167 * @param aOrientation The button group's orientation. You need specify this
168 * only for devices that can layout their buttons either
169 * horizontally or vertically.
170 * @param aCommandObserver A command observer to be notified of commands on
172 * @param aResourceId A resource containing descriptions of buttons in the group.
173 * This can be NULL if buttons are to be added dynamically.
174 * @param aParentWg The parent window group.
175 * @param aFlags The button group's flags.
176 * @return Button group container object.
178 IMPORT_C static CEikButtonGroupContainer* NewL(
180 TOrientation aOrientation,
181 MEikCommandObserver* aCommandObserver,
183 RWindowGroup& aParentWg,
184 TUint aFlags = EAddToStack);
189 IMPORT_C ~CEikButtonGroupContainer();
192 * Gets a pointer to an application's currently active CEikButtonGroupContainer (if any).
194 * Returns NULL if there are no containers active or none suitable for sharing.
195 * Ownership of the returned pointer is not transferred.
197 * @return Pointer to the button group container.
199 IMPORT_C static CEikButtonGroupContainer* Current();
203 * Sets a command button's text label and command ID.
205 * @param aPosition The position within the button group of the button to change.
206 * If the position is out of range this function raises a panic.
207 * @param aCommandId Command ID the button will send.
208 * @param aText Text for the button.
210 inline void SetCommandL(
216 * Sets a command button's bitmap and command ID.
218 * @param aPosition The position within the button group of the button to change.
219 * If the position is out of range this function raises a panic.
220 * @param aCommandId Command ID the button will send.
221 * @param aBitmap The bitmap for the button.
222 * @param aMask The mask bitmap for aBitmap.
224 inline void SetCommandL(
227 const CFbsBitmap& aBitmap,
228 const CFbsBitmap& aMask);
231 * Sets a command button's bitmap, text and command ID.
233 * @param aPosition The position within the button group of the button to change.
234 * If the position is out of range, the function raises a panic.
235 * @param aCommandId Command ID the button will send.
236 * @param aText The text for the button.
237 * @param aBitmap The bitmap for the button.
238 * @param aMask The mask bitmap for aBitmap.
240 inline void SetCommandL(
244 const CFbsBitmap& aBitmap,
245 const CFbsBitmap& aMask);
248 * Sets a command button's bitmap and command ID. The bitmap and its mask are read
251 * @param aPosition The position within the button group of the button to change.
252 * If the position is out of range, the function raises a panic.
253 * @param aCommandId Command ID the button will send.
254 * @param aFile A multi-bitmap file, containing mask and bitmap images.
255 * @param aBitmapId ID of the bitmap within aFile.
256 * @param aMaskId ID of the mask within aFile.
258 inline void SetCommandL(
266 * Sets a command button's bitmap, text label and command ID. The bitmap and its
267 * mask are read from a file.
269 * @param aPosition The position within the button group of the button to change.
270 * If the position is out of range, the function raises a panic.
271 * @param aCommandId Command ID the button will send.
272 * @param aText The text for the button.
273 * @param aFile A multi-bitmap file, containing mask and bitmap images.
274 * @param aBitmapId ID of the bitmap within aFile.
275 * @param aMaskId ID of the mask within aFile.
277 inline void SetCommandL(
286 * Sets a command button's bitmap, text label and command ID. The bitmap, mask,
287 * text and command ID are all read from resource.
289 * @param aPosition The position within the button group of the button to change.
290 * If the position is out of range, the function raises a panic.
291 * @param aResourceId Resource ID specifying the text, bitmaps and command ID.
293 inline void SetCommandL(
298 * Sets a command button's text. The button to change is identified by its command ID.
300 * @param aCommandId Command ID of the button to change.
301 * @param aText The text for the button.
302 * @leave KErrNotFound The ID cannot be matched to any button.
304 inline void SetCommandL(
309 * Sets a command button's bitmap and mask. The button to change is identified
312 * @param aCommandId Command ID of the button to change.
313 * @param aBitmap Bitmap for the button.
314 * @param aMask Mask bitmap for aBitmap.
315 * @leave KErrNotFound The ID cannot be matched to any button.
317 inline void SetCommandL(
319 const CFbsBitmap& aBitmap,
320 const CFbsBitmap& aMask);
323 * Sets a command button's bitmap, mask and text. The button to change is
324 * identified by its command ID.
326 * @param aCommandId Command ID of the button to change.
327 * @param aText Text for the button.
328 * @param aBitmap Bitmap for the button.
329 * @param aMask Mask bitmap for aBitmap.
331 inline void SetCommandL(
334 const CFbsBitmap& aBitmap,
335 const CFbsBitmap& aMask);
338 * Sets a command button's bitmap and mask. The bitmap and mask are read from
339 * a multi bitmap file. The button to change is identified by its command ID.
341 * @param aCommandId Command ID of the button to change.
342 * @param aFile A multi-bitmap file, containing mask and bitmap images.
343 * @param aBitmapId ID of the bitmap within aFile.
344 * @param aMaskId ID of the mask within aFile.
346 inline void SetCommandL(
353 * Sets a command button's bitmap, mask and text. The bitmap and its mask are read
354 * from a multi bitmap file. The button to change is identified by its command ID.
356 * @param aCommandId Command ID of the button to change.
357 * @param aText Text for the button.
358 * @param aFile A multi-bitmap file, containing mask and bitmap images.
359 * @param aBitmapId ID of the bitmap within aFile.
360 * @param aMaskId ID of the mask within aFile.
362 inline void SetCommandL(
370 * Initialises the group of command buttons from a resource.
372 * @param aResourceId ID of the resource structure specifying the command buttons.
374 IMPORT_C void SetCommandSetL(
378 * Adds a command button with a text label and command ID.
380 * @param aPosition The position in the button group for the new button.
381 * @param aCommandId Command ID for the new button.
382 * @param aText Text for the button.
384 inline void AddCommandL(
390 * Adds a command button with a bitmap label and command ID.
392 * @param aPosition The position in the button group for the new button.
393 * @param aCommandId Command ID for the new button.
394 * @param aBitmap Bitmap for the button.
395 * @param aMask Mask bitmap for aBitmap.
397 inline void AddCommandL(
400 const CFbsBitmap& aBitmap,
401 const CFbsBitmap& aMask);
404 * Adds a command button with a command ID and a label containing both
407 * @param aPosition The position in the button group for the new button.
408 * @param aCommandId Command ID for the new button.
409 * @param aText Text for the button.
410 * @param aBitmap Bitmap for the button.
411 * @param aMask Mask bitmap for aBitmap.
413 inline void AddCommandL(
417 const CFbsBitmap& aBitmap,
418 const CFbsBitmap& aMask);
421 * Adds a command button with a command ID and a bitmap which is read from a file.
423 * @param aPosition The position in the button group for the new button.
424 * @param aCommandId Command ID for the new button.
425 * @param aFile Multi-bitmap file containing the bitmap and mask.
426 * @param aBitmapId ID of the bitmap within aFile.
427 * @param aMaskId ID of the mask within aFile.
429 inline void AddCommandL(
437 * Adds a command button with a command ID and a label containing both a bitmap
438 * and text. The bitmap and mask are read from file.
440 * @param aPosition The position in the button group for the new button.
441 * @param aCommandId Command ID for the new button.
442 * @param aText Text for the button.
443 * @param aFile Multi-bitmap file containing the bitmap and mask.
444 * @param aBitmapId ID of the bitmap within aFile.
445 * @param aMaskId ID of the mask within aFile.
447 inline void AddCommandL(
456 * Pushes a command button with a text label and command ID onto a position's
457 * button stack. This function behaves similarly to SetCommandL() but allows
458 * the previous command button to be retrieved by calling RemoveCommandFromStack().
460 * @param aPosition The position in the button group at which to add the command button.
461 * @param aCommandId Command ID the button will send.
462 * @param aText Text for the button.
464 inline void AddCommandToStackL(
470 * Pushes a command button with a bitmap, mask and command ID onto a position's
471 * button stack. This function behaves similarly to SetCommandL() but allows the
472 * previous command button to be retrieved by calling RemoveCommandFromStack().
474 * @param aPosition The position in the button group at which to add the command button.
475 * @param aCommandId Command ID the button will send.
476 * @param aBitmap Bitmap for the button.
477 * @param aMask Mask bitmap for aBitmap.
479 inline void AddCommandToStackL(
482 const CFbsBitmap& aBitmap,
483 const CFbsBitmap& aMask);
486 * Pushes a command button with text, bitmap, mask and a command ID onto a position's
487 * button stack. This function behaves similarly to SetCommandL() but allows the
488 * previous command button to be retrieved by calling RemoveCommandFromStack().
490 * @param aPosition The position in the button group at which to add the command button.
491 * @param aCommandId Command ID the button will send.
492 * @param aText Text for the button.
493 * @param aBitmap Bitmap for the button.
494 * @param aMask Mask bitmap for aBitmap.
496 inline void AddCommandToStackL(
500 const CFbsBitmap& aBitmap,
501 const CFbsBitmap& aMask);
504 * Pushes a command button with a bitmap, mask and command ID onto a position's button
505 * stack. The bitmap and mask are read from a file. This function behaves similarly to
506 * SetCommandL() but allows the previous command button to be retrieved by calling
507 * RemoveCommandFromStack().
509 * @param aPosition The position in the button group at which to add the command button.
510 * @param aCommandId Command ID the button will send.
511 * @param aFile A multi-bitmap file containing mask and bitmap.
512 * @param aBitmapId Index into the file of the bitmap.
513 * @param aMaskId Index into the file of the bitmap mask.
515 inline void AddCommandToStackL(
523 * Pushes a command button with text, bitmap, mask and command button onto a position's
524 * button stack. The bitmap and mask are read from a file. This function behaves similarly
525 * to SetCommandL() but allows the previous command button to be retrieved by calling
526 * RemoveCommandFromStack().
528 * @param aPosition The position in the button group at which to push the command button.
529 * @param aCommandId Command ID the button will send.
530 * @param aText Text for the button.
531 * @param aFile A multi-bitmap file containing mask and bitmap.
532 * @param aBitmapId Index into the file of the bitmap.
533 * @param aMaskId Index into the file of the bitmap mask.
535 inline void AddCommandToStackL(
544 * Pushes a command button onto a position's button stack. The text, bitmap, mask and
545 * command ID are all read from resource. This function behaves similarly to
546 * SetCommandL() but allows the previous command button to be retrieved by calling
547 * RemoveCommandFromStack().
549 * @param aPosition The position in the button group at which to push the command button.
550 * @param aResourceId ID of a resource specifying the text, bitmaps and command ID.
552 inline void AddCommandToStackL(
557 * As with SetCommandL() but for a set of buttons, also allows the previous command
558 * button to be retrieved by calling RemoveCommand().
560 * @param aResourceId Resource describing the set of command buttons.
562 IMPORT_C void AddCommandSetToStackL(
566 * Removes the command identified by aCommandId, in position aPosition in the group,
567 * from the command stack. Automatically retrieves the previous command details.
568 * Commands are added to the stack by calling AddCommandToStackL.
570 * @param aPosition The position in the button group from which to remove the
572 * @param aCommandId Command ID.
574 IMPORT_C void RemoveCommandFromStack(TInt aPosition, TInt aCommandId);
577 * Sets the default command ID for buttons in this container.
579 * @param aCommandId Command to issue if no other is specified.
581 IMPORT_C void SetDefaultCommand(TInt aCommandId);
584 * Calculates minimum size required to display the buttons defined in the specified
585 * resource structure.
587 * @param aResourceId The ID of the resource structure describing the button group.
588 * @return Minimum size required to display the button group defined in the specified resource structure.
590 IMPORT_C TSize CalcMinimumSizeL(TInt aResourceId) const;
593 * Places the command in position aPosition in the group on the cleanup stack. Typically
594 * used when a control or view changes the contents of two or more buttons on receipt of
595 * focus. After altering one command with a call to AddCommandToStackL() the push is made
596 * to guarantee the display will be left in a consistent state if the second (and any
597 * subsequent) calls to AddCommandToStackL() fail. Only a single command can be pushed
600 * @param aPosition Position in the container of the button to push.
602 IMPORT_C void CleanupCommandPushL(TInt aPosition);
605 * Removes a command from the cleanup stack without destroying it.
607 inline void CleanupCommandPop();
610 * Removes one or more commands from the cleanup stack without destroying them.
612 * @param aCount Number of commands to pop.
614 IMPORT_C void CleanupCommandPop(TInt aCount);
617 * Removes a single command which was pushed onto the cleanup stack. It does this by
618 * calling CleanupCommandPushL(), rolling back to the previous details. The command
619 * button popped is destroyed.
621 inline void CleanupCommandPopAndDestroy();
624 * Removes one or more commands which were pushed onto the cleanup stack. It does this
625 * by calling CleanupCommandPushL(), rolling back to the previous details. The command
626 * buttons popped are destroyed.
628 * @param aCount Number of commands to pop and destroy.
630 inline void CleanupCommandPopAndDestroy(TInt aCount);
633 * Gets the maximum number of buttons that can be supported by the device.
635 * @return The number of command buttons supported.
637 IMPORT_C TInt MaxCommands() const;
640 * Gets the total number of buttons currently present in the group.
642 * @return The number of buttons.
644 IMPORT_C TInt ButtonCount() const;
647 * Dims (but doesn't draw) the button with id aCommandId if aDimmed is ETrue. If two
648 * buttons have the same id, the button to be dimmed is undefined.
650 * @param aCommandId The id for command to be dimmed.
651 * @param aDimmed ETrue for dimming.
653 IMPORT_C void DimCommand(TInt aCommandId, TBool aDimmed);
656 * Returns ETrue if the button with id aCommandId is dimmed. If two buttons have
657 * the same id, the results of this check are undefined.
659 * @param aCommandId The id for command to be checked.
660 * @return The state of the button.
662 IMPORT_C TBool IsCommandDimmed(TInt aCommandId) const;
665 * Sets the the button with id aCommandId to be visible if aVisible is ETrue. If two
666 * buttons have the same id, the button to be altered is undefined.
668 * @param aCommandId The id for command to be made visible.
669 * @param aVisible EFalse for making button invisible.
671 IMPORT_C void MakeCommandVisible(TInt aCommandId, TBool aVisible);
674 * Returns ETrue if the button with id aCommandId is visible. If two buttons have
675 * the same id, the results are undefined.
677 * @param aCommandId The id for command to be checked.
678 * @return The state of the button.
680 IMPORT_C TBool IsCommandVisible(TInt aCommandId) const;
683 * Animates the button with id aCommandId. If two buttons have the same id, the
684 * button to be animated is undefined.
687 * @param aCommandId The id for command to be animated.
689 IMPORT_C void AnimateCommand(TInt aCommandId);
692 * Dims (but doesn't draw) the button with position aPosition.
695 * @param aPosition The position for command to be dimmed.
696 * @param aDimmed ETrue for dimming.
698 IMPORT_C void DimCommandByPosition(TCommandPosition aPosition, TBool aDimmed);
701 * Returns ETrue if the button with position aPosition is dimmed.
704 * @param aPosition The position for command to be checked.
705 * @return The state of the button.
707 IMPORT_C TBool IsCommandDimmedByPosition(TCommandPosition aPosition) const;
710 * Sets the the button with position aPosition to be visible if aVisible is ETrue.
713 * @param aPosition The position for command to be made visible.
714 * @param aVisible EFalse for making button invisible.
716 IMPORT_C void MakeCommandVisibleByPosition(TCommandPosition aPosition, TBool aVisible);
719 * Returns ETrue if the button with position aPosition is visible.
722 * @param aPosition The position for command to be checked.
723 * @return The state of the button.
725 IMPORT_C TBool IsCommandVisibleByPosition(TCommandPosition aPosition) const;
728 * Animates the button with position aPosition.
731 * @param aPosition The position for command to be animated.
733 IMPORT_C void AnimateCommandByPosition(TCommandPosition aPosition);
736 * Gets the button group's location. Typically the button group is external to the
737 * view which is using it. In some cases, such as in dialogs with button panels,
738 * the button group is internal to the control which is using it.
740 * @return The button group's location.
742 IMPORT_C TLocation Location() const;
745 * Gets a pointer to the command button with the specified command Id.
747 * @param aCommandId Command ID of the button.
748 * @return Pointer to the command button CEikCommandButton, NULL if there
749 * was no button with Id aCommandId.
751 IMPORT_C CEikCommandButton* CommandButtonOrNull(TInt aCommandId) const;
754 * Sets the boundary rectangle for externally-positioned button groups.
755 * For use by EExternal button groups only.
757 * @param aRect The boundary rectangle to use. The button group attaches
758 * itself to the inside of this rectangle.
760 IMPORT_C void SetBoundingRect(const TRect& aRect);
763 * Subtracts the area occupied by the button group from the specified bounding
764 * rectangle. This method should be used in preference to querying the container's
765 * area at all times. For use by EExternal button groups only.
767 * @param aBoundingRect Rectangle to be modified.
769 IMPORT_C void ReduceRect(TRect& aBoundingRect) const;
772 * Gets a pointer to the control (button) with the specified command ID.
773 * This method is intended to allow access to standard CCoeControl functionality
774 * only. Casting the return value is likely to fail on different devices.
776 * @param aCommandId Command ID of the button to get.
777 * @return Pointer to a CCoeControl, NULL if there was no button at aCommandId.
779 IMPORT_C CCoeControl* ControlOrNull(TInt aCommandId) const;
782 * Gets a pointer to the the button with the specified command Id.
784 * @param aCommandId Command ID of the button to obtain.
785 * @return The button object.
787 IMPORT_C CEikCommandButton* ButtonById(TInt aCommandId) const;
790 * Gets the position in the group of the button with the specified command Id.
791 * The return value is undefined if two buttons share the same id.
793 * @param aCommandId Identifies the command.
794 * @return The command's container position.
796 IMPORT_C TInt PositionById(TInt aCommandId) const;
799 * Updates a command's hotkey and whether the key is displayed.
800 * This function is only supported by containers being used for dialog buttons.
802 * @param aCommandId Identifies the command to update.
803 * @param aFlags Whether to display the hotkey.
804 * @param aKeyId Hotkey identifier.
806 IMPORT_C void UpdateHotKey(TInt aCommandId, THotKeyFlags aFlags, TInt aKeyId);
809 * Changes the command observer for the button at aPos to aCommandObserver.
810 * Panics if an updated observer is already present. This function should be followed
811 * by RemoveCommandObserver() when you need to put back the original observer.
813 * @param aPos The button's position.
814 * @param aCommandObserver The command observer.
816 IMPORT_C void UpdateCommandObserverL(TInt aPos, MEikCommandObserver& aCommandObserver);
819 * Removes the temporary observer for the button at aPos, replacing it with the
820 * observer that was present when UpdateCommandObserverL() was called.
822 * @param aPos The button's position.
824 IMPORT_C void RemoveCommandObserver(TInt aPos);
827 * Checks for existence of updated command observer for the button at aPosition.
830 * @param aPosition The position for button to be checked.
831 * @return ETrue, if updated command observer exists.
833 IMPORT_C TBool UpdatedCommandObserverExists(TCommandPosition aPosition) const;
836 * Tests whether the button group has explicitly been instructed to suppress redraws.
837 * Some button groups may not activate themselves during construction, in which
838 * case, they need to be activated by the client. This method allows the client
839 * to enquire whether this is necessary.
841 * @return ETrue if the button group will suppress redraws, otherwise EFalse.
843 IMPORT_C TBool DelayActivation() const;
846 * Returns the container's button group.
848 * @return Pointer to the button group object. Ownership is not transferred.
850 inline MEikButtonGroup* ButtonGroup();
853 * Returns the button group type.
855 * @return The button group type.
857 inline TUse ButtonGroupType();
860 * Internal method for setting markable list's MSK observer.
861 * This observer is called before default CBA observer if MSK is pressed.
862 * Observer is removed by passing NULL as parameter.
865 * @param aMSKObserverOwner
866 * @param aCommandObserver
868 void UpdateMSKCommandObserver(
869 CEikListBox* aMSKObserverOwner,
870 MEikCommandObserver* aCommandObserver);
872 public: // From CCoeControl.
875 * Gets the control's minimum required size.
877 * @return The minimum size required by the control.
879 IMPORT_C TSize MinimumSize();
883 * Handles key events.
885 * @param aKeyEvent The key event.
886 * @param aType The type of key event: EEventKey, EEventKeyUp or EEventKeyDown.
887 * @return Indicates whether or not the key event was used by this control.
889 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
893 * Sets this control as visible or invisible.
895 * @param aVisible ETrue to make the control visible, EFalse to make it invisible.
897 void MakeVisible(TBool aVisible);
901 * Writes the internal state of the control and its components to aStream.
902 * Does nothing in release mode.
904 * @param aWriteStream The output stream.
906 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
910 * Formerly from MTopSetMember<CEikButtonGroupContainer>, now reserved.
912 IMPORT_C virtual void Reserved_MtsmPosition();
915 * Formerly from MTopSetMember<CEikButtonGroupContainer>, now reserved.
917 IMPORT_C virtual void Reserved_MtsmObject();
919 public: // New functions for enhanced cba support.
921 * Used to offer list of commands for softkeys.
924 * @param aCommandList A list of command ids to be offered for softkeys.
926 IMPORT_C void OfferCommandListL(const RArray<TInt>& aCommandList);
929 * Used to offer list of commands for softkeys.
932 * @param aResourceId Id for CBA resource that defines enhanced cba buttons.
934 IMPORT_C void OfferCommandListL(const TInt aResourceId);
937 * Used to check if a certain command have been approved to the current command set
940 * @param aCommandId The id for command which existence should be checked.
941 * @return ETrue if command is in control group, otherwise EFalse.
943 IMPORT_C TBool IsCommandInGroup(const TInt aCommandId) const;
946 * Replaces command with another.
949 * @param aCommandId Id for command that should be replaced.
950 * @param aResourceId Resource id for new enhanced cba button.
952 IMPORT_C void ReplaceCommand(const TInt aCommandId, const TInt aResourceId);
955 enum TCommandOp {ESet, EAdd, EPush};
962 inline TCmdPos(TInt aPos, TInt aCmd);
971 inline TCmdObserver(TInt aPos, MEikCommandObserver& aObserver);
974 MEikCommandObserver& iObserver;
977 class CCmdObserverArray : public CArrayFixFlat<TCmdObserver>
980 inline CCmdObserverArray();
981 TInt FindIndex(TInt aPos);
985 CEikButtonGroupContainer(TUse aUse);
988 TOrientation aOrientation,
989 MEikCommandObserver* aCommandObserver,
991 RWindowGroup* aParentWg,
994 IMPORT_C void DoSetCommandL(
998 const CFbsBitmap* aBitmap,
999 const CFbsBitmap* aMask,
1002 IMPORT_C void DoSetCommandL(
1011 IMPORT_C void DoSetCommandL(
1014 const CFbsBitmap* aBitmap,
1015 const CFbsBitmap* aMask,
1018 IMPORT_C void DoSetCommandL(
1026 IMPORT_C void DoSetCommandL(
1031 inline CCoeControl* ButtonGroupAsControl() const;
1033 static void CleanupCommandDestroy(TAny* aPtr);
1034 TCmdPos DoCleanupCommandPop();
1035 void DoCleanupCommandPopAndDestroy();
1037 private: // from CCoeControl
1038 TInt CountComponentControls() const;
1039 CCoeControl* ComponentControl(TInt aIndex) const;
1042 private: // from MEikCommandObserver
1043 void ProcessCommandL(TInt aCommandId);
1044 CCoeControl* CreateCustomCommandControlL(TInt aControlType);
1047 MEikButtonGroup* iButtonGroup;
1049 CArrayFix<TCmdPos>* iCommandsCleanup;
1050 MEikCommandObserver* iCommandObserver;
1051 CCmdObserverArray* iObserverArray;
1052 TDblQueLink iBtLink;
1053 CEikListBox* iMSKObserverOwner;
1057 friend class CCmdObserverArray;
1058 friend class CEikButtonGroupStack;
1062 // Inline function implementations.
1064 inline void CEikButtonGroupContainer::SetCommandL(
1069 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, ESet);
1072 inline void CEikButtonGroupContainer::SetCommandL(
1075 const CFbsBitmap& aBitmap,
1076 const CFbsBitmap& aMask)
1078 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, ESet);
1081 inline void CEikButtonGroupContainer::SetCommandL(
1085 const CFbsBitmap& aBitmap,
1086 const CFbsBitmap& aMask)
1088 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, ESet);
1091 inline void CEikButtonGroupContainer::SetCommandL(
1098 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
1101 inline void CEikButtonGroupContainer::SetCommandL(
1109 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
1112 inline void CEikButtonGroupContainer::SetCommandL(
1116 DoSetCommandL(aPosition, aResourceId, ESet);
1119 inline void CEikButtonGroupContainer::SetCommandL(
1123 DoSetCommandL(aCommandId, &aText, NULL, NULL, ESet);
1126 inline void CEikButtonGroupContainer::SetCommandL(
1128 const CFbsBitmap& aBitmap,
1129 const CFbsBitmap& aMask)
1131 DoSetCommandL(aCommandId, NULL, &aBitmap, &aMask, ESet);
1134 inline void CEikButtonGroupContainer::SetCommandL(
1137 const CFbsBitmap& aBitmap,
1138 const CFbsBitmap& aMask)
1140 DoSetCommandL(aCommandId, &aText, &aBitmap, &aMask, ESet);
1143 inline void CEikButtonGroupContainer::SetCommandL(
1149 DoSetCommandL(aCommandId, NULL, aFile, aBitmapId, aMaskId, ESet);
1152 inline void CEikButtonGroupContainer::SetCommandL(
1159 DoSetCommandL(aCommandId, &aText, aFile, aBitmapId, aMaskId, ESet);
1162 inline void CEikButtonGroupContainer::AddCommandL(
1167 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EAdd);
1170 inline void CEikButtonGroupContainer::AddCommandL(
1173 const CFbsBitmap& aBitmap,
1174 const CFbsBitmap& aMask)
1176 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EAdd);
1179 inline void CEikButtonGroupContainer::AddCommandL(
1183 const CFbsBitmap& aBitmap,
1184 const CFbsBitmap& aMask)
1186 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EAdd);
1189 inline void CEikButtonGroupContainer::AddCommandL(
1196 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EAdd);
1199 inline void CEikButtonGroupContainer::AddCommandL(
1207 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EAdd);
1210 inline void CEikButtonGroupContainer::AddCommandToStackL(
1215 DoSetCommandL(aPosition, aCommandId, &aText, NULL, NULL, EPush);
1218 inline void CEikButtonGroupContainer::AddCommandToStackL(
1221 const CFbsBitmap& aBitmap,
1222 const CFbsBitmap& aMask)
1224 DoSetCommandL(aPosition, aCommandId, NULL, &aBitmap, &aMask, EPush);
1227 inline void CEikButtonGroupContainer::AddCommandToStackL(
1231 const CFbsBitmap& aBitmap,
1232 const CFbsBitmap& aMask)
1234 DoSetCommandL(aPosition, aCommandId, &aText, &aBitmap, &aMask, EPush);
1237 inline void CEikButtonGroupContainer::AddCommandToStackL(
1244 DoSetCommandL(aPosition, aCommandId, NULL, aFile, aBitmapId, aMaskId, EPush);
1247 inline void CEikButtonGroupContainer::AddCommandToStackL(
1255 DoSetCommandL(aPosition, aCommandId, &aText, aFile, aBitmapId, aMaskId, EPush);
1258 inline void CEikButtonGroupContainer::AddCommandToStackL(
1262 DoSetCommandL(aPosition, aResourceId, EPush);
1265 inline void CEikButtonGroupContainer::CleanupCommandPop()
1267 CleanupCommandPop(1);
1270 inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy()
1272 CleanupStack::PopAndDestroy();
1275 inline void CEikButtonGroupContainer::CleanupCommandPopAndDestroy(TInt aCount)
1277 CleanupStack::PopAndDestroy(aCount);
1280 inline MEikButtonGroup* CEikButtonGroupContainer::ButtonGroup()
1282 return iButtonGroup;
1285 inline CEikButtonGroupContainer::TUse CEikButtonGroupContainer::ButtonGroupType()
1290 #endif // __EIKBTGPC_H__