34
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2006 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: Xuikon Menu Plugin
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef _XNMENU_H
|
|
21 |
#define _XNMENU_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include "xncomponent.h"
|
|
25 |
#include "mxncomponentinterface.h"
|
|
26 |
|
|
27 |
class TAknsItemID;
|
|
28 |
|
|
29 |
namespace XnMenuInterface
|
|
30 |
{
|
|
31 |
_LIT8(KType, "menu");
|
|
32 |
|
|
33 |
class MXnMenuObserver
|
|
34 |
{
|
|
35 |
public:
|
|
36 |
/**
|
|
37 |
* Called when options menu is about to open. Observer can add
|
|
38 |
* its own menu item to the aMenuItems array.
|
|
39 |
* @param aMenuItem menu item
|
|
40 |
* @param aPlugin plugin node
|
|
41 |
* @return ETrue if the item should be shown, EFalse otherwise
|
|
42 |
*/
|
|
43 |
virtual TBool DynInitMenuItemL( CXnNodeAppIf& aMenuItem, CXnNodeAppIf* aPlugin = NULL ) = 0;
|
|
44 |
};
|
|
45 |
|
|
46 |
/**
|
|
47 |
* @ingroup group_xnmenufactory
|
|
48 |
* @lib xn3menufactory.dll
|
|
49 |
* @since S60 3.1
|
|
50 |
*/
|
|
51 |
class MXnMenuInterface : public XnComponentInterface::MXnComponentInterface
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
/**
|
|
55 |
* Soft key position enum
|
|
56 |
* These are same as in CEikButtonGroupContainer::TCommandPosition
|
|
57 |
*/
|
|
58 |
enum TSoftKeyPosition
|
|
59 |
{
|
|
60 |
ELeft = 0,
|
|
61 |
ERight = 2,
|
|
62 |
ECenter = 3 /* Not supported when setting icon */
|
|
63 |
};
|
|
64 |
|
|
65 |
public:
|
|
66 |
|
|
67 |
static inline const TDesC8& Type()
|
|
68 |
{
|
|
69 |
return KType;
|
|
70 |
}
|
|
71 |
|
|
72 |
public: // New functions
|
|
73 |
|
|
74 |
/**
|
|
75 |
* Sets softkey image. If there was no leave, menu takes
|
|
76 |
* bitmap and mask ownership.
|
|
77 |
* @since Series 60 3.2
|
|
78 |
* @param aBitmap Bitmap to draw
|
|
79 |
* @param aMask Mask to use
|
|
80 |
* @param aPos Softkey position
|
|
81 |
* @param aPreserveAspectRatio ETrue if image's aspect ratio is preserved
|
|
82 |
* @param aInvertMask ETrue if white mask is used, EFalse if black mask is used
|
|
83 |
* @param aTransferOwnership ETrue if bitmap and mask ownerhsip is transferred to menuadapter
|
|
84 |
*/
|
|
85 |
virtual void SetSoftKeyImageL(
|
|
86 |
CFbsBitmap* aBitmap,
|
|
87 |
CFbsBitmap* aMask,
|
|
88 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
89 |
TBool aPreserveAspectRatio = EFalse, TBool aInvertMask = EFalse,
|
|
90 |
TBool aTransferOwnership = ETrue ) = 0;
|
|
91 |
|
|
92 |
virtual void SetSoftKeyImageL(
|
|
93 |
CFbsBitmap* aBitmap,
|
|
94 |
CFbsBitmap* aMask,
|
|
95 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
96 |
CXnNodeAppIf* aNode,
|
|
97 |
TBool aPreserveAspectRatio = EFalse, TBool aInvertMask = EFalse,
|
|
98 |
TBool aTransferOwnership = ETrue ) = 0;
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Sets soft key image.
|
|
102 |
* @param aId icon bitmap IID
|
|
103 |
* @param aBmpFile file path.
|
|
104 |
* @param aBmp Bitmap ID.
|
|
105 |
* @param aBmpM Bitmap mask ID.
|
|
106 |
* @param aPos Softkey position.
|
|
107 |
* @param aEnable ETrue for set icon, EFalse for use default icon.
|
|
108 |
*/
|
|
109 |
virtual void SetSoftKeyImageL( const TAknsItemID& aId,
|
|
110 |
const TDesC& aBmpFile,
|
|
111 |
const TInt32 aBmp,
|
|
112 |
const TInt32 aBmpM,
|
|
113 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
114 |
TBool aEnable ) = 0;
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Sets softkey text.
|
|
118 |
* @since Series 60 3.2
|
|
119 |
* @param aText Text to draw
|
|
120 |
* @param aPos Softkey position
|
|
121 |
*/
|
|
122 |
virtual void SetSoftKeyTextL( const TDesC& aText,
|
|
123 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;
|
|
124 |
|
|
125 |
/**
|
|
126 |
* Sets softkey.
|
|
127 |
* @param aNode Softey node.
|
|
128 |
* @param aPos Softkey position.
|
|
129 |
*/
|
|
130 |
virtual void SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode,
|
|
131 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Returns currently visible softkey node.
|
|
135 |
* @param aPos Softkey position.
|
|
136 |
* @return Currently visible softkey.
|
|
137 |
*/
|
|
138 |
virtual CXnNodePluginIf* SoftKeyL( XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos ) = 0;
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Returns softkey node, which should handle key event.
|
|
142 |
* @return softkey node which should handle key event, NULL if not available.
|
|
143 |
*/
|
|
144 |
virtual CXnNodePluginIf* KeyEventNode() = 0;
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Sets MXnMenuObserver observer
|
|
148 |
* @since S60 5.1
|
|
149 |
* @param aObserver observer to set
|
|
150 |
*/
|
|
151 |
virtual void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver ) = 0;
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Removes the observer
|
|
155 |
* @since S60 5.1
|
|
156 |
*/
|
|
157 |
virtual void RemoveObserver() = 0;
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Tries to display menubar
|
|
161 |
* @since S60 5.2
|
|
162 |
* @param aMenuNodeId the menu node id
|
|
163 |
* @param aContextMenu ETrue if context menu should be displayed, EFalse otherwise
|
|
164 |
*/
|
|
165 |
virtual void TryDisplayingMenuBarL( const TDesC& aMenuNodeId, TBool aContextMenu ) = 0;
|
|
166 |
};
|
|
167 |
}
|
|
168 |
|
|
169 |
class CXnMenu : public CXnComponent, public XnMenuInterface::MXnMenuInterface
|
|
170 |
{
|
|
171 |
public: // Constructors and destructor
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Two-phased constructor.
|
|
175 |
*/
|
|
176 |
static CXnMenu* NewL();
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Destructor.
|
|
180 |
*/
|
|
181 |
virtual ~CXnMenu();
|
|
182 |
|
|
183 |
protected: // New functions
|
|
184 |
|
|
185 |
/**
|
|
186 |
* @see MXnMenuInterface::SetSoftKeyImage
|
|
187 |
*/
|
|
188 |
void SetSoftKeyImageL(
|
|
189 |
CFbsBitmap* aBitmap,
|
|
190 |
CFbsBitmap* aMask,
|
|
191 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
192 |
TBool aPreserveAspectRatio, TBool aInvertMask,
|
|
193 |
TBool aTransferOwnership = ETrue );
|
|
194 |
|
|
195 |
void SetSoftKeyImageL(
|
|
196 |
CFbsBitmap* aBitmap,
|
|
197 |
CFbsBitmap* aMask,
|
|
198 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
199 |
CXnNodeAppIf* aNode,
|
|
200 |
TBool aPreserveAspectRatio, TBool aInvertMask,
|
|
201 |
TBool aTransferOwnership = ETrue );
|
|
202 |
|
|
203 |
/**
|
|
204 |
* @see MXnMenuInterface::SetSoftKeyImage
|
|
205 |
*/
|
|
206 |
void SetSoftKeyImageL( const TAknsItemID& aId,
|
|
207 |
const TDesC& aBmpFile,
|
|
208 |
const TInt32 aBmp,
|
|
209 |
const TInt32 aBmpM,
|
|
210 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos,
|
|
211 |
TBool aEnable );
|
|
212 |
|
|
213 |
/**
|
|
214 |
* @see MXnMenuInterface::SetSoftkeyTextL
|
|
215 |
*/
|
|
216 |
void SetSoftKeyTextL( const TDesC& aText,
|
|
217 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
|
|
218 |
|
|
219 |
/**
|
|
220 |
* @see MXnMenuInterface::SetSoftKeyL
|
|
221 |
*/
|
|
222 |
void SetSoftKeyL( CXnNodePluginIf* aSoftkeyNode,
|
|
223 |
XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
|
|
224 |
|
|
225 |
/**
|
|
226 |
* @see MXnMenuInterface::SoftKeyL
|
|
227 |
*/
|
|
228 |
CXnNodePluginIf* SoftKeyL( XnMenuInterface::MXnMenuInterface::TSoftKeyPosition aPos );
|
|
229 |
|
|
230 |
/**
|
|
231 |
* @see MXnMenuInterface::KeyEventNode
|
|
232 |
*/
|
|
233 |
CXnNodePluginIf* KeyEventNode();
|
|
234 |
|
|
235 |
/**
|
|
236 |
* @see MXnMenuInterface::SetObserver
|
|
237 |
*/
|
|
238 |
void SetObserver( XnMenuInterface::MXnMenuObserver& aObserver );
|
|
239 |
|
|
240 |
/**
|
|
241 |
* @see MXnMenuInterface::RemoveObserver
|
|
242 |
*/
|
|
243 |
void RemoveObserver();
|
|
244 |
|
|
245 |
/**
|
|
246 |
* @see MXnMenuInterface::TryDisplayingMenuBarL
|
|
247 |
*/
|
|
248 |
void TryDisplayingMenuBarL( const TDesC& aMenuNodeId, TBool aContextMenu );
|
|
249 |
|
|
250 |
/**
|
|
251 |
* @see MXnComponentInterface::MakeInterfaceL
|
|
252 |
*/
|
|
253 |
XnComponentInterface::MXnComponentInterface* MakeInterfaceL( const TDesC8& aType );
|
|
254 |
|
|
255 |
private:
|
|
256 |
|
|
257 |
/**
|
|
258 |
* C++ default constructor.
|
|
259 |
*/
|
|
260 |
CXnMenu();
|
|
261 |
|
|
262 |
/**
|
|
263 |
* By default Symbian 2nd phase constructor is private.
|
|
264 |
*/
|
|
265 |
void ConstructL();
|
|
266 |
};
|
|
267 |
|
|
268 |
#endif // _XNMENU_H
|
|
269 |
|
|
270 |
// End of File
|