|
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 CAknStylusPopUpMenu; |
|
34 |
|
35 // Class declaration |
|
36 |
|
37 /** |
|
38 * Popup Control adapter interface class |
|
39 * |
|
40 * @ingroup group_xnlayoutengine |
|
41 * @lib xnlayoutengine.lib |
|
42 * @since Series 60 5.0 |
|
43 */ |
|
44 NONSHARABLE_CLASS( CXnPopupControlAdapter ) : public CXnControlAdapter, |
|
45 public MEikMenuObserver |
|
46 { |
|
47 public: |
|
48 // Constructors and destructor |
|
49 |
|
50 /** |
|
51 * Two-phased constructor. |
|
52 * |
|
53 * @param aNode Node |
|
54 */ |
|
55 static CXnPopupControlAdapter* NewL( CXnNodePluginIf& aNode ); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 ~CXnPopupControlAdapter(); |
|
61 |
|
62 private: |
|
63 // Constructors |
|
64 |
|
65 /** |
|
66 * C++ default constructor. |
|
67 */ |
|
68 CXnPopupControlAdapter(); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 */ |
|
73 void ConstructL( CXnNodePluginIf& aNode ); |
|
74 |
|
75 private: |
|
76 // From MEikMenuObserver |
|
77 void ProcessCommandL( TInt aCommandId ); |
|
78 void SetEmphasis( CCoeControl* aMenuControl, TBool aEmphasis ); |
|
79 |
|
80 public: |
|
81 // New functions |
|
82 |
|
83 /* |
|
84 * Sets dynamic menuitem observer |
|
85 * |
|
86 * @param aObserver Observer |
|
87 */ |
|
88 void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ); |
|
89 |
|
90 /* |
|
91 * Makes stylus popup menu visible |
|
92 * |
|
93 * @param aPlugin Plugin which displays this popup |
|
94 */ |
|
95 void TryDisplayingStylusPopupL( CXnNode& aPlugin ); |
|
96 |
|
97 /* |
|
98 * Screen device change notification |
|
99 * |
|
100 * @see CXnControlAdapter documentation |
|
101 */ |
|
102 void HandleScreenDeviceChangedL(); |
|
103 |
|
104 private: |
|
105 // New functions |
|
106 void PopulateMenuL( CXnNode* aItem, CXnNode& aPlugin ); |
|
107 void ShowMenuL( CXnNode& aPlugin, TPoint aPosition ); |
|
108 void HideMenuL(); |
|
109 |
|
110 private: |
|
111 // Data |
|
112 |
|
113 /** UiEngine, Not owned */ |
|
114 CXnUiEngine* iUiEngine; |
|
115 /** Node - received in constructor, Not owned */ |
|
116 CXnNode* iNode; |
|
117 /** Observer, Not owned */ |
|
118 XnMenuInterface::MXnMenuObserver* iObserver; |
|
119 /** Stylus popup menu, Owned */ |
|
120 CAknStylusPopUpMenu* iStylusPopupMenu; |
|
121 /** Stylus popup menu items, Owned */ |
|
122 RPointerArray< CXnNode > iMenuItems; |
|
123 /** Stylus popup menu command ids */ |
|
124 TInt iCommandId; |
|
125 /** Flag to indicate whether popup menu is shown */ |
|
126 TBool iMenuShown; |
|
127 }; |
|
128 |
|
129 #endif // __XNPOPUPCONTROLADAPTER_H__ |
|
130 |