williamr@2: /* williamr@2: * Copyright (c) 2000-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: Uikon legacy button that launches a menu when activated williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined(__EIKMNBUT_H__) williamr@2: #define __EIKMNBUT_H__ williamr@2: williamr@2: #if !defined(__EIKMOBS_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__EIKCMBUT_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: class CEikMenuPane; williamr@2: williamr@2: /** williamr@2: * This class implements a command button that, when pressed, raises a Menu pane. williamr@2: * williamr@2: * This class does NOT implement S60 look-and-feel and is not skinned. williamr@2: * williamr@2: * @lib eikcoctl.dll williamr@2: * @since S60 1.0 williamr@2: */ williamr@2: class CEikMenuButton : public CEikCommandButton, private MEikMenuObserver williamr@2: { williamr@2: public: williamr@2: /** williamr@2: * C++ constructor williamr@2: */ williamr@2: IMPORT_C CEikMenuButton(); williamr@2: williamr@2: /** williamr@2: * destructor williamr@2: */ williamr@2: IMPORT_C ~CEikMenuButton(); williamr@2: williamr@2: /** williamr@2: * 2nd phase constructor using a MNBUT resource struct williamr@2: * williamr@2: * @param aReader A constructed resource reader. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * Launch the related menu pane williamr@2: * williamr@2: * @param aObserver Mandatory supplied menu observer pointer. williamr@2: */ williamr@2: IMPORT_C void LaunchPopupMenuL(MEikMenuObserver* aObserver); williamr@2: williamr@2: /** williamr@2: * Set the menu pane id to be launched when the control is activated. williamr@2: * williamr@2: * @param aMenuPaneId Resource ID of the menu pane to be launched williamr@2: */ williamr@2: IMPORT_C void SetMenuPaneId(TInt aMenuPaneId); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Serialize the state of the control to the given stream williamr@2: * williamr@2: * @param aWriteStream Stream to write to williamr@2: */ williamr@2: IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: public: // from CEikButtonBase williamr@2: williamr@2: /** williamr@2: * Triggers the change of appearance of the button that is associated with the button being pressed williamr@2: */ williamr@2: IMPORT_C void Animate(); williamr@2: williamr@2: public: // From CCoeControl williamr@2: williamr@2: /** williamr@2: * From CCoeControl williamr@2: * williamr@2: * Framework method called when a pointer event is found to be within this control's boundaries. williamr@2: * The default implementation causes the associated menu to be presented to the screen. williamr@2: * williamr@2: * @param aPointerEvent Pointer event to process williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * From MEikCommandObserver williamr@2: * williamr@2: * Framework method called to processs a command ID williamr@2: * williamr@2: * @param aCommandId ID of the command to respond to. williamr@2: */ williamr@2: IMPORT_C void ProcessCommandL(TInt aCommandId); williamr@2: williamr@2: /** williamr@2: * From MEikMenuObserver williamr@2: * 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: */ williamr@2: IMPORT_C void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); williamr@2: williamr@2: private: williamr@2: void ClosePopupMenu(); williamr@2: void DoLaunchPopupMenuL(); williamr@2: private: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: private: williamr@2: /** williamr@2: * The object to receive the menu events williamr@2: * Not Owned williamr@2: */ williamr@2: MEikMenuObserver* iMenuObserver; williamr@2: williamr@2: /** williamr@2: * Holds a menu pane object to be popped up williamr@2: * Owned williamr@2: */ williamr@2: CEikMenuPane* iMenuPopup; williamr@2: williamr@2: /** williamr@2: * Resource ID of the menu pane williamr@2: */ williamr@2: TInt iMenuPaneId; williamr@2: williamr@2: TInt iSpare; williamr@2: }; williamr@2: williamr@2: #endif