|
1 /******************************************************************************* |
|
2 * Copyright (c) 2005, 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. This program and the accompanying materials |
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
|
5 * which accompanies this distribution, and is available at |
|
6 * http://www.eclipse.org/legal/epl-v10.html |
|
7 * |
|
8 * Contributors: |
|
9 * Nokia Corporation - S60 implementation |
|
10 *******************************************************************************/ |
|
11 |
|
12 |
|
13 #ifndef SWTCOMMANDMENU_H |
|
14 #define SWTCOMMANDMENU_H |
|
15 |
|
16 |
|
17 #include <eikmenub.h> |
|
18 #include <eikmenup.h> |
|
19 #include "eswtwidgetscore.h" |
|
20 #include "eswtmobileextensions.h" |
|
21 |
|
22 |
|
23 /** |
|
24 * CSwtCommandMenu |
|
25 * @lib eswt |
|
26 */ |
|
27 NONSHARABLE_CLASS(CSwtCommandMenu) |
|
28 : public CBase |
|
29 , public MSwtMenu |
|
30 { |
|
31 // Methods |
|
32 public: |
|
33 static CSwtCommandMenu* NewL(MSwtDisplay& aDisplay); |
|
34 void Reset(); |
|
35 void AppendCommand(const MSwtCommand& aCommand, |
|
36 const MSwtMenu* aCascadeMenu); |
|
37 void AppendSeparatorL(); |
|
38 void InsertCommand(const MSwtCommand& aCommand, |
|
39 const MSwtMenu* aCascadeMenu, TInt aPos); |
|
40 const RPointerArray<MSwtCommand>& Commands() const; |
|
41 |
|
42 private: |
|
43 inline CSwtCommandMenu(MSwtDisplay& aDisplay); |
|
44 ~CSwtCommandMenu(); |
|
45 void ConstructL(); |
|
46 |
|
47 // From MSwtMenu |
|
48 public: |
|
49 TSwtPeer Dispose(); |
|
50 TSwtPeer JavaPeer() const; |
|
51 void RegisterChildL(MSwtMenuItem& aChild, TInt aIndex); |
|
52 void UnregisterChild(MSwtMenuItem& aChild); |
|
53 void SetEnabled(TBool aEnabled); |
|
54 void SetVisible(TBool aVisible); |
|
55 TBool IsEnabled() const; |
|
56 TBool IsVisible() const; |
|
57 void FillPaneL(CEikMenuPane& aMenuPaneControl) const; |
|
58 void RefreshPaneL(CEikMenuPane& /*aMenuPaneControl*/) const {}; |
|
59 #ifdef RD_SCALABLE_UI_V2 |
|
60 void FillPopupL(CAknStylusPopUpMenu& aPopupMenu) const; |
|
61 #endif //RD_SCALABLE_UI_V2 |
|
62 void ProcessCommandL(TInt aCommandId, TInt aItemIndex, |
|
63 TBool aOfferToSubMenus = EFalse) const; |
|
64 TInt CountDisplayableItems(TBool aStylusPopupMenu = EFalse) const; |
|
65 const MSwtMenu* GetCascadeMenu(const CEikMenuPaneItem::SData& aItemData) const; |
|
66 TBool HasRadioGroup() const; |
|
67 CEikMenuPane* Host() const; |
|
68 void SetHost(CEikMenuPane* aPane); |
|
69 void SetLocation(TInt aX, TInt aY); |
|
70 TPoint GetLocation() const; |
|
71 TBool LocationEnabled() const; |
|
72 const RPointerArray<MSwtMenuItem>* Items() const; |
|
73 void SetDefaultItem(MSwtMenuItem*); |
|
74 MSwtMenuItem* DefaultItem() const; |
|
75 |
|
76 // Data |
|
77 private: |
|
78 MSwtDisplay& iDisplay; |
|
79 RPointerArray<MSwtCommand> iItems; // Command items |
|
80 RPointerArray<MSwtMenu> iCascadeMenus; // Cascade menus of menu items |
|
81 RArray<TInt> iSeparators; // Index of separators between menu items |
|
82 TBool iDisabled; |
|
83 |
|
84 /** |
|
85 * Menu pane on which the menu displays its items. Can be null. |
|
86 * Not Own |
|
87 */ |
|
88 mutable CEikMenuPane* iHost; |
|
89 }; |
|
90 |
|
91 |
|
92 #endif // SWTCOMMANDMENU_H |