Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: eikmobs.h
Link against: eikcore.lib

Class MEikMenuObserver

MEikMenuObserver

Support

Supported from 6.0

Description

Menu observer interface.

Menu observers cooperate with menu bars and menu panes, initialising them before display and responding to menu events appropriately. CEikAppUi implements MEikMenuObserver, so these functions may be implemented on an application’s App UI.

Writing derived classes

The only pure virtual function in this interface is SetEmphasis(). Other functions may be overridden to provide additional behaviour.

Derivation

MEikCommandObserverCommand observers respond to user commands, and have the secondary function of creating custom controls on request for classes such as CEikToolbar, or user-defined classes
MEikMenuObserverMenu observer interface

Defined in MEikMenuObserver:
CheckHotKeyNotDimmedL(), DynInitMenuBarL(), DynInitMenuPaneL(), EMenuBar, EMenuPane, HandleAttemptDimmedSelectionL(), HandleSideBarMenuL(), OfferKeyToAppL(), RestoreMenuL(), SetEmphasis(), TMenuType

Inherited from MEikCommandObserver:
CreateCustomCommandControlL(), ProcessCommandL()


Mixin interface


HandleAttemptDimmedSelectionL()

virtual void HandleAttemptDimmedSelectionL(TInt aCommandId);

Description

Responds to a user’s attempt to select a dimmed item by displaying a message (CEikonEnv::InfoMsg()) to indicate the item is unavailable.

Parameters

TInt aCommandId

Command ID for the menu item.


CheckHotKeyNotDimmedL()

virtual TBool CheckHotKeyNotDimmedL(TInt aCommandId);

Description

Determines whether a command should be passed to the application. Applications can choose whether to respond to a hotkey event that corresponds to a dimmed item. This function is called when a recognised key press is offered to a menu bar or a menu pane to determine whether to send the corresponding command.

Parameters

TInt aCommandId

The command corresponding to the selected hotkey.

Return value

TBool

ETrue if the command should be passed to the application. This is the default. EFalse if the command should not be passed to the application.


RestoreMenuL()

void RestoreMenuL(CCoeControl* aMenuWindow,TInt aMenuId,TMenuType aMenuType);

Description

Restores the menu window aMenuWindow.

Parameters

CCoeControl* aMenuWindow

The menu window to be restored.

TInt aMenuId

The menu’s ID.

TMenuType aMenuType

The type of menu being restored.


DynInitMenuPaneL()

virtual void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane);

Description

Dynamically initialises a menu pane. The Uikon framework calls this function, if it is implemented in a menu’s observer, immediately before the menu pane is activated.

Typically this function should inquire the value of application data, and initialise menu items accordingly. This includes dimming menu items, changing their text, setting the state of checked items and radio buttons and dynamically adding items to a menu.

Parameters

TInt aResourceId

Resource ID identifying the menu pane to initialise.

CEikMenuPane* aMenuPane

The in-memory representation of the menu pane.


DynInitMenuBarL()

virtual void DynInitMenuBarL(TInt aResourceId, CEikMenuBar* aMenuBar);

Description

As DynInitMenuPaneL(), but for menu bars.

Parameters

TInt aResourceId

Resource ID identifying the menu bar to initialise.

CEikMenuBar* aMenuBar

The in-memory representation of the menu bar.


HandleSideBarMenuL()

virtual void HandleSideBarMenuL(TInt aResourceId, const TPoint& aPos,
     TInt aModifiers, const CEikHotKeyTable* aTable);

Description

This function is invoked by CEikMenuBar’s input handling functions. It may be overridden to handle displaying menus launched from the side bar.

Parameters

TInt aResourceId

Resource ID identifying the menu to launch.

const TPoint& aPos

Position of the menu’s reference point. For sidebar menus, this is the top-right corner.

TInt aModifiers

Key modifiers held when the menu was invoked.

const CEikHotKeyTable* aTable

The menu bar’s hotkey items.


OfferKeyToAppL()

virtual void OfferKeyToAppL(const TKeyEvent& aKeyEvent, TEventCode aType);

Description

Called if a key which is not used by the menu is pressed while the observer’s menu is displaying.

Parameters

const TKeyEvent& aKeyEvent

The key event the menu is offering to the app.

TEventCode aType

Event code type.


SetEmphasis()

virtual void SetEmphasis(CCoeControl* aMenuControl, TBool aEmphasis) = 0;

Description

Called by the Uikon framework to handle the emphasising or de-emphasising of a menu window. CEikMenuBar objects call this on their observer to emphasise themselves when they are displayed, and de-emphasise themselves when they stop displaying.

Parameters

CCoeControl* aMenuControl

The menu control.

TBool aEmphasis

ETrue to emphasize the menu, EFalse otherwise.


Enum TMenuType

TMenuType

Description

Menu types

EMenuPane

Menu pane.

EMenuBar

Menu bar.