idlehomescreen/xmluirendering/uiengine/inc/xnpopupcontroladapter.h
branchRCL_3
changeset 83 5456b4e8b3a8
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:  Popup control adapter
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __XNPOPUPCONTROLADAPTER_H__
       
    19 #define __XNPOPUPCONTROLADAPTER_H__
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 #include <eikmobs.h>
       
    24 
       
    25 // User includes
       
    26 #include "xncontroladapter.h"
       
    27 #include "xnmenu.h"
       
    28 
       
    29 // Forward declarations
       
    30 class CXnNodePluginIf;
       
    31 class CXnNode;
       
    32 class CXnUiEngine;
       
    33 class CXnPluginData;
       
    34 class CAknStylusPopUpMenu;
       
    35 
       
    36 // Class declaration
       
    37 
       
    38 /**
       
    39  *  Popup Control adapter interface class
       
    40  *  
       
    41  *  @ingroup group_xnlayoutengine
       
    42  *  @lib xnlayoutengine.lib
       
    43  *  @since Series 60 5.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CXnPopupControlAdapter ) : public CXnControlAdapter,
       
    46     public MEikMenuObserver
       
    47     {
       
    48 public:
       
    49     // Constructors and destructor
       
    50     
       
    51     /**
       
    52      * Two-phased constructor.
       
    53      *
       
    54      * @param aNode Node
       
    55      */
       
    56     static CXnPopupControlAdapter* NewL( CXnNodePluginIf& aNode );
       
    57 
       
    58     /**
       
    59      * Destructor.
       
    60      */
       
    61     ~CXnPopupControlAdapter();
       
    62 
       
    63 private:
       
    64     // Constructors
       
    65     
       
    66     /**
       
    67      * C++ default constructor.
       
    68      */
       
    69     CXnPopupControlAdapter();
       
    70 
       
    71     /**
       
    72      * Two-phased constructor.        
       
    73      */
       
    74     void ConstructL( CXnNodePluginIf& aNode  );
       
    75 
       
    76 private:    
       
    77     // From MEikMenuObserver
       
    78     void ProcessCommandL( TInt aCommandId );
       
    79     void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis );
       
    80     
       
    81 public:
       
    82     // New functions
       
    83     
       
    84     /*
       
    85      * Sets dynamic menuitem observer
       
    86      * 
       
    87      * @param aObserver Observer
       
    88      */
       
    89     void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver );
       
    90     
       
    91     /*
       
    92      * Makes stylus popup menu visible
       
    93      * 
       
    94      * @param aPlugin Plugin which displays this popup
       
    95      */
       
    96     void TryDisplayingStylusPopupL( CXnNode& aPlugin );
       
    97     
       
    98     /*
       
    99      * Screen device change notification
       
   100      * 
       
   101      * @see CXnControlAdapter documentation
       
   102      */
       
   103     void HandleScreenDeviceChangedL();
       
   104     
       
   105     /*
       
   106      * Closes stylus popup menu if it is open
       
   107      */
       
   108     void HideMenuL();
       
   109     
       
   110 private:
       
   111     // New functions
       
   112     void PopulateMenuL( CXnPluginData& aPlugin, CXnNode* aItem );                                  
       
   113     void ShowMenuL( CXnPluginData& aPlugin, TPoint aPosition );
       
   114                            
       
   115 private:
       
   116     // Data
       
   117     
       
   118     /** UiEngine, Not owned */
       
   119     CXnUiEngine*                        iUiEngine;
       
   120     /** Node - received in constructor, Not owned  */
       
   121     CXnNode*                            iNode;
       
   122     /** Observer, Not owned */
       
   123     XnMenuInterface::MXnMenuObserver*   iObserver;
       
   124     /** Stylus popup menu, Owned */
       
   125     CAknStylusPopUpMenu*                iStylusPopupMenu;    
       
   126     /** Stylus popup menu items, Owned */
       
   127     RPointerArray< CXnNode >            iMenuItems;
       
   128     /** Stylus popup menu command ids */
       
   129     TInt                                iCommandId;    
       
   130     /** Flag to indicate whether popup menu is shown */
       
   131     TBool                               iMenuShown;
       
   132     };
       
   133 
       
   134 #endif // __XNPOPUPCONTROLADAPTER_H__
       
   135