williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __EIKMOBS_H__ williamr@2: #define __EIKMOBS_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: #include williamr@2: williamr@2: class CCoeControl; williamr@2: class CEikMenuPane; williamr@2: class CEikMenuBar; williamr@2: class CEikHotKeyTable; williamr@2: class TPoint; williamr@2: williamr@2: /** Menu observer interface. williamr@2: williamr@2: Menu observers cooperate with menu bars and menu panes, initialising them williamr@2: before display and responding to menu events appropriately. CEikAppUi implements williamr@2: MEikMenuObserver, so these functions may be implemented on an application's williamr@2: App UI. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: class MEikMenuObserver : public MEikCommandObserver williamr@2: { williamr@2: public: williamr@2: /** Menu types */ williamr@2: enum TMenuType williamr@2: { williamr@2: /** Menu pane. */ williamr@2: EMenuPane, williamr@2: /** Menu bar. */ williamr@2: EMenuBar williamr@2: }; williamr@2: public: williamr@2: IMPORT_C virtual void HandleAttemptDimmedSelectionL(TInt aCommandId); williamr@2: IMPORT_C virtual TBool CheckHotKeyNotDimmedL(TInt aCommandId); williamr@2: IMPORT_C virtual void RestoreMenuL(CCoeControl* aMenuControl,TInt aResourceId,TMenuType aType); williamr@2: IMPORT_C virtual void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); williamr@2: IMPORT_C virtual void DynInitMenuBarL(TInt aResourceId,CEikMenuBar* aMenuBar); williamr@2: IMPORT_C virtual void HandleSideBarMenuL(TInt aResourceId,const TPoint& aPos,TInt aModifiers,const CEikHotKeyTable* aTable); williamr@2: IMPORT_C virtual void OfferKeyToAppL(const TKeyEvent& aKeyEvent,TEventCode aType); williamr@2: /** Called by the Uikon framework to handle the emphasising or de-emphasising of williamr@2: a menu window. williamr@2: williamr@2: CEikMenuBar objects call this on their observer to emphasise williamr@2: themselves when they are displayed, and de-emphasise themselves when they williamr@2: stop displaying. williamr@2: williamr@2: @param aMenuControl The menu control. williamr@2: @param aEmphasis ETrue to emphasize the menu, EFalse otherwise. */ williamr@2: virtual void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis)=0; williamr@2: public: williamr@2: IMPORT_C virtual CCoeControl* CreateCustomCommandControlL(TInt aControlType); williamr@2: protected: williamr@2: IMPORT_C MEikMenuObserver(); williamr@2: private: williamr@2: IMPORT_C virtual void Reserved_1_MenuObserver(); williamr@2: IMPORT_C virtual void Reserved_2_MenuObserver(); williamr@2: private: // from MEikCommandObserver. do not override! williamr@2: IMPORT_C void MEikCommandObserver_Reserved1(); williamr@2: IMPORT_C void MEikCommandObserver_Reserved2(); williamr@2: private: williamr@2: TInt iMEikMenuObserver_Spare1; williamr@2: }; williamr@2: williamr@2: williamr@2: /** Provides additional functionality to an auto menu title, in the form of an williamr@2: OfferHotKeyL() method, which is not required in the normal MEikMenuObserver. williamr@2: williamr@2: Auto menu titles are used to ensure that some menu panes appear in every menu williamr@2: constructed for an application. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: class MEikAutoMenuObserver : public MEikMenuObserver williamr@2: { williamr@2: public: williamr@2: /** Offers the specified hot key to the auto menu title. williamr@2: williamr@2: Implement this function if you expect to handle any events from an auto menu. williamr@2: williamr@2: @param aKeyEvent The key event. williamr@2: @param aType The type of key event. williamr@2: @return The auto menu title's response. */ williamr@2: virtual TKeyResponse OfferHotKeyL(const TKeyEvent& aKeyEvent,TEventCode aType)=0; williamr@2: public: // from MEikMenuObserver williamr@2: IMPORT_C void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); williamr@2: public: williamr@2: IMPORT_C virtual void HandleAttemptDimmedSelectionL(TInt aCommandId); williamr@2: IMPORT_C virtual TBool CheckHotKeyNotDimmedL(TInt aCommandId); williamr@2: IMPORT_C virtual void RestoreMenuL(CCoeControl* aMenuControl,TInt aResourceId,TMenuType aType); williamr@2: IMPORT_C virtual void DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane); williamr@2: IMPORT_C virtual void DynInitMenuBarL(TInt aResourceId,CEikMenuBar* aMenuBar); williamr@2: IMPORT_C virtual void HandleSideBarMenuL(TInt aResourceId,const TPoint& aPos,TInt aModifiers,const CEikHotKeyTable* aTable); williamr@2: IMPORT_C virtual void OfferKeyToAppL(const TKeyEvent& aKeyEvent,TEventCode aType); williamr@2: IMPORT_C virtual CCoeControl* CreateCustomCommandControlL(TInt aControlType); williamr@2: protected: williamr@2: IMPORT_C MEikAutoMenuObserver(); williamr@2: private: williamr@2: IMPORT_C virtual void Reserved_1_MenuObserver(); williamr@2: IMPORT_C virtual void Reserved_2_MenuObserver(); williamr@2: private: // from MEikCommandObserver. do not override! williamr@2: IMPORT_C void MEikCommandObserver_Reserved1(); williamr@2: IMPORT_C void MEikCommandObserver_Reserved2(); williamr@2: private: williamr@2: TInt iMEikAutoMenuObserver_Spare1; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // __EIKMOBS_H__