|
1 /* |
|
2 * Copyright (c) 2000-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: Uikon legacy button that launches a menu when activated |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #if !defined(__EIKMNBUT_H__) |
|
20 #define __EIKMNBUT_H__ |
|
21 |
|
22 #if !defined(__EIKMOBS_H__) |
|
23 #include <eikmobs.h> |
|
24 #endif |
|
25 |
|
26 #if !defined(__EIKCMBUT_H__) |
|
27 #include <eikcmbut.h> |
|
28 #endif |
|
29 |
|
30 class CEikMenuPane; |
|
31 |
|
32 /** |
|
33 * This class implements a command button that, when pressed, raises a Menu pane. |
|
34 * |
|
35 * This class does NOT implement S60 look-and-feel and is not skinned. |
|
36 * |
|
37 * @lib eikcoctl.dll |
|
38 * @since S60 1.0 |
|
39 */ |
|
40 class CEikMenuButton : public CEikCommandButton, private MEikMenuObserver |
|
41 { |
|
42 public: |
|
43 /** |
|
44 * C++ constructor |
|
45 */ |
|
46 IMPORT_C CEikMenuButton(); |
|
47 |
|
48 /** |
|
49 * destructor |
|
50 */ |
|
51 IMPORT_C ~CEikMenuButton(); |
|
52 |
|
53 /** |
|
54 * 2nd phase constructor using a MNBUT resource struct |
|
55 * |
|
56 * @param aReader A constructed resource reader. |
|
57 */ |
|
58 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); |
|
59 |
|
60 /** |
|
61 * Launch the related menu pane |
|
62 * |
|
63 * @param aObserver Mandatory supplied menu observer pointer. |
|
64 */ |
|
65 IMPORT_C void LaunchPopupMenuL(MEikMenuObserver* aObserver); |
|
66 |
|
67 /** |
|
68 * Set the menu pane id to be launched when the control is activated. |
|
69 * |
|
70 * @param aMenuPaneId Resource ID of the menu pane to be launched |
|
71 */ |
|
72 IMPORT_C void SetMenuPaneId(TInt aMenuPaneId); |
|
73 |
|
74 protected: |
|
75 |
|
76 /** |
|
77 * From CCoeControl |
|
78 * |
|
79 * Serialize the state of the control to the given stream |
|
80 * |
|
81 * @param aWriteStream Stream to write to |
|
82 */ |
|
83 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; |
|
84 |
|
85 public: // from CEikButtonBase |
|
86 |
|
87 /** |
|
88 * Triggers the change of appearance of the button that is associated with the button being pressed |
|
89 */ |
|
90 IMPORT_C void Animate(); |
|
91 |
|
92 public: // From CCoeControl |
|
93 |
|
94 /** |
|
95 * From CCoeControl |
|
96 * |
|
97 * Framework method called when a pointer event is found to be within this control's boundaries. |
|
98 * The default implementation causes the associated menu to be presented to the screen. |
|
99 * |
|
100 * @param aPointerEvent Pointer event to process |
|
101 */ |
|
102 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * From MEikCommandObserver |
|
108 * |
|
109 * Framework method called to processs a command ID |
|
110 * |
|
111 * @param aCommandId ID of the command to respond to. |
|
112 */ |
|
113 IMPORT_C void ProcessCommandL(TInt aCommandId); |
|
114 |
|
115 /** |
|
116 * From MEikMenuObserver |
|
117 * |
|
118 * Called by the Uikon framework to handle the emphasising or de-emphasising of |
|
119 * a menu window. |
|
120 * |
|
121 * CEikMenuBar objects call this on their observer to emphasise |
|
122 * themselves when they are displayed, and de-emphasise themselves when they |
|
123 * stop displaying. |
|
124 * |
|
125 * @param aMenuControl The menu control |
|
126 * @param aEmphasis ETrue to emphasize the menu, EFalse otherwise |
|
127 */ |
|
128 IMPORT_C void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis); |
|
129 |
|
130 private: |
|
131 void ClosePopupMenu(); |
|
132 void DoLaunchPopupMenuL(); |
|
133 private: |
|
134 /** |
|
135 * From CAknControl |
|
136 */ |
|
137 IMPORT_C void* ExtensionInterface( TUid aInterface ); |
|
138 |
|
139 private: |
|
140 /** |
|
141 * The object to receive the menu events |
|
142 * Not Owned |
|
143 */ |
|
144 MEikMenuObserver* iMenuObserver; |
|
145 |
|
146 /** |
|
147 * Holds a menu pane object to be popped up |
|
148 * Owned |
|
149 */ |
|
150 CEikMenuPane* iMenuPopup; |
|
151 |
|
152 /** |
|
153 * Resource ID of the menu pane |
|
154 */ |
|
155 TInt iMenuPaneId; |
|
156 |
|
157 TInt iSpare; |
|
158 }; |
|
159 |
|
160 #endif |