williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__EIKMENUP_H__)
|
williamr@2
|
20 |
#define __EIKMENUP_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#if !defined(__EIKBCTRL_H__)
|
williamr@2
|
23 |
#include <eikbctrl.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#if !defined(__EIKDEF_H__)
|
williamr@2
|
27 |
#include <eikdef.h>
|
williamr@2
|
28 |
#endif
|
williamr@2
|
29 |
|
williamr@2
|
30 |
#if !defined(__EIKSBOBS_H__)
|
williamr@2
|
31 |
#include <eiksbobs.h> // for TEikScrollEvent
|
williamr@2
|
32 |
#endif
|
williamr@2
|
33 |
|
williamr@2
|
34 |
#include <bidi.h>
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// FORWARD DECLARATIONS
|
williamr@2
|
37 |
class MEikMenuObserver;
|
williamr@2
|
38 |
class CEikHotKeyTable;
|
williamr@2
|
39 |
class CEikMenuPaneTitle;
|
williamr@2
|
40 |
class CEikButtonBase;
|
williamr@2
|
41 |
class CEikScrollBarFrame;
|
williamr@2
|
42 |
class CEikScrollBar;
|
williamr@2
|
43 |
class TEikScrollBarModel;
|
williamr@2
|
44 |
class CGulIcon;
|
williamr@2
|
45 |
class CEikMenuPaneExtension ;
|
williamr@4
|
46 |
class CEikCba;
|
williamr@4
|
47 |
class CAknItemActionMenuData;
|
williamr@2
|
48 |
|
williamr@2
|
49 |
// CONSTANTS
|
williamr@2
|
50 |
const TInt KScaleableTextSeparator = 0x0001;
|
williamr@2
|
51 |
|
williamr@2
|
52 |
/**
|
williamr@2
|
53 |
* A helper class for extending CEikMenuPaneItem without breaking binary
|
williamr@2
|
54 |
* compability.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
class CExtendedItemData : public CBase
|
williamr@2
|
57 |
{
|
williamr@2
|
58 |
|
williamr@2
|
59 |
public:
|
williamr@2
|
60 |
|
williamr@2
|
61 |
/**
|
williamr@2
|
62 |
* Destructor.
|
williamr@2
|
63 |
*/
|
williamr@2
|
64 |
~CExtendedItemData();
|
williamr@2
|
65 |
|
williamr@2
|
66 |
public:
|
williamr@2
|
67 |
|
williamr@2
|
68 |
/** Two packaked bitmaps: bitmap icon and mask for it. */
|
williamr@2
|
69 |
CGulIcon* iIcon;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/** Scalable text buffer. */
|
williamr@2
|
72 |
HBufC* iScaleableText;
|
williamr@2
|
73 |
};
|
williamr@2
|
74 |
|
williamr@2
|
75 |
|
williamr@2
|
76 |
/**
|
williamr@2
|
77 |
* The @c CEikMenuPaneItem class encapsulates the data needed to define a menu
|
williamr@2
|
78 |
* pane item and provides some of the functionality required to display the
|
williamr@2
|
79 |
* item.
|
williamr@2
|
80 |
*
|
williamr@2
|
81 |
* @since ER5U
|
williamr@2
|
82 |
*/
|
williamr@2
|
83 |
class CEikMenuPaneItem : public CBase
|
williamr@2
|
84 |
{
|
williamr@2
|
85 |
|
williamr@2
|
86 |
public:
|
williamr@2
|
87 |
|
williamr@2
|
88 |
/** Struct to menu pane item. */
|
williamr@2
|
89 |
struct SData
|
williamr@2
|
90 |
{
|
williamr@2
|
91 |
|
williamr@2
|
92 |
/** Nominal text length.*/
|
williamr@2
|
93 |
enum { ENominalTextLength=40 };
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
* ID of the command to issue when the menu item using this @c SData is
|
williamr@2
|
97 |
* selected.
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
TInt iCommandId;
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/** Resource ID of a menu pane to cascade from this item. */
|
williamr@2
|
102 |
TInt iCascadeId;
|
williamr@2
|
103 |
|
williamr@2
|
104 |
/**
|
williamr@2
|
105 |
* Flags used internally by @c CEikMenuPane and accessible through
|
williamr@2
|
106 |
* functions such as @c CEikMenuPane::SetItemDimmed().
|
williamr@2
|
107 |
*/
|
williamr@2
|
108 |
TInt iFlags;
|
williamr@2
|
109 |
|
williamr@2
|
110 |
/** The text buffer displayed in the main area of the menu item. */
|
williamr@2
|
111 |
TBuf<ENominalTextLength> iText; // less than this actually stored
|
williamr@2
|
112 |
|
williamr@2
|
113 |
/**
|
williamr@2
|
114 |
* Additional descriptive text about the item. This is used by @c
|
williamr@2
|
115 |
* CEikMenuPane to display hotkey names.
|
williamr@2
|
116 |
*/
|
williamr@2
|
117 |
TBuf<1> iExtraText;
|
williamr@2
|
118 |
};
|
williamr@2
|
119 |
|
williamr@2
|
120 |
public:
|
williamr@2
|
121 |
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
* C++ default constructor.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
IMPORT_C CEikMenuPaneItem();
|
williamr@2
|
126 |
|
williamr@2
|
127 |
/**
|
williamr@2
|
128 |
* Destructor.
|
williamr@2
|
129 |
*/
|
williamr@2
|
130 |
IMPORT_C ~CEikMenuPaneItem();
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/**
|
williamr@2
|
133 |
* Sets a menu item icon. This replaces any icon already set for the menu
|
williamr@2
|
134 |
* item.
|
williamr@2
|
135 |
*
|
williamr@2
|
136 |
* @param aIcon Menu item icon consisting of a picture bitmap and a mask
|
williamr@2
|
137 |
* bitmap.
|
williamr@2
|
138 |
*/
|
williamr@2
|
139 |
IMPORT_C void SetIcon(CGulIcon* aIcon);
|
williamr@2
|
140 |
|
williamr@2
|
141 |
/**
|
williamr@2
|
142 |
* Draws the menu item icon.
|
williamr@2
|
143 |
*
|
williamr@2
|
144 |
* @param aGc Graphics context to which the icon is drawn.
|
williamr@2
|
145 |
* @param aRect Rectangle in which the icon is drawn.
|
williamr@2
|
146 |
* @param aDimmed If @c ETrue the icon is drawn dimmed.
|
williamr@2
|
147 |
* @param aBitmapSpaceRequired Length of one side of the square required to
|
williamr@2
|
148 |
* contain the bitmap.
|
williamr@2
|
149 |
*/
|
williamr@2
|
150 |
IMPORT_C void DrawItemIcon(CWindowGc& aGc,
|
williamr@2
|
151 |
TRect aRect,
|
williamr@2
|
152 |
TBool aDimmed,
|
williamr@2
|
153 |
TInt aBitmapSpaceRequired) const;
|
williamr@2
|
154 |
|
williamr@2
|
155 |
/**
|
williamr@2
|
156 |
* Construct an icon from bitmaps.
|
williamr@2
|
157 |
*
|
williamr@2
|
158 |
* Constructs a new icon for the menu item, taking ownership of the picture
|
williamr@2
|
159 |
* bitmap aBitmap and the mask bitmap aMask unless the bitmaps are
|
williamr@2
|
160 |
* externally owned.
|
williamr@2
|
161 |
*
|
williamr@2
|
162 |
* @param aBitmap Picture bitmap.
|
williamr@2
|
163 |
* @param aMask Mask bitmap.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C void CreateIconL(CFbsBitmap* aBitmap,
|
williamr@2
|
166 |
CFbsBitmap* aMask);
|
williamr@2
|
167 |
|
williamr@2
|
168 |
/**
|
williamr@2
|
169 |
* Gets a pointer to the menu item's icon picture bitmap. This does not
|
williamr@2
|
170 |
* imply transfer of ownership.
|
williamr@2
|
171 |
*
|
williamr@2
|
172 |
* @return Picture bitmap.
|
williamr@2
|
173 |
*/
|
williamr@2
|
174 |
IMPORT_C CFbsBitmap* IconBitmap() const;
|
williamr@2
|
175 |
|
williamr@2
|
176 |
/**
|
williamr@2
|
177 |
* Gets a pointer to the menu item's icon mask bitmap. This does not imply
|
williamr@2
|
178 |
* transfer of ownership.
|
williamr@2
|
179 |
*
|
williamr@2
|
180 |
* @return Mask bitmap.
|
williamr@2
|
181 |
*/
|
williamr@2
|
182 |
IMPORT_C CFbsBitmap* IconMask() const;
|
williamr@2
|
183 |
|
williamr@2
|
184 |
/**
|
williamr@2
|
185 |
* Sets icon bitmap ownership.
|
williamr@2
|
186 |
* Sets the menu item's icon bitmaps as externally owned if @c
|
williamr@2
|
187 |
* aOwnedExternally is @c ETrue.
|
williamr@2
|
188 |
*
|
williamr@2
|
189 |
* @param aOwnedExternally If @c ETrue bitmaps are set as externally owned.
|
williamr@2
|
190 |
* @c If EFalse bitmaps are set as not being externally owned.
|
williamr@2
|
191 |
*/
|
williamr@2
|
192 |
IMPORT_C void SetBitmapsOwnedExternally(TBool aOwnedExternally);
|
williamr@2
|
193 |
|
williamr@2
|
194 |
/**
|
williamr@2
|
195 |
* Sets the picture bitmap. Transfers ownership unless the bitmaps are
|
williamr@2
|
196 |
* already owned externally.
|
williamr@2
|
197 |
*
|
williamr@2
|
198 |
* @param aBitmap Picture bitmap.
|
williamr@2
|
199 |
*/
|
williamr@2
|
200 |
IMPORT_C void SetIconBitmapL(CFbsBitmap* aBitmap);
|
williamr@2
|
201 |
|
williamr@2
|
202 |
/**
|
williamr@2
|
203 |
* Sets the mask bitmap. Transfers ownership unless the bitmaps are already
|
williamr@2
|
204 |
* owned externally.
|
williamr@2
|
205 |
*
|
williamr@2
|
206 |
* @param aMask Mask bitmap.
|
williamr@2
|
207 |
*/
|
williamr@2
|
208 |
IMPORT_C void SetIconMaskL(CFbsBitmap* aMask);
|
williamr@2
|
209 |
|
williamr@2
|
210 |
/**
|
williamr@2
|
211 |
* Returns scaleable text. If there isn't scaleable text available then
|
williamr@2
|
212 |
* this method returns @c iData.iText.
|
williamr@2
|
213 |
*
|
williamr@2
|
214 |
* @return Pointer to TPtrC object that contains scaleable text.
|
williamr@2
|
215 |
*/
|
williamr@2
|
216 |
IMPORT_C TPtrC ScaleableText() const;
|
williamr@2
|
217 |
|
williamr@2
|
218 |
/**
|
williamr@2
|
219 |
* Sets scaleable text. @c iData.iText is set to first text version.
|
williamr@2
|
220 |
*
|
williamr@2
|
221 |
* @param aText Scalable text.
|
williamr@2
|
222 |
*/
|
williamr@2
|
223 |
IMPORT_C void SetScaleableTextL(const TDesC& aText);
|
williamr@2
|
224 |
|
williamr@2
|
225 |
private:
|
williamr@2
|
226 |
inline void CreateExtendedDataBlock();
|
williamr@2
|
227 |
inline TBool IsScaleableText(const TDesC& aText) const;
|
williamr@2
|
228 |
TPtrC GetNominalText(const TDesC& aText);
|
williamr@2
|
229 |
|
williamr@2
|
230 |
public:
|
williamr@2
|
231 |
|
williamr@2
|
232 |
/** The y position of the menu pane item. */
|
williamr@2
|
233 |
TInt iPos;
|
williamr@2
|
234 |
|
williamr@2
|
235 |
/** The menu pane item's hotkey text. */
|
williamr@2
|
236 |
TInt iHotKeyCode;
|
williamr@2
|
237 |
|
williamr@2
|
238 |
/** Information from an SData struct. */
|
williamr@2
|
239 |
SData iData;
|
williamr@2
|
240 |
|
williamr@2
|
241 |
private:
|
williamr@2
|
242 |
CExtendedItemData* iExtendedData;
|
williamr@2
|
243 |
};
|
williamr@2
|
244 |
|
williamr@2
|
245 |
|
williamr@2
|
246 |
inline void CEikMenuPaneItem::CreateExtendedDataBlock()
|
williamr@2
|
247 |
{
|
williamr@2
|
248 |
if (!iExtendedData)
|
williamr@2
|
249 |
{
|
williamr@2
|
250 |
TRAPD(err, ( iExtendedData = new (ELeave) CExtendedItemData() ) );
|
williamr@2
|
251 |
}
|
williamr@2
|
252 |
}
|
williamr@2
|
253 |
|
williamr@2
|
254 |
|
williamr@2
|
255 |
inline TBool CEikMenuPaneItem::IsScaleableText(const TDesC& aText) const
|
williamr@2
|
256 |
{
|
williamr@4
|
257 |
return aText.Locate( TChar( KScaleableTextSeparator ) ) != KErrNotFound;
|
williamr@2
|
258 |
}
|
williamr@2
|
259 |
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* Menu panes are opened by activating the menu title
|
williamr@2
|
263 |
* @c (CEikMenuPaneTitle / MENU_TITLE) which is displayed in the menu bar @c
|
williamr@2
|
264 |
* (CEikMenuBar / MENU_BAR). They can also be cascaded from a menu item @c
|
williamr@2
|
265 |
* (CEikMenuPaneItem / MENU_ITEM) or launched by a menu button @c
|
williamr@2
|
266 |
* (CEikMenuButton).
|
williamr@2
|
267 |
*
|
williamr@2
|
268 |
* Menu panes may be defined using a @c MENU_PANE resource.
|
williamr@2
|
269 |
*/
|
williamr@2
|
270 |
class CEikMenuPane : public CEikBorderedControl
|
williamr@2
|
271 |
{
|
williamr@2
|
272 |
private:
|
williamr@2
|
273 |
enum {ENothingSelected=-1};
|
williamr@2
|
274 |
class CMenuScroller;
|
williamr@2
|
275 |
friend class CMenuScroller;
|
williamr@2
|
276 |
friend class CEikMenuPaneExtension;
|
williamr@2
|
277 |
public:
|
williamr@2
|
278 |
|
williamr@2
|
279 |
/** The text to be displayed for a hotkey. */
|
williamr@2
|
280 |
typedef TBuf<20> THotKeyDisplayText;
|
williamr@2
|
281 |
|
williamr@2
|
282 |
public:
|
williamr@2
|
283 |
|
williamr@2
|
284 |
/**
|
williamr@2
|
285 |
* This class provides a constructor to create an array of menu pane items
|
williamr@2
|
286 |
* and a destructor to destroy an array of menu pane items.
|
williamr@2
|
287 |
*/
|
williamr@2
|
288 |
class CItemArray:public CArrayPtrFlat<CEikMenuPaneItem>
|
williamr@2
|
289 |
{
|
williamr@2
|
290 |
|
williamr@2
|
291 |
public:
|
williamr@2
|
292 |
|
williamr@2
|
293 |
/**
|
williamr@2
|
294 |
* C++ default constructor that creates a flat array of menu pane
|
williamr@2
|
295 |
* items.
|
williamr@2
|
296 |
*/
|
williamr@2
|
297 |
IMPORT_C CItemArray();
|
williamr@2
|
298 |
|
williamr@2
|
299 |
/**
|
williamr@2
|
300 |
* Destructor.
|
williamr@2
|
301 |
*/
|
williamr@2
|
302 |
IMPORT_C ~CItemArray();
|
williamr@2
|
303 |
|
williamr@2
|
304 |
/**
|
williamr@2
|
305 |
* Appends @c CEikMenuPaneItem class object to array.
|
williamr@2
|
306 |
*
|
williamr@2
|
307 |
* @param aMenuItem The menu item to add.
|
williamr@2
|
308 |
*/
|
williamr@2
|
309 |
IMPORT_C void AddItemL(CEikMenuPaneItem* aMenuItem);
|
williamr@2
|
310 |
};
|
williamr@2
|
311 |
|
williamr@2
|
312 |
public:
|
williamr@2
|
313 |
|
williamr@2
|
314 |
/**
|
williamr@2
|
315 |
* Destructor.
|
williamr@2
|
316 |
*/
|
williamr@2
|
317 |
IMPORT_C ~CEikMenuPane();
|
williamr@2
|
318 |
|
williamr@2
|
319 |
/**
|
williamr@2
|
320 |
* C++ default constructor. Constructs a menu pane object with the
|
williamr@2
|
321 |
* specified observer.
|
williamr@2
|
322 |
*
|
williamr@2
|
323 |
* @param aMenuObserver Menu observer.
|
williamr@2
|
324 |
*/
|
williamr@2
|
325 |
IMPORT_C CEikMenuPane(MEikMenuObserver* aMenuObserver);
|
williamr@2
|
326 |
|
williamr@2
|
327 |
/**
|
williamr@2
|
328 |
* Handles 2nd base construction. Completes construction of a menu pane object.
|
williamr@2
|
329 |
*
|
williamr@2
|
330 |
* @param aOwner Menu pane owner ( for cascade menu ).
|
williamr@2
|
331 |
* @param aEditMenuObserver Observer for the edit menu. In default this is
|
williamr@2
|
332 |
* @c NULL.
|
williamr@2
|
333 |
*/
|
williamr@2
|
334 |
IMPORT_C void ConstructL(CEikMenuPane* aOwner,
|
williamr@2
|
335 |
MEikMenuObserver* aEditMenuObserver = NULL);
|
williamr@2
|
336 |
|
williamr@2
|
337 |
/**
|
williamr@2
|
338 |
* Destroys the menu pane's item array.
|
williamr@2
|
339 |
*/
|
williamr@2
|
340 |
IMPORT_C void Reset();
|
williamr@2
|
341 |
|
williamr@2
|
342 |
public: // framework
|
williamr@2
|
343 |
|
williamr@2
|
344 |
/**
|
williamr@2
|
345 |
* From @c CcoeControl.
|
williamr@2
|
346 |
*
|
williamr@2
|
347 |
* Handles key events offered to the menu by the control environment and
|
williamr@2
|
348 |
* provides an appropriate implementation of @c
|
williamr@2
|
349 |
* CCoeControl::OfferKeyEventL().
|
williamr@2
|
350 |
*
|
williamr@2
|
351 |
* @param aKeyEvent The key event.
|
williamr@2
|
352 |
* @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
|
williamr@2
|
353 |
* EEventKeyDown.
|
williamr@2
|
354 |
*/
|
williamr@2
|
355 |
IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
|
williamr@2
|
356 |
TEventCode aType);
|
williamr@2
|
357 |
|
williamr@2
|
358 |
/**
|
williamr@2
|
359 |
* From @c CcoeControl.
|
williamr@2
|
360 |
*
|
williamr@2
|
361 |
* Handles a pointer event on the menu.
|
williamr@2
|
362 |
*
|
williamr@2
|
363 |
* @param aPointerEvent The pointer event to handle.
|
williamr@2
|
364 |
*/
|
williamr@2
|
365 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
366 |
|
williamr@2
|
367 |
/**
|
williamr@2
|
368 |
* From @c CcoeControl.
|
williamr@2
|
369 |
*
|
williamr@2
|
370 |
* Gets the list of logical colours employed in the drawing of the control,
|
williamr@2
|
371 |
* paired with an explanation of how they are used. Appends the list into
|
williamr@2
|
372 |
* @c aColorUseList.
|
williamr@2
|
373 |
*
|
williamr@2
|
374 |
* @since 005u
|
williamr@2
|
375 |
* @param aColorUseList The list of colours paired with explanations.
|
williamr@2
|
376 |
*/
|
williamr@2
|
377 |
IMPORT_C virtual void GetColorUseListL(
|
williamr@2
|
378 |
CArrayFix<TCoeColorUse>& aColorUseList) const;
|
williamr@2
|
379 |
|
williamr@2
|
380 |
/**
|
williamr@2
|
381 |
* From @c CcoeControl.
|
williamr@2
|
382 |
*
|
williamr@2
|
383 |
* Handles a change to the menu's resources which are shared across the
|
williamr@2
|
384 |
* environment. For example, colours or fonts.
|
williamr@2
|
385 |
*
|
williamr@2
|
386 |
* @since 005u
|
williamr@2
|
387 |
* @param aType The type of resource that has changed.
|
williamr@2
|
388 |
*/
|
williamr@2
|
389 |
IMPORT_C virtual void HandleResourceChange(TInt aType); // not available before Release 005u
|
williamr@2
|
390 |
|
williamr@2
|
391 |
private: // from base class
|
williamr@2
|
392 |
|
williamr@2
|
393 |
/**
|
williamr@2
|
394 |
* Not implemented.
|
williamr@2
|
395 |
*
|
williamr@2
|
396 |
* @param Not used.
|
williamr@2
|
397 |
* @return NULL
|
williamr@2
|
398 |
*/
|
williamr@2
|
399 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
400 |
|
williamr@2
|
401 |
public: // from MCoeInputObserver
|
williamr@2
|
402 |
|
williamr@2
|
403 |
/**
|
williamr@2
|
404 |
* From @c CCoeControl.
|
williamr@2
|
405 |
*
|
williamr@2
|
406 |
* Gets the list box’s input capabilities as set through the list box flags.
|
williamr@2
|
407 |
*
|
williamr@2
|
408 |
* @return List box input capabilities.
|
williamr@2
|
409 |
*/
|
williamr@2
|
410 |
IMPORT_C TCoeInputCapabilities InputCapabilities() const;
|
williamr@2
|
411 |
|
williamr@2
|
412 |
protected: // from base class
|
williamr@2
|
413 |
|
williamr@2
|
414 |
/**
|
williamr@2
|
415 |
* From @c CCoeControl
|
williamr@2
|
416 |
*
|
williamr@2
|
417 |
* Draw a control called by window server.
|
williamr@2
|
418 |
*
|
williamr@2
|
419 |
* All controls, except blank controls, should implement this function. The
|
williamr@2
|
420 |
* default implementation draws a blank control. This function is used for
|
williamr@2
|
421 |
* window server-initiated redrawing of controls, and for some
|
williamr@2
|
422 |
* application-initiated drawing. It should be implemented by each control,
|
williamr@2
|
423 |
* but is only called from within @c CCoeControl's member functions, and
|
williamr@2
|
424 |
* not from the derived class. For this reason it is a private member
|
williamr@2
|
425 |
* function of @c CCoeControl.
|
williamr@2
|
426 |
*
|
williamr@2
|
427 |
* The rectangle aRect indicates the region of the control that needs to be
|
williamr@2
|
428 |
* redrawn. The implementation of @c Draw() must always draw to every pixel
|
williamr@2
|
429 |
* within this rectangle.
|
williamr@2
|
430 |
*
|
williamr@2
|
431 |
* @param aRect The region of the control to be redrawn.
|
williamr@2
|
432 |
* Co-ordinates are relative to the control's origin (top left
|
williamr@2
|
433 |
* corner). Optional, not used currently.
|
williamr@2
|
434 |
*/
|
williamr@2
|
435 |
IMPORT_C void Draw(const TRect& aRect) const;
|
williamr@2
|
436 |
|
williamr@2
|
437 |
/**
|
williamr@2
|
438 |
* From @c CCoeControl.
|
williamr@2
|
439 |
*
|
williamr@2
|
440 |
* Takes any action required when the menu pane gains or loses focus,
|
williamr@2
|
441 |
* to change its appearance for example.
|
williamr@2
|
442 |
*
|
williamr@2
|
443 |
* @param aDrawNow If @c EDrawNow the menu pane is redrawn. If @c
|
williamr@2
|
444 |
* ENoDrawNow the menu pane is not redrawn.
|
williamr@2
|
445 |
*/
|
williamr@2
|
446 |
IMPORT_C void FocusChanged(TDrawNow aDrawNow);
|
williamr@2
|
447 |
|
williamr@2
|
448 |
/**
|
williamr@2
|
449 |
* From @c CCoeControl.
|
williamr@2
|
450 |
*
|
williamr@2
|
451 |
* Constructs the menu pane using the specified resource reader.
|
williamr@2
|
452 |
* Fills the menu item array with the list of menu items provided by the
|
williamr@2
|
453 |
* resource file.
|
williamr@2
|
454 |
*
|
williamr@2
|
455 |
* @param aReader The resource reader to use.
|
williamr@2
|
456 |
* @leave KErrNoMemory Memory allocation failure earlier construction.
|
williamr@2
|
457 |
*/
|
williamr@2
|
458 |
IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
|
williamr@2
|
459 |
|
williamr@2
|
460 |
public: // new functions
|
williamr@2
|
461 |
|
williamr@2
|
462 |
/**
|
williamr@2
|
463 |
* Adds a menu item dynamically by creating a new menu item, setting its
|
williamr@2
|
464 |
* data to @c aMenuItem and appending it to the pane's menu item array.
|
williamr@2
|
465 |
* Updates the menu's scroll bar to take account of the new item.
|
williamr@2
|
466 |
*
|
williamr@2
|
467 |
* @param aMenuItem The menu item to add.
|
williamr@2
|
468 |
* NOTICE that @c SData is a structure so all fields in it should be
|
williamr@2
|
469 |
* set to avoid any unexpected behaviour.
|
williamr@2
|
470 |
*/
|
williamr@2
|
471 |
IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem);
|
williamr@2
|
472 |
|
williamr@2
|
473 |
/**
|
williamr@2
|
474 |
* Adds a menu item dynamically by creating a new menu item, setting its
|
williamr@2
|
475 |
* data to @c aMenuItem and inserting it into the pane's menu item array.
|
williamr@2
|
476 |
* Updates the menu's scroll bar to take account of the new item.
|
williamr@2
|
477 |
*
|
williamr@2
|
478 |
* @param aMenuItem The menu item to add. NOTICE that @c SData is a
|
williamr@2
|
479 |
* structure so all fields in it should be set to avoid any
|
williamr@2
|
480 |
* unexpected behaviour.
|
williamr@2
|
481 |
* @param aPreviousId The id of the item after which the new item should be
|
williamr@2
|
482 |
* added.
|
williamr@2
|
483 |
*/
|
williamr@2
|
484 |
IMPORT_C void AddMenuItemL(const CEikMenuPaneItem::SData& aMenuItem,
|
williamr@2
|
485 |
TInt aPreviousId);
|
williamr@2
|
486 |
|
williamr@2
|
487 |
/**
|
williamr@2
|
488 |
* Adds menu items dynamically by creating new menu items from resource
|
williamr@2
|
489 |
* and inserts them into the pane's menu item array.
|
williamr@2
|
490 |
*
|
williamr@2
|
491 |
* @param aResourceId The ID of the resource for the menu item.
|
williamr@2
|
492 |
* @param aPreviousId The ID of the previous menu item, after which this
|
williamr@2
|
493 |
* newly created item should be added.
|
williamr@2
|
494 |
* @param aAddSeperator Shouldn't be used as separator is not not supported
|
williamr@2
|
495 |
* anymore.
|
williamr@2
|
496 |
*/
|
williamr@2
|
497 |
IMPORT_C void AddMenuItemsL(TInt aResourceId,
|
williamr@2
|
498 |
TInt aPreviousId = 0,
|
williamr@2
|
499 |
TBool aAddSeperator = EFalse);
|
williamr@2
|
500 |
|
williamr@2
|
501 |
/**
|
williamr@2
|
502 |
* Deletes the specified item in the menu pane.
|
williamr@2
|
503 |
*
|
williamr@2
|
504 |
* @param aCommandId The ID for the item to be deleted.
|
williamr@2
|
505 |
*/
|
williamr@2
|
506 |
IMPORT_C void DeleteMenuItem(TInt aCommandId);
|
williamr@2
|
507 |
|
williamr@2
|
508 |
/**
|
williamr@2
|
509 |
* Deletes the items between specified items.
|
williamr@2
|
510 |
*
|
williamr@2
|
511 |
* @param aStartIndex The index of the item after which items should be
|
williamr@2
|
512 |
* deleted.
|
williamr@2
|
513 |
* @param aEndIndex The index of the item up to which items should be
|
williamr@2
|
514 |
* deleted.
|
williamr@2
|
515 |
*/
|
williamr@2
|
516 |
IMPORT_C void DeleteBetweenMenuItems(TInt aStartIndex,
|
williamr@2
|
517 |
TInt aEndIndex);
|
williamr@2
|
518 |
|
williamr@2
|
519 |
/**
|
williamr@2
|
520 |
* Gets a reference to the data in the specified menu item.
|
williamr@2
|
521 |
*
|
williamr@2
|
522 |
* @param aCommandId The command ID of the menu item for which data is
|
williamr@2
|
523 |
* obtained.
|
williamr@2
|
524 |
* @return Reference to struct that contains command id.
|
williamr@2
|
525 |
*/
|
williamr@2
|
526 |
IMPORT_C CEikMenuPaneItem::SData& ItemData(TInt aCommandId);
|
williamr@2
|
527 |
|
williamr@2
|
528 |
/**
|
williamr@2
|
529 |
* Gets a pointer to the specified menu item. Also gets the position of the
|
williamr@2
|
530 |
* item within the menu pane. Panics if there are no menu items in the menu
|
williamr@2
|
531 |
* pane. Panics if the menu pane id does not identify any menu pane item in
|
williamr@2
|
532 |
* the array.
|
williamr@2
|
533 |
*
|
williamr@2
|
534 |
* @param aCommandId The ID of the menu item for which a pointer is
|
williamr@2
|
535 |
* returned.
|
williamr@2
|
536 |
* @param aPos On return, the position of the menu item with an ID of
|
williamr@2
|
537 |
* aCommandId.
|
williamr@2
|
538 |
* @return A pointer to the menu item.
|
williamr@2
|
539 |
* @panic EEikPanicNoSuchMenuItem Panics if there are no menu items in the
|
williamr@2
|
540 |
* menu pane or if the menu pane id does not
|
williamr@2
|
541 |
* identify any menu pane item in the array.
|
williamr@2
|
542 |
*/
|
williamr@2
|
543 |
IMPORT_C CEikMenuPaneItem* ItemAndPos(TInt aCommandId,TInt& aPos);
|
williamr@2
|
544 |
|
williamr@2
|
545 |
/**
|
williamr@2
|
546 |
* Displays the menu pane with the corner identified by @c aTargetType in
|
williamr@2
|
547 |
* the position specified by @c aTargetPos. This function uses @c
|
williamr@2
|
548 |
* aMinTitleWidth to calculate the area required to display the menu pane,
|
williamr@2
|
549 |
* taking into account whether the menu is a cascading menu or popup menu.
|
williamr@2
|
550 |
*
|
williamr@2
|
551 |
* @param aHotKeyTable Optional hotkey table.
|
williamr@2
|
552 |
* @param aTargetPos Position of the corner of the menu pane identified by
|
williamr@2
|
553 |
* @c aTargetType.
|
williamr@2
|
554 |
* @param aMenuPaneTitle The menu pane's title.
|
williamr@2
|
555 |
* @param aMinWidth Minimum width of the menu's title.
|
williamr@2
|
556 |
* @param aTargetType The corner of the menu pane to which @c aTargetPos
|
williamr@2
|
557 |
* relates. The default is the top left corner. Possible: @c
|
williamr@2
|
558 |
* EPopupTargetTopLeft, @c EPopupTargetTopRight,
|
williamr@2
|
559 |
* @cEPopupTargetBottomLeft, @c EPopupTargetBottomRight.
|
williamr@2
|
560 |
*/
|
williamr@2
|
561 |
IMPORT_C void StartDisplayingMenuPane(
|
williamr@2
|
562 |
const CEikHotKeyTable* aHotKeyTable,
|
williamr@2
|
563 |
const TPoint& aTargetPos,
|
williamr@2
|
564 |
const CEikMenuPaneTitle* aMenuPaneTitle,
|
williamr@2
|
565 |
TInt aMinWidth,
|
williamr@2
|
566 |
TPopupTargetPosType aTargetType = EPopupTargetTopLeft);
|
williamr@2
|
567 |
|
williamr@2
|
568 |
/**
|
williamr@2
|
569 |
* Sets the text in a menu item.
|
williamr@2
|
570 |
*
|
williamr@2
|
571 |
* @param aCommandId The command (as defined in an .hrh file) associated
|
williamr@2
|
572 |
* with this menu item. This identifies the menu item whose text is
|
williamr@2
|
573 |
* to be set.
|
williamr@2
|
574 |
* @param aDes New item text.
|
williamr@2
|
575 |
*/
|
williamr@2
|
576 |
IMPORT_C void SetItemTextL(TInt aCommandId,
|
williamr@2
|
577 |
const TDesC& aDes);
|
williamr@2
|
578 |
|
williamr@2
|
579 |
/**
|
williamr@2
|
580 |
* Sets the text in a menu item from resource.
|
williamr@2
|
581 |
*
|
williamr@2
|
582 |
* @param aCommandId The command (as defined in an .hrh file) associated
|
williamr@2
|
583 |
* with this menu item. This identifies the menu item whose text is
|
williamr@2
|
584 |
* to be set.
|
williamr@2
|
585 |
* @param aRid The resource ID of the menu item text.
|
williamr@2
|
586 |
*/
|
williamr@2
|
587 |
IMPORT_C void SetItemTextL(TInt aCommandId,
|
williamr@2
|
588 |
TInt aRid);
|
williamr@2
|
589 |
|
williamr@2
|
590 |
/**
|
williamr@2
|
591 |
* Dims (greys out) or undims a menu item. Dimming indicates that user
|
williamr@2
|
592 |
* input is not accepted.
|
williamr@2
|
593 |
*
|
williamr@2
|
594 |
* @param aCommandId The command (as defined in an .hrh file) associated
|
williamr@2
|
595 |
* with this menu item. This identifies the menu item whose text is
|
williamr@2
|
596 |
* to be dimmed or un-dimmed.
|
williamr@2
|
597 |
* @param aDimmed @c ETrue to dim this menu item. @c EFalse to un-dim this
|
williamr@2
|
598 |
* menu item.
|
williamr@2
|
599 |
*/
|
williamr@2
|
600 |
IMPORT_C void SetItemDimmed(TInt aCommandId,
|
williamr@2
|
601 |
TBool aDimmed);
|
williamr@2
|
602 |
|
williamr@2
|
603 |
/**
|
williamr@2
|
604 |
* Sets the item to be indicated or not. It should be used to change the
|
williamr@2
|
605 |
* state of radio buttons or check box items. It has real effect only
|
williamr@2
|
606 |
* starting from S60 v3.0.
|
williamr@2
|
607 |
*
|
williamr@2
|
608 |
* @param aCommandId The command (as defined in an .hrh file) associated
|
williamr@2
|
609 |
* with this menu item. This identifies the menu item for which the
|
williamr@2
|
610 |
* state is set or unset.
|
williamr@2
|
611 |
* @param aButtonState should be @c EEikMenuItemSymbolOn or @c
|
williamr@2
|
612 |
* EEikMenuItemSymbolIndeterminate
|
williamr@2
|
613 |
*/
|
williamr@2
|
614 |
IMPORT_C void SetItemButtonState(TInt aCommandId,
|
williamr@2
|
615 |
TInt aButtonState);
|
williamr@2
|
616 |
|
williamr@2
|
617 |
/**
|
williamr@2
|
618 |
* Sets the selected menu item.
|
williamr@2
|
619 |
*
|
williamr@2
|
620 |
* @param aSelectedItem The index of the item to get selected
|
williamr@2
|
621 |
*/
|
williamr@2
|
622 |
IMPORT_C void SetSelectedItem(TInt aSelectedItem);
|
williamr@2
|
623 |
|
williamr@2
|
624 |
/**
|
williamr@2
|
625 |
* Gets the position of the selected menu item.
|
williamr@2
|
626 |
*
|
williamr@2
|
627 |
* @return The position of the selected menu item.
|
williamr@2
|
628 |
*/
|
williamr@2
|
629 |
IMPORT_C TInt SelectedItem() const;
|
williamr@2
|
630 |
|
williamr@2
|
631 |
/**
|
williamr@2
|
632 |
* Closes and destroys any current cascade menu and takes focus back. Does
|
williamr@2
|
633 |
* nothing if no cascade menu exists.
|
williamr@2
|
634 |
*/
|
williamr@2
|
635 |
IMPORT_C void CloseCascadeMenu();
|
williamr@2
|
636 |
|
williamr@2
|
637 |
/**
|
williamr@2
|
638 |
* Sets the array containing the list of menu items for the current menu
|
williamr@2
|
639 |
* pane.
|
williamr@2
|
640 |
*
|
williamr@2
|
641 |
* @param aItemArray The menu item array for the menu pane.
|
williamr@2
|
642 |
*/
|
williamr@2
|
643 |
IMPORT_C void SetItemArray(CItemArray* aItemArray);
|
williamr@2
|
644 |
|
williamr@2
|
645 |
/**
|
williamr@2
|
646 |
* Set menu item array ownership.
|
williamr@2
|
647 |
*
|
williamr@2
|
648 |
* @param aOwnedExternally If @c ETrue the menu pane's menu item array is
|
williamr@2
|
649 |
* set as externally owned. If @c EFalse the menu pane's menu item
|
williamr@2
|
650 |
* array is set as not externally owned.
|
williamr@2
|
651 |
*/
|
williamr@2
|
652 |
IMPORT_C void SetItemArrayOwnedExternally(TBool aOwnedExternally);
|
williamr@2
|
653 |
|
williamr@2
|
654 |
/**
|
williamr@2
|
655 |
* Sets the specified button to launch the menu pane. Doesn't have any
|
williamr@2
|
656 |
* effect in current implementation.
|
williamr@2
|
657 |
*
|
williamr@2
|
658 |
* @param aButton The button to set as launching the menu.
|
williamr@2
|
659 |
*/
|
williamr@2
|
660 |
IMPORT_C void SetLaunchingButton(CEikButtonBase* aButton);
|
williamr@2
|
661 |
|
williamr@2
|
662 |
/**
|
williamr@2
|
663 |
* Moves the menu pane highlight to a newly selected menu item identified
|
williamr@2
|
664 |
* by @c aNewSelectedItem. Scrolls the menu to show the new selected item
|
williamr@2
|
665 |
* if necessary and redraws only the newly selected item and the currently
|
williamr@2
|
666 |
* selected item if possible.
|
williamr@2
|
667 |
*
|
williamr@2
|
668 |
* @param aNewSelectedItem The newly selected menu item index.
|
williamr@2
|
669 |
*/
|
williamr@2
|
670 |
IMPORT_C void MoveHighlightTo(TInt aNewSelectedItem);
|
williamr@2
|
671 |
|
williamr@2
|
672 |
/**
|
williamr@2
|
673 |
* Gets the number of menu items within the menu pane.
|
williamr@2
|
674 |
*
|
williamr@2
|
675 |
* @return Number of menu items within menu pane.
|
williamr@2
|
676 |
*/
|
williamr@2
|
677 |
IMPORT_C TInt NumberOfItemsInPane() const;
|
williamr@2
|
678 |
|
williamr@2
|
679 |
/**
|
williamr@2
|
680 |
* Closes the menu pane.
|
williamr@2
|
681 |
*/
|
williamr@2
|
682 |
IMPORT_C void Close();
|
williamr@2
|
683 |
|
williamr@2
|
684 |
/**
|
williamr@2
|
685 |
* From @ CCoeControl
|
williamr@2
|
686 |
*
|
williamr@2
|
687 |
* Handles key events offered to the menu by the control environment.
|
williamr@2
|
688 |
*
|
williamr@2
|
689 |
* @since Platform 004.
|
williamr@2
|
690 |
* @param aKeyEvent The key event.
|
williamr@2
|
691 |
* @param aType The type of key event: @c EEventKey, @c EEventKeyUp or @c
|
williamr@2
|
692 |
* EEventKeyDown.
|
williamr@2
|
693 |
* @param aConsumeAllKeys If @c ETrue this function returns @c
|
williamr@2
|
694 |
* EKeyWasConsumed regardless of whether it was used. If @c EFalse
|
williamr@2
|
695 |
* the key event is consumed if possible and either @c
|
williamr@2
|
696 |
* EKeyWasConsumed or @c EKeyWasNotConsumed is returned as
|
williamr@2
|
697 |
* appropriate.
|
williamr@2
|
698 |
*/
|
williamr@2
|
699 |
IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
|
williamr@2
|
700 |
TEventCode aType,
|
williamr@2
|
701 |
TBool aConsumeAllKeys); // not available before Platform 004
|
williamr@2
|
702 |
|
williamr@2
|
703 |
/**
|
williamr@2
|
704 |
* Sets whether the scroll bar occupies the left side of the menu pane.
|
williamr@2
|
705 |
*
|
williamr@2
|
706 |
* @param aOnLeft If @c ETrue the scroll bar will occupy the left side of
|
williamr@2
|
707 |
* the menu pane.
|
williamr@2
|
708 |
*/
|
williamr@2
|
709 |
IMPORT_C void SetScrollBarOnLeft(TBool aOnLeft);
|
williamr@2
|
710 |
|
williamr@2
|
711 |
/**
|
williamr@2
|
712 |
* Sets whether the menu pane uses an arrow head scroll bar.
|
williamr@2
|
713 |
*
|
williamr@2
|
714 |
* @param aArrowHead If @c ETrue the menu pane uses an arrow head scroll
|
williamr@2
|
715 |
* bar.
|
williamr@2
|
716 |
*/
|
williamr@2
|
717 |
IMPORT_C void SetArrowHeadScrollBar(TBool aArrowHead);
|
williamr@2
|
718 |
|
williamr@2
|
719 |
// new for AVKON
|
williamr@2
|
720 |
|
williamr@2
|
721 |
/**
|
williamr@2
|
722 |
* Moves highlight to the next item or to the first one if last item is
|
williamr@2
|
723 |
* selected.
|
williamr@2
|
724 |
*/
|
williamr@2
|
725 |
IMPORT_C void NavigateToNextItem();
|
williamr@2
|
726 |
|
williamr@2
|
727 |
/**
|
williamr@2
|
728 |
* Inserts the menu item to the specified position.
|
williamr@2
|
729 |
*
|
williamr@2
|
730 |
* @param aMenuItem The menu item to add. NOTICE @c SData is the structure
|
williamr@2
|
731 |
* and all fileds should be initialized.
|
williamr@2
|
732 |
* @param aPosition The position of newly created item in the array.
|
williamr@2
|
733 |
*/
|
williamr@2
|
734 |
IMPORT_C void InsertMenuItemL(const CEikMenuPaneItem::SData& aMenuItem,
|
williamr@2
|
735 |
TInt aPosition);
|
williamr@2
|
736 |
|
williamr@2
|
737 |
/**
|
williamr@2
|
738 |
* Checks whether menu pane contains the menu item and returns position of
|
williamr@2
|
739 |
* it if the item is found.
|
williamr@2
|
740 |
*
|
williamr@2
|
741 |
* @param[in] aCommandId The command ID of the item to be searched for.
|
williamr@2
|
742 |
* @param[out] aPosition On return contains position of the item.
|
williamr@2
|
743 |
* @return @c ETrue if item was found. Otherwise @c EFalse.
|
williamr@2
|
744 |
*/
|
williamr@2
|
745 |
IMPORT_C TBool MenuItemExists(TInt aCommandId,
|
williamr@2
|
746 |
TInt& aPosition);
|
williamr@2
|
747 |
|
williamr@2
|
748 |
/**
|
williamr@2
|
749 |
* Checks whether the menu pane is a cascade menu or a main menu.
|
williamr@2
|
750 |
*
|
williamr@2
|
751 |
* @return @c ETrue if the menu pane is cascade menu and @c EFalse if the
|
williamr@2
|
752 |
* menu pane is the main menu.
|
williamr@2
|
753 |
*/
|
williamr@2
|
754 |
IMPORT_C TBool IsCascadeMenuPane() const;
|
williamr@2
|
755 |
|
williamr@2
|
756 |
/**
|
williamr@2
|
757 |
* Enables or disables text scrolling functionality. It is disabled by
|
williamr@2
|
758 |
* default.
|
williamr@2
|
759 |
*
|
williamr@2
|
760 |
* @param aEnable @c ETrue to enable text scrolling functionality.
|
williamr@2
|
761 |
*/
|
williamr@2
|
762 |
IMPORT_C void EnableMarqueeL(const TBool aEnable);
|
williamr@2
|
763 |
|
williamr@2
|
764 |
/**
|
williamr@2
|
765 |
* Report that selection was done for the currently highlighted item.
|
williamr@2
|
766 |
*/
|
williamr@2
|
767 |
void ActivateCurrentItemL();
|
williamr@2
|
768 |
|
williamr@2
|
769 |
/**
|
williamr@2
|
770 |
* Closes cascade menu if there is one and it is active.
|
williamr@2
|
771 |
*/
|
williamr@2
|
772 |
TBool CancelActiveMenuPane();
|
williamr@2
|
773 |
|
williamr@2
|
774 |
/**
|
williamr@2
|
775 |
* Deletes dimmed items from the menu item array.
|
williamr@2
|
776 |
*/
|
williamr@2
|
777 |
void FilterDimmedItems();
|
williamr@4
|
778 |
|
williamr@2
|
779 |
/**
|
williamr@2
|
780 |
* Gets the menu pane for the cascade menu.
|
williamr@2
|
781 |
*
|
williamr@2
|
782 |
* @return The menu pane for the cascade menu.
|
williamr@2
|
783 |
*/
|
williamr@2
|
784 |
IMPORT_C CEikMenuPane* CascadeMenuPane();
|
williamr@2
|
785 |
|
williamr@2
|
786 |
/**
|
williamr@2
|
787 |
* Gets a reference to the data in the specified menu item.
|
williamr@2
|
788 |
*
|
williamr@2
|
789 |
* @since S60 3.1
|
williamr@2
|
790 |
* @param aItemIndex The index of the item in the items array.
|
williamr@2
|
791 |
* @return The menu item's data.
|
williamr@2
|
792 |
* @leave KErrArgument Wrong @aItemIndex.
|
williamr@2
|
793 |
*/
|
williamr@2
|
794 |
IMPORT_C CEikMenuPaneItem::SData& ItemDataByIndexL(TInt aItemIndex);
|
williamr@4
|
795 |
|
williamr@2
|
796 |
/**
|
williamr@2
|
797 |
* Creates and enables a special characters row to be used in the edit
|
williamr@2
|
798 |
* menu.
|
williamr@2
|
799 |
*
|
williamr@2
|
800 |
* @since S60 3.1
|
williamr@2
|
801 |
* @param aSpecialChars Buffer that holds the selected characters after
|
williamr@2
|
802 |
* user has selected them.
|
williamr@2
|
803 |
*/
|
williamr@2
|
804 |
IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars );
|
williamr@2
|
805 |
|
williamr@2
|
806 |
/**
|
williamr@2
|
807 |
* Returns the command id of the specified menu item. The function panics
|
williamr@2
|
808 |
* if aIndex doesn't exist or is out of range.
|
williamr@2
|
809 |
* @param aIndex The index of the menu item for which the command ID is returned.
|
williamr@2
|
810 |
* @since 3.1
|
williamr@2
|
811 |
*/
|
williamr@2
|
812 |
IMPORT_C TInt MenuItemCommandId( TInt aIndex ) const;
|
williamr@2
|
813 |
|
williamr@2
|
814 |
/**
|
williamr@2
|
815 |
* Creates and enables a special characters row to be used in the edit menu.
|
williamr@2
|
816 |
* The special character row is constructed from the given special character table.
|
williamr@2
|
817 |
*
|
williamr@2
|
818 |
* @param aSpecialChars Buffer that holds the selected characters after
|
williamr@2
|
819 |
* user has selected them.
|
williamr@2
|
820 |
* @param aResourceId The special character table resource id to define the
|
williamr@2
|
821 |
* characters in the row.
|
williamr@2
|
822 |
*
|
williamr@2
|
823 |
* @since S60 3.1
|
williamr@2
|
824 |
*/
|
williamr@2
|
825 |
IMPORT_C void ConstructMenuSctRowL( TDes& aSpecialChars, TInt aResourceId );
|
williamr@2
|
826 |
|
williamr@2
|
827 |
/**
|
williamr@2
|
828 |
* Creates and enables a special characters row to be used in the edit menu.
|
williamr@2
|
829 |
* The special character row is constructed from the given special character dialog.
|
williamr@2
|
830 |
*
|
williamr@2
|
831 |
* @param aSpecialChars Buffer that holds the selected characters after
|
williamr@2
|
832 |
* user has selected them.
|
williamr@2
|
833 |
* @param aResourceId The special character dialog resource id that contains a special character table
|
williamr@2
|
834 |
*
|
williamr@2
|
835 |
* @since S60 3.2
|
williamr@2
|
836 |
*/
|
williamr@2
|
837 |
IMPORT_C void ConstructMenuSctRowFromDialogL( TDes& aSpecialChars, TInt aResourceId );
|
williamr@2
|
838 |
|
williamr@2
|
839 |
/**
|
williamr@2
|
840 |
* Creates and enables a special characters row to be used in the edit menu.
|
williamr@2
|
841 |
* The special character row is constructed from the given special character dialog.
|
williamr@2
|
842 |
*
|
williamr@2
|
843 |
* @param aCharCase the charcase used by menu sct
|
williamr@2
|
844 |
* @param aSpecialChars Buffer that holds the selected characters after
|
williamr@2
|
845 |
* user has selected them.
|
williamr@2
|
846 |
* @param aResourceId The special character dialog resource id that contains a special character table
|
williamr@2
|
847 |
*
|
williamr@2
|
848 |
* @since S60 3.2
|
williamr@2
|
849 |
*/
|
williamr@2
|
850 |
IMPORT_C void ConstructMenuSctRowFromDialogL( TInt aCharCase, TDes& aSpecialChars, TInt aResourceId );
|
williamr@2
|
851 |
|
williamr@4
|
852 |
/**
|
williamr@4
|
853 |
* Sets menu item as item specific command.
|
williamr@4
|
854 |
*
|
williamr@4
|
855 |
* @param aCommandId The command associated with this menu item.
|
williamr@4
|
856 |
* @param aItemSpecific ETrue to define the menu item item specific,
|
williamr@4
|
857 |
* EFalse otherwise.
|
williamr@4
|
858 |
*/
|
williamr@4
|
859 |
IMPORT_C void SetItemSpecific( TInt aCommandId, TBool aItemSpecific );
|
williamr@4
|
860 |
|
williamr@4
|
861 |
/**
|
williamr@4
|
862 |
* Sets the embedded cba to options menu
|
williamr@4
|
863 |
*
|
williamr@4
|
864 |
* @param aCba Cba to embed to menu
|
williamr@4
|
865 |
*
|
williamr@4
|
866 |
* @since S60 v5.2
|
williamr@4
|
867 |
*/
|
williamr@4
|
868 |
void SetEmbeddedCba( CEikCba* aCba );
|
williamr@4
|
869 |
|
williamr@4
|
870 |
/**
|
williamr@4
|
871 |
* Closes and destroys any current cascade menu and takes focus back. Does
|
williamr@4
|
872 |
* nothing if no cascade menu exists.
|
williamr@4
|
873 |
*
|
williamr@4
|
874 |
* @param aMainMenuClosing ETrue if main menu is also to be closed.
|
williamr@4
|
875 |
*/
|
williamr@4
|
876 |
void CloseCascadeMenu( TBool aMainMenuClosing );
|
williamr@4
|
877 |
|
williamr@4
|
878 |
/**
|
williamr@4
|
879 |
* Symbian two-phased constructor for menu panes that are created for
|
williamr@4
|
880 |
* item specific menus.
|
williamr@4
|
881 |
*
|
williamr@4
|
882 |
* @internal
|
williamr@4
|
883 |
* @since S60 v5.2
|
williamr@4
|
884 |
* @return Created menu pane. Ownership transfers to caller.
|
williamr@4
|
885 |
*/
|
williamr@4
|
886 |
static CEikMenuPane* NewItemCommandMenuL( MEikMenuObserver* aObserver );
|
williamr@4
|
887 |
|
williamr@4
|
888 |
/**
|
williamr@4
|
889 |
* Sets item specific commands dimmed.
|
williamr@4
|
890 |
*
|
williamr@4
|
891 |
* @internal
|
williamr@4
|
892 |
* @since S60 v5.2
|
williamr@4
|
893 |
*/
|
williamr@4
|
894 |
void SetItemCommandsDimmed();
|
williamr@4
|
895 |
|
williamr@4
|
896 |
/**
|
williamr@4
|
897 |
* Adds menu items to this menu and item action menu data.
|
williamr@4
|
898 |
*
|
williamr@4
|
899 |
* @internal
|
williamr@4
|
900 |
* @since S60 v5.2
|
williamr@4
|
901 |
* @param aMenuData Item action menu data.
|
williamr@4
|
902 |
*/
|
williamr@4
|
903 |
void AddMenuItemsToItemActionMenuL(
|
williamr@4
|
904 |
CAknItemActionMenuData& aMenuData );
|
williamr@4
|
905 |
|
williamr@4
|
906 |
/**
|
williamr@4
|
907 |
* Adds cascade menu items to item action menu data.
|
williamr@4
|
908 |
*
|
williamr@4
|
909 |
* @internal
|
williamr@4
|
910 |
* @since S60 v5.2
|
williamr@4
|
911 |
* @param aCascadeId Cascade menu id.
|
williamr@4
|
912 |
* @param aItemSpecific If ETrue, adds only item specific items.
|
williamr@4
|
913 |
* @param aMenuData Item action menu data.
|
williamr@4
|
914 |
*/
|
williamr@4
|
915 |
void AddCascadeMenuItemsToActionMenuL(
|
williamr@4
|
916 |
TInt aCascadeId,
|
williamr@4
|
917 |
TBool aItemSpecific,
|
williamr@4
|
918 |
CAknItemActionMenuData& aMenuData );
|
williamr@4
|
919 |
|
williamr@4
|
920 |
/**
|
williamr@4
|
921 |
* Enables the default highlight in menu
|
williamr@4
|
922 |
*/
|
williamr@4
|
923 |
void SetDefaultHighlight();
|
williamr@4
|
924 |
|
williamr@2
|
925 |
private:
|
williamr@2
|
926 |
enum { EInvalidCurrentSize=0x01, EBackgroundFaded=0x02 };
|
williamr@2
|
927 |
|
williamr@2
|
928 |
private: // new functions
|
williamr@2
|
929 |
TRect CalculateSizeAndPosition() ;
|
williamr@2
|
930 |
enum THighlightType {ENoHighlight,EDrawHighlight,ERemoveHighlight};
|
williamr@4
|
931 |
void DrawItem( TInt aItem, THighlightType aHighlight ) const;
|
williamr@2
|
932 |
void DrawItem(CWindowGc& aGc,TInt aItem, THighlightType aHighlight) const;
|
williamr@2
|
933 |
void ReportSelectionMadeL( TBool aAbortTransition = ETrue );
|
williamr@2
|
934 |
void ReportCanceled();
|
williamr@2
|
935 |
void LaunchCascadeMenuL(TInt aCascadeMenuId);
|
williamr@2
|
936 |
void DoLaunchCascadeMenuL(TInt aCascadeMenuId);
|
williamr@2
|
937 |
void TryLaunchCascadeMenuL(const CEikMenuPaneItem& aItem);
|
williamr@2
|
938 |
void PrepareGcForDrawingItems(CGraphicsContext& aGc) const;
|
williamr@2
|
939 |
TBool ItemArrayOwnedExternally() const;
|
williamr@2
|
940 |
TBool IsHotKeyL(const TInt modifiers,const TInt aCode);
|
williamr@2
|
941 |
TBool MoveToItemL(TInt aCode, TInt aModifiers);
|
williamr@2
|
942 |
void HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType);
|
williamr@2
|
943 |
void CreateScrollBarFrame();
|
williamr@2
|
944 |
void UpdateScrollBar();
|
williamr@2
|
945 |
void DoUpdateScrollBarL();
|
williamr@2
|
946 |
void UpdateScrollBarThumbs();
|
williamr@2
|
947 |
static TInt UpdateScrollBarCallBackL(TAny* aObj);
|
williamr@2
|
948 |
TRect ViewRect() const;
|
williamr@2
|
949 |
TInt TotalItemHeight() const;
|
williamr@2
|
950 |
void ScrollToMakeItemVisible(TInt aItemIndex);
|
williamr@2
|
951 |
void Scroll(TInt aAmount);
|
williamr@2
|
952 |
TBool CheckCreateScroller();
|
williamr@2
|
953 |
void CheckCreateScrollerL();
|
williamr@2
|
954 |
void ResetItemArray();
|
williamr@2
|
955 |
void CreateItemArrayL();
|
williamr@2
|
956 |
void CreateIconFromResourceL(TResourceReader& aReader, CEikMenuPaneItem& aItem) const;
|
williamr@2
|
957 |
|
williamr@2
|
958 |
// Skin support for menu
|
williamr@2
|
959 |
void UpdateBackgroundContext(const TRect& aWindowRect);
|
williamr@2
|
960 |
|
williamr@2
|
961 |
// Support method for highlight animation
|
williamr@2
|
962 |
void RepaintHighlight() const;
|
williamr@2
|
963 |
|
williamr@2
|
964 |
private: // from CCoeControl
|
williamr@2
|
965 |
IMPORT_C void Reserved_1();
|
williamr@2
|
966 |
IMPORT_C void Reserved_2();
|
williamr@2
|
967 |
|
williamr@2
|
968 |
private : // new functions
|
williamr@2
|
969 |
void LoadCascadeBitmapL() ;
|
williamr@2
|
970 |
|
williamr@2
|
971 |
// Support for check mark, from v3.0
|
williamr@2
|
972 |
void LoadCheckMarkBitmapL();
|
williamr@2
|
973 |
TBool MenuHasCheckBoxOn() const;
|
williamr@2
|
974 |
// Support for radio button, from v3.0
|
williamr@2
|
975 |
void LoadRadioButtonBitmapL();
|
williamr@2
|
976 |
TBool IsItemMemberOfRadioButtonGroup(TInt aItem) const ;
|
williamr@2
|
977 |
// for drawing,from v3.0
|
williamr@2
|
978 |
TBool MenuHasIcon() const;
|
williamr@2
|
979 |
|
williamr@2
|
980 |
TRect CalculateSizeAndPositionScalable( const TRect& aWindowRect, TInt aNumItemsInPane ) ;
|
williamr@2
|
981 |
TRect HighlightRect() const;
|
williamr@2
|
982 |
void PrepareHighlightFrame() const;
|
williamr@2
|
983 |
void SetCascadedIconSize() const;
|
williamr@2
|
984 |
|
williamr@2
|
985 |
// fixes marquee flickering
|
williamr@2
|
986 |
friend class CAknMarqueeControl;
|
williamr@2
|
987 |
|
williamr@2
|
988 |
CEikMenuPaneExtension* Extension() const;
|
williamr@4
|
989 |
|
williamr@4
|
990 |
/**
|
williamr@4
|
991 |
* Creates menu pane's extension object if it doesn't exist yet.
|
williamr@4
|
992 |
*/
|
williamr@4
|
993 |
void CheckCreateExtensionL();
|
williamr@4
|
994 |
|
williamr@4
|
995 |
/**
|
williamr@4
|
996 |
* Calculates the rectangle occupied by an item.
|
williamr@4
|
997 |
*
|
williamr@4
|
998 |
* @param aItemIndex Item's index.
|
williamr@4
|
999 |
* @return Item's rectangle.
|
williamr@4
|
1000 |
*/
|
williamr@4
|
1001 |
TRect ItemRect( TInt aItemIndex ) const;
|
williamr@4
|
1002 |
|
williamr@4
|
1003 |
/**
|
williamr@4
|
1004 |
* Calculates the height of menu items.
|
williamr@4
|
1005 |
*
|
williamr@4
|
1006 |
* @return Item height.
|
williamr@4
|
1007 |
*/
|
williamr@4
|
1008 |
TInt CalculateItemHeight() const;
|
williamr@2
|
1009 |
|
williamr@2
|
1010 |
protected: // from CoeControl
|
williamr@2
|
1011 |
|
williamr@2
|
1012 |
/**
|
williamr@2
|
1013 |
* From @c CCoeControl.
|
williamr@2
|
1014 |
*
|
williamr@2
|
1015 |
* Retrieves an object of the same type as that encapsulated in aId. Other
|
williamr@2
|
1016 |
* than in the case where @c NULL is returned, the object returned must be
|
williamr@2
|
1017 |
* of the same object type - that is, the @c ETypeId member of the object
|
williamr@2
|
1018 |
* pointed to by the pointer returned by this function must be equal to the
|
williamr@2
|
1019 |
* @c iUid member of @c aId.
|
williamr@2
|
1020 |
*
|
williamr@2
|
1021 |
* @since SDK 7.0s
|
williamr@2
|
1022 |
* @param aId An encapsulated object type ID.
|
williamr@2
|
1023 |
* @return Encapsulates the pointer to the object provided. Note that the
|
williamr@2
|
1024 |
* encapsulated pointer may be @c NULL.
|
williamr@2
|
1025 |
*/
|
williamr@2
|
1026 |
IMPORT_C TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
|
williamr@2
|
1027 |
|
williamr@2
|
1028 |
public: // From CoeControl.
|
williamr@2
|
1029 |
|
williamr@2
|
1030 |
/**
|
williamr@2
|
1031 |
* From @c CoeControl.
|
williamr@2
|
1032 |
*
|
williamr@2
|
1033 |
* Gets the number of controls contained in a compound control. This
|
williamr@2
|
1034 |
* function should be implemented by all compound controls.
|
williamr@2
|
1035 |
*
|
williamr@2
|
1036 |
* Note:
|
williamr@2
|
1037 |
* In SDK 6.1 this was changed from protected to public.
|
williamr@2
|
1038 |
*
|
williamr@2
|
1039 |
* @return The number of component controls contained by this control.
|
williamr@2
|
1040 |
*/
|
williamr@2
|
1041 |
IMPORT_C TInt CountComponentControls() const;
|
williamr@2
|
1042 |
|
williamr@2
|
1043 |
/**
|
williamr@2
|
1044 |
* From @c CoeControl.
|
williamr@2
|
1045 |
*
|
williamr@4
|
1046 |
* Gets the specified component of a compound control. This function should?
|
williamr@2
|
1047 |
* be implemented by all compound controls.
|
williamr@2
|
1048 |
*
|
williamr@2
|
1049 |
* Note:
|
williamr@2
|
1050 |
* Within a compound control, each component control is identified by an
|
williamr@2
|
1051 |
* index, where the index depends on the order the controls were added: the
|
williamr@2
|
1052 |
* first is given an index of 0, the next an index of 1, and so on.
|
williamr@2
|
1053 |
*
|
williamr@2
|
1054 |
* @param[in, out] aIndex The index of the control to get.
|
williamr@2
|
1055 |
* @return The component control with an index of @c aIndex.
|
williamr@2
|
1056 |
*/
|
williamr@2
|
1057 |
IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@2
|
1058 |
|
williamr@2
|
1059 |
protected: // new functions
|
williamr@4
|
1060 |
|
williamr@2
|
1061 |
/**
|
williamr@2
|
1062 |
* Gets the maximum number of items which can be seen simultaneously.
|
williamr@2
|
1063 |
*
|
williamr@2
|
1064 |
* @return The maximum number of items which can be seen simultaneously.
|
williamr@2
|
1065 |
*/
|
williamr@2
|
1066 |
TInt NumberOfItemsThatFitInView() const;
|
williamr@2
|
1067 |
|
williamr@2
|
1068 |
private: // data
|
williamr@2
|
1069 |
friend class CEikMenuButton;
|
williamr@2
|
1070 |
MEikMenuObserver* iMenuObserver;
|
williamr@2
|
1071 |
MEikMenuObserver* iEditMenuObserver;
|
williamr@2
|
1072 |
CEikMenuPane* iCascadeMenuPane;
|
williamr@2
|
1073 |
const CEikMenuPaneTitle* iMenuPaneTitle;
|
williamr@2
|
1074 |
const CEikHotKeyTable* iHotKeyTable;
|
williamr@2
|
1075 |
CEikMenuPane* iOwner;
|
williamr@2
|
1076 |
CItemArray* iItemArray;
|
williamr@2
|
1077 |
TBool iArrayOwnedExternally;
|
williamr@2
|
1078 |
TBool iAllowPointerUpEvents;
|
williamr@2
|
1079 |
TInt iNumberOfDragEvents;
|
williamr@2
|
1080 |
TInt iSelectedItem;
|
williamr@2
|
1081 |
TInt iItemHeight;
|
williamr@2
|
1082 |
TInt iBaseLine;
|
williamr@2
|
1083 |
TInt iHotkeyColWidth;
|
williamr@2
|
1084 |
TInt iFlags;
|
williamr@2
|
1085 |
CEikScrollBarFrame* iSBFrame;
|
williamr@2
|
1086 |
CMenuScroller* iScroller;
|
williamr@2
|
1087 |
CEikButtonBase* iLaunchingButton; // for popouts only
|
williamr@2
|
1088 |
TInt iSubPopupWidth; // 0..2
|
williamr@4
|
1089 |
TInt iSpare;
|
williamr@4
|
1090 |
CEikMenuPaneExtension* iExtension;
|
williamr@2
|
1091 |
|
williamr@2
|
1092 |
};
|
williamr@2
|
1093 |
|
williamr@2
|
1094 |
#endif
|
williamr@2
|
1095 |
|