Nokia N97 SDK
Example Applications Guide

styluspopupmenuexcontainer.h

00001 /**
00002  * Copyright (c) 2007 Nokia Corporation.
00003  * This material, including documentation and any related
00004  * computer programs, is protected by
00005  * copyright controlled by Nokia Corporation.
00006  */
00007 
00008 #ifndef __STYLUSPOPUPMENUEX_CONTAINER_H__
00009 #define __STYLUSPOPUPMENUEX_CONTAINER_H__
00010 
00011 #include <coecntrl.h>
00012 #include <eikmobs.h>
00013 #include <aknstyluspopupmenu.h>
00014 
00015 const TPoint KPopupPoint( 50, 50 );
00016 /**
00017  * Container class
00018  */
00019 
00020 class CStylusPopupMenuExContainer : public CCoeControl, 
00021                            //public MCoeControlObserver, 
00022                            public MEikMenuObserver
00023     {
00024     
00025 public: // constructor and destructor
00026     
00027    /*
00028     * C++ default constructor 
00029     */
00030     CStylusPopupMenuExContainer();
00031     
00032    /*
00033     * Destructor 
00034     */
00035     virtual ~CStylusPopupMenuExContainer();
00036     
00037    /*
00038     * Symbian 2nd constructor 
00039     * aParam aRect The rect for StylusPopupMenu example
00040     */
00041     void ConstructL( const TRect& aRect );
00042     
00043 public: // new functions
00044 
00045     void CreatePopupMenuL( const TPoint &aPosition = KPopupPoint );
00046     void CreatePopupMenuFromResourceL( const TPoint &aPosition = KPopupPoint );
00047     void UseResourceForPopupMenuL( TBool aValue );
00048     //void UseCodeForPopupMenu();
00049     void UpdateMarkableMenus( CEikMenuPane *aMenuPane );
00050     
00051 public: // from CCoeControl
00052     
00053    /*
00054     * From CCoeControl, Draw
00055     * Draws the application area 
00056     * @param aRect Region of the control to be drawn
00057     */
00058     void Draw( const TRect& aRect ) const;
00059 
00060    /*
00061     * From CCoeControl, CountcomponentControls
00062     * Returns the number of controls 
00063     * @return Number of controls
00064     */
00065     TInt CountComponentControls() const;
00066     
00067    /*
00068     * From CCoeControl, ComponentControl
00069     * Returns pointer to a particular component
00070     * @param aIndex Index of the control
00071     * @return Pointer to component control identified by index
00072     */
00073     CCoeControl* ComponentControl( TInt aIndex ) const;
00074     
00075    /* 
00076     * From CCoeControl, OfferKeyEventL
00077     * Handles key events from the framework
00078     * @param aKeyEvent the key event    
00079     * @param aType The type of key event
00080     * @return Indicates whether or not the keyevent was used
00081     */
00082     //TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType );
00083     
00084    /* 
00085     * From CCoeControl, HandleResourceChange
00086     * Responds to changes to the size and position of the contents of this control.
00087     */ 
00088     void SizeChanged();
00089     
00090    /* 
00091     * From CCoeControl, HandleResourceChange
00092     * Handles a change to the control's resources.
00093     * @param aType TA message UID value
00094     */
00095     void HandleResourceChange( TInt aType );
00096     
00097     void HandlePointerEventL( const TPointerEvent &aPointerEvent );
00098 
00099 public: // from MCoeControlObserver
00100 
00101    /*
00102     * From MCoeControlObserver, HandleControlEventL
00103     * Handles control events from StylusPopupMenus
00104     * @param aControl The control that sent the event
00105     * @param aEventType The event type
00106     */
00107    // void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
00108 
00109 public: // from MEikMenuObserver
00110     //void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane);
00111     void ProcessCommandL(TInt aCommandId);
00112     void SetEmphasis(CCoeControl* /*aMenuControl*/,TBool /*aEmphasis*/)
00113         {
00114         }
00115 private: // Help functions
00116 
00117 
00118          
00119 private: // data
00120 
00121    /*
00122     * Label for showing messages
00123     */
00124     CEikLabel* iLabel; // Own
00125     
00126    /*
00127     * Background context 
00128     */
00129     CAknsBasicBackgroundControlContext* iBgContext;  // Own
00130 
00131     CAknStylusPopUpMenu* iPopup;
00132     
00133     TBool iUseResource;
00134     };
00135 
00136 #endif // __STYLUSPOPUPMENUEX_CONTAINER_H__

© Nokia 2009

Back to top