idlehomescreen/xmluicontroller/inc/aixuikonmenueventhandler.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Used for handling XUIKON menu events
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_MENUEVENTHANDLER_H
       
    20 #define C_MENUEVENTHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "xnmenu.h"
       
    24 #include "xnbitmap.h"
       
    25 
       
    26 class CXnNodeAppIf;
       
    27 class TXnUiEngineAppIf;
       
    28 class MAiStrParser;
       
    29 class MAiFwEventHandler;
       
    30 class MAiPSPropertyObserver;
       
    31 class CXnAppUiAdapter;
       
    32 class CXnDomNode;
       
    33 class XnMenuInterface::MXnMenuObserver;
       
    34 
       
    35 enum TAICBA
       
    36     {
       
    37     EAIMenuOff = 1,
       
    38     EAIMenuOn
       
    39     };
       
    40 
       
    41 
       
    42 namespace AiXmlUiController
       
    43 {
       
    44     
       
    45 /**
       
    46  *  @ingroup group_xmluicontroller
       
    47  * 
       
    48  *  This class is used for handling XUIKON events.
       
    49  *
       
    50  *  Menu events are handled in here. This class parses
       
    51  *  the events and decides what to do with them.
       
    52  *
       
    53  *  @lib AiXmlUiMain
       
    54  */
       
    55 class CAIXuikonMenuEventHandler : public CBase, public XnMenuInterface::MXnMenuObserver
       
    56     {
       
    57 public:
       
    58 
       
    59     static CAIXuikonMenuEventHandler* NewL(TXnUiEngineAppIf& aUiEngine,
       
    60                                            MAiFwEventHandler* aFwEventHandler,
       
    61                                            CXnAppUiAdapter* aAppUi);
       
    62     
       
    63     ~CAIXuikonMenuEventHandler();
       
    64 
       
    65     TBool HandleEventL( const TDesC8& aEventString8, CXnNodeAppIf* aOrigin = NULL, CXnDomNode* aEvent = NULL );
       
    66         	
       
    67 private:
       
    68     CAIXuikonMenuEventHandler(TXnUiEngineAppIf& aUiEngine,
       
    69                               MAiFwEventHandler* aFwEventHandler,
       
    70                               CXnAppUiAdapter* aAppUi);
       
    71                           
       
    72     void ConstructL();
       
    73     
       
    74     static TInt HandleKeylockEvent(TAny* aSelf);
       
    75     
       
    76     void SetCBALabelsL(TAICBA aCBA, CXnDomNode* aEvent);
       
    77 
       
    78     void ShowMenuL(TBool aShow, const TDesC8& aMenuId, CXnDomNode* aEvent);
       
    79 
       
    80     void ShowMenuItemL(const TDesC8& aMenuItemId, TBool aShow, CXnDomNode* aEvent );
       
    81     
       
    82     TBool IsMenuItemVisibleL( const TDesC8& aMenuItemId, CXnDomNode* aEvent );
       
    83 
       
    84     void ParseParameterStringL(const TDesC8& aSourcePtr, TPtrC8& aTargetPtr);
       
    85 
       
    86     void RecurseChildrenL(TBool aShow, CXnNodeAppIf* aNode);
       
    87 
       
    88     void DoMacrosetL(const TDesC8& aMacrosetNodeId, CXnDomNode* aEvent);
       
    89 
       
    90     void GetTextFromElementL(HBufC8*& aMemberPtr, const TDesC8& aItemId, CXnDomNode* aEvent);
       
    91     
       
    92     TBool HandleMacroOperationL(const TDesC8& aSourcePtr, CXnNodeAppIf& aTargetNode, CXnDomNode& aEvent );
       
    93 
       
    94     TBool AttemptRestoreSoftkeyIconL(
       
    95                             XnMenuInterface::MXnMenuInterface* aControl,
       
    96                             XnImageInterface::MXnImageInterface* aIconControl,
       
    97                             CXnNodeAppIf* aSourceNode,
       
    98                             XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
       
    99 
       
   100     void SetSoftkeyLabelL(
       
   101                             XnMenuInterface::MXnMenuInterface* aControl,
       
   102                             const TDesC8* aLabel,
       
   103                             XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
       
   104                             
       
   105     void SetObserverL( const TDesC8& aParam, CXnDomNode* aEvent );                            
       
   106     
       
   107     TBool InitEditModeMenuItemL( CXnNodeAppIf& aMenuItem, CXnNodeAppIf* aFocused, const TDesC8& aSource );
       
   108     
       
   109     TBool InitDefaultModeMenuItemL( CXnNodeAppIf& aMenuItem, CXnNodeAppIf* aFocused, const TDesC8& aSource );
       
   110     
       
   111     CXnProperty* GetWidgetPropertyL(CXnNodeAppIf& aPlugin, const TDesC8& aProperty);
       
   112 
       
   113 private: // from XnMenuInterface::MXnMenuObserver
       
   114     TBool DynInitMenuItemL( CXnNodeAppIf& aMenuItem );
       
   115     
       
   116 private:    
       
   117     TBool DynInitItemL( CXnNodeAppIf& aMenuItem, CXnNodeAppIf* aFocused );
       
   118 
       
   119 private: // data
       
   120 
       
   121     /**
       
   122      * Current CBA mode, menu/normal(shortcut).
       
   123      */
       
   124     TAICBA iCurrentCBA;
       
   125 
       
   126     /**
       
   127      * Pointer to UI engine IF. Not own.
       
   128      */
       
   129     TXnUiEngineAppIf* iUiEngine;
       
   130 
       
   131     /**
       
   132      * String parser utility. Own.
       
   133      */
       
   134     MAiStrParser* iStrParser;
       
   135     
       
   136     /**
       
   137      * Menu item Open event string.
       
   138      * Own.
       
   139      */
       
   140     HBufC* iActivationEvent;
       
   141 
       
   142     /**
       
   143      * Menu item settings event string.
       
   144      * Own.
       
   145      */
       
   146     HBufC* iSettingsEvent;
       
   147     
       
   148     /**
       
   149      * Close action id.
       
   150      * Own.
       
   151      */
       
   152     TPtrC8 iCloseActionId;
       
   153     
       
   154     /**
       
   155      * Menu mode softkey labels.
       
   156      * Own.
       
   157      */
       
   158     HBufC8* iMenuModeLskLabel;
       
   159     HBufC8* iMenuModeRskLabel;
       
   160 
       
   161     /**
       
   162      * Normal mode softkey labels.
       
   163      * Own.
       
   164      */
       
   165     HBufC8* iNormalModeLskLabel;
       
   166     HBufC8* iNormalModeRskLabel;
       
   167     
       
   168     /**
       
   169      * Normal mode softkey label ids.
       
   170      * Own.
       
   171      */
       
   172     TPtrC8 iNormalModeLskLabelId;
       
   173     TPtrC8 iNormalModeRskLabelId;
       
   174 
       
   175     /**
       
   176      * Normal mode softkey icon ids.
       
   177      * Own.
       
   178      */
       
   179     TPtrC8 iNormalModeLskIconId;
       
   180     TPtrC8 iNormalModeRskIconId;
       
   181 
       
   182     /**
       
   183      * App softkey ids.
       
   184      * Own.
       
   185      */
       
   186     TPtrC8 iLskId;
       
   187     TPtrC8 iRskId;
       
   188 
       
   189     TPtrC8 iLskMenuModeNode;
       
   190     TPtrC8 iRskMenuModeNode;
       
   191     /**
       
   192      * Plug-in event handler.
       
   193      * Doesn't own.
       
   194      */
       
   195     MAiFwEventHandler* iFwEventHandler;
       
   196     
       
   197     /**
       
   198     * Observers keylock status
       
   199     * Owned
       
   200     */
       
   201     MAiPSPropertyObserver* 	iKeylockObserver;
       
   202     
       
   203     /**
       
   204     * Pointer to Appui for closing the menubar when necessary
       
   205     * Not owned
       
   206     */
       
   207     CXnAppUiAdapter* iAppUi;
       
   208     /**
       
   209      * For comparing has the bitmap changed. RSK
       
   210      * Not owned.
       
   211      */
       
   212     CFbsBitmap* iMenumodeBitmapRsk;
       
   213     /**
       
   214      * For comparing has the bitmap changed. LSK
       
   215      * Not owned.
       
   216      */
       
   217     CFbsBitmap* iMenumodeBitmapLsk;
       
   218     
       
   219     };
       
   220 
       
   221 } // namespace AiXmlUiController
       
   222 
       
   223 #endif // C_MENUEVENTHANDLER_H