williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2000-2006 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: Uikon legacy labelled button control
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
#if !defined (__EIKLBBUT_H__)
|
williamr@2
|
19 |
#define __EIKLBBUT_H__
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#if !defined(__COECNTRL_H__)
|
williamr@2
|
22 |
#include <coecntrl.h>
|
williamr@2
|
23 |
#endif
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#if !defined(__COECOBS_H__)
|
williamr@2
|
26 |
#include <coecobs.h>
|
williamr@2
|
27 |
#endif
|
williamr@2
|
28 |
|
williamr@4
|
29 |
#include <AknControl.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
class CEikCommandButtonBase;
|
williamr@2
|
32 |
class CEikLabel;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
/**
|
williamr@2
|
35 |
* This class combines a command button with a label and a hotkey binding.
|
williamr@2
|
36 |
*
|
williamr@2
|
37 |
* The label is used to display a text describing a hotkey. The hotkey is set via API or resource, as the ASCII code
|
williamr@2
|
38 |
* of the key that is combined with CTRL to form the hotkey combination. E.g. setting the hotkey to decimal 65
|
williamr@2
|
39 |
* will bind CTRL+'A' as the hotkey. "CTRL+A" will be displayed in the label.
|
williamr@2
|
40 |
*
|
williamr@2
|
41 |
* This class does not implement S60 look-and-feel and is not skinned.
|
williamr@2
|
42 |
*
|
williamr@2
|
43 |
* @lib eikcoctl
|
williamr@2
|
44 |
* @since S60 1.0
|
williamr@2
|
45 |
*/
|
williamr@2
|
46 |
class CEikLabeledButton : public CAknControl, private MCoeControlObserver
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
public:
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
* Options for display of the hotkey shortcut
|
williamr@2
|
51 |
*/
|
williamr@2
|
52 |
enum TFlags
|
williamr@2
|
53 |
{
|
williamr@2
|
54 |
EShowHotKey = 0x01, // Hot keys are displayed
|
williamr@2
|
55 |
EPlainHotKey = 0x02 // Hot keys are displayed plain
|
williamr@2
|
56 |
};
|
williamr@2
|
57 |
public:
|
williamr@2
|
58 |
|
williamr@2
|
59 |
/**
|
williamr@2
|
60 |
* Constructor
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
IMPORT_C CEikLabeledButton();
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* C++ Destructor
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
IMPORT_C ~CEikLabeledButton();
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* 2nd Stage constructor
|
williamr@2
|
71 |
*
|
williamr@2
|
72 |
* @param aButton Sets the button to use as the active part of the CEikLabeledButton
|
williamr@2
|
73 |
*/
|
williamr@2
|
74 |
IMPORT_C void ConstructL(CEikCommandButtonBase* aButton,TInt aHotKeyCode,TInt aFlags);
|
williamr@2
|
75 |
|
williamr@2
|
76 |
/**
|
williamr@2
|
77 |
* Access to the button component of the labeled button
|
williamr@2
|
78 |
*
|
williamr@2
|
79 |
* @return Pointer to the button component. No ownership is transferred.
|
williamr@2
|
80 |
*/
|
williamr@2
|
81 |
IMPORT_C CEikCommandButtonBase* Button() const;
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/**
|
williamr@2
|
84 |
* Access to the label component of the labeled button
|
williamr@2
|
85 |
*
|
williamr@2
|
86 |
* @return Pointer to the CEikLabel component. No ownership is transferred.
|
williamr@2
|
87 |
*/
|
williamr@2
|
88 |
IMPORT_C CEikLabel* Label() const;
|
williamr@2
|
89 |
|
williamr@2
|
90 |
/**
|
williamr@2
|
91 |
* Access the hotkey code
|
williamr@2
|
92 |
*
|
williamr@2
|
93 |
* @return The hot key code
|
williamr@2
|
94 |
*/
|
williamr@2
|
95 |
IMPORT_C TInt HotKeyCode() const;
|
williamr@2
|
96 |
|
williamr@2
|
97 |
/**
|
williamr@2
|
98 |
* Access to hot key setting
|
williamr@2
|
99 |
*
|
williamr@2
|
100 |
* @return EFase iff ShowsHotKeys is not set
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
IMPORT_C TBool ShowsHotKey() const;
|
williamr@2
|
103 |
|
williamr@2
|
104 |
/**
|
williamr@2
|
105 |
* Access the key display mode
|
williamr@2
|
106 |
*
|
williamr@2
|
107 |
* @return EFalse if the key mode is not set to Plain
|
williamr@2
|
108 |
*/
|
williamr@2
|
109 |
IMPORT_C TBool PlainHotKey() const;
|
williamr@2
|
110 |
|
williamr@2
|
111 |
/**
|
williamr@2
|
112 |
* Cause the button to animate and to generate its command ID
|
williamr@2
|
113 |
*/
|
williamr@2
|
114 |
IMPORT_C void Animate();
|
williamr@2
|
115 |
|
williamr@2
|
116 |
/**
|
williamr@2
|
117 |
* Change the hot key binding
|
williamr@2
|
118 |
*
|
williamr@2
|
119 |
* @param aKeyCode Key to use (along with pressing CTRL) as the hotkey
|
williamr@2
|
120 |
*/
|
williamr@2
|
121 |
IMPORT_C void UpdateHotKey(TInt aKeyCode,TFlags aFlags);
|
williamr@2
|
122 |
|
williamr@2
|
123 |
// from CCoeControl
|
williamr@2
|
124 |
public:
|
williamr@2
|
125 |
/**
|
williamr@2
|
126 |
* From CCoeControl
|
williamr@2
|
127 |
*
|
williamr@2
|
128 |
* CONE framework is requesting that the passed-in key be handled.
|
williamr@2
|
129 |
*
|
williamr@2
|
130 |
* @param aKeyEvent Wserv event type
|
williamr@2
|
131 |
* @param aKeyCode Key code
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
|
williamr@2
|
134 |
|
williamr@2
|
135 |
/**
|
williamr@2
|
136 |
* From CCoeControl
|
williamr@2
|
137 |
*
|
williamr@2
|
138 |
* Construct the object from resource
|
williamr@2
|
139 |
*
|
williamr@2
|
140 |
* @param aReader Fully constructed resource reader
|
williamr@2
|
141 |
*/
|
williamr@2
|
142 |
IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
|
williamr@2
|
143 |
|
williamr@2
|
144 |
/**
|
williamr@2
|
145 |
* From CCoeControl
|
williamr@2
|
146 |
*
|
williamr@2
|
147 |
* Reports to the caller the minimum size that the control can be, given its contents.
|
williamr@2
|
148 |
*
|
williamr@2
|
149 |
* @return The minimum size
|
williamr@2
|
150 |
*/
|
williamr@2
|
151 |
IMPORT_C TSize MinimumSize();
|
williamr@2
|
152 |
|
williamr@2
|
153 |
/**
|
williamr@2
|
154 |
* From CCoeControl
|
williamr@2
|
155 |
*
|
williamr@2
|
156 |
* Sets the control whose window is to be used as a container for this control
|
williamr@2
|
157 |
*
|
williamr@2
|
158 |
* @param aContainer control
|
williamr@2
|
159 |
*/
|
williamr@2
|
160 |
IMPORT_C void SetContainerWindowL(const CCoeControl& aContainer);
|
williamr@2
|
161 |
|
williamr@2
|
162 |
/**
|
williamr@2
|
163 |
* From CCoeControl
|
williamr@2
|
164 |
*
|
williamr@2
|
165 |
* Sets the button to be inactive. The button is drawn with a dimmed effect.
|
williamr@2
|
166 |
*
|
williamr@2
|
167 |
* @param aDimmed If not EFalse, set the state to dimmed. Otherwise set to non-dimmed
|
williamr@2
|
168 |
*/
|
williamr@2
|
169 |
IMPORT_C void SetDimmed(TBool aDimmed);
|
williamr@2
|
170 |
|
williamr@2
|
171 |
/**
|
williamr@2
|
172 |
* From CCoeControl
|
williamr@2
|
173 |
*
|
williamr@2
|
174 |
* Obtain the list of colors to be used by this control
|
williamr@2
|
175 |
*
|
williamr@2
|
176 |
* @param aColorUseList
|
williamr@2
|
177 |
*/
|
williamr@2
|
178 |
IMPORT_C void GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const; // not available before Release 005u
|
williamr@2
|
179 |
|
williamr@2
|
180 |
/**
|
williamr@2
|
181 |
* From CCoeControl
|
williamr@2
|
182 |
*
|
williamr@2
|
183 |
* This is called when resource or layout or other display-affecting setting has changed.
|
williamr@2
|
184 |
* Change the internals of the control so that it is ready for a subsequent SizeChanged call.
|
williamr@2
|
185 |
*
|
williamr@2
|
186 |
* @param aType Type of resource or setting that has changed
|
williamr@2
|
187 |
*/
|
williamr@2
|
188 |
IMPORT_C void HandleResourceChange(TInt aType); // not available before Release 005u
|
williamr@2
|
189 |
|
williamr@2
|
190 |
/**
|
williamr@2
|
191 |
* From CCoeControl
|
williamr@2
|
192 |
*
|
williamr@2
|
193 |
* Report the input capabilities of the control
|
williamr@2
|
194 |
*
|
williamr@2
|
195 |
* @return A copy of the object holding the capabilities of this control
|
williamr@2
|
196 |
*/
|
williamr@2
|
197 |
IMPORT_C TCoeInputCapabilities InputCapabilities() const; // not available before Release 006
|
williamr@2
|
198 |
|
williamr@2
|
199 |
/**
|
williamr@2
|
200 |
* From CCoeControl
|
williamr@2
|
201 |
*
|
williamr@2
|
202 |
* Handle a pointer event coming from the CONE framework
|
williamr@2
|
203 |
*
|
williamr@2
|
204 |
* @param aPointerEvent Event to handle
|
williamr@2
|
205 |
*/
|
williamr@2
|
206 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
207 |
|
williamr@2
|
208 |
protected:
|
williamr@2
|
209 |
/**
|
williamr@2
|
210 |
* From CCoeControl
|
williamr@2
|
211 |
*
|
williamr@2
|
212 |
* Serialize the state of the control
|
williamr@2
|
213 |
*
|
williamr@2
|
214 |
* @param aWriteStream Output stream for the serialization
|
williamr@2
|
215 |
*/
|
williamr@2
|
216 |
IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
|
williamr@2
|
217 |
|
williamr@2
|
218 |
private:
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
* From CCoeControl
|
williamr@2
|
221 |
*
|
williamr@2
|
222 |
* Returns the number of component controls
|
williamr@2
|
223 |
*
|
williamr@2
|
224 |
* @return Number of component controls
|
williamr@2
|
225 |
*/
|
williamr@2
|
226 |
TInt CountComponentControls() const;
|
williamr@2
|
227 |
|
williamr@2
|
228 |
/**
|
williamr@2
|
229 |
* From CCoeControl
|
williamr@2
|
230 |
*
|
williamr@2
|
231 |
* Return a pointer to the component control at the give index.
|
williamr@2
|
232 |
*
|
williamr@2
|
233 |
* @return Pointer to the conponent control. No ownership is transferred
|
williamr@2
|
234 |
*/
|
williamr@2
|
235 |
CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@2
|
236 |
|
williamr@2
|
237 |
void SizeChanged();
|
williamr@2
|
238 |
|
williamr@2
|
239 |
void Reserved_2();
|
williamr@2
|
240 |
|
williamr@2
|
241 |
private:
|
williamr@2
|
242 |
/**
|
williamr@2
|
243 |
* From CAknControl
|
williamr@2
|
244 |
*/
|
williamr@2
|
245 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
246 |
private:
|
williamr@2
|
247 |
/**
|
williamr@2
|
248 |
* from MCoeControlObserver
|
williamr@2
|
249 |
*/
|
williamr@2
|
250 |
void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
|
williamr@2
|
251 |
private:
|
williamr@2
|
252 |
void CreateLabelL();
|
williamr@2
|
253 |
void UpdateHotKeyL();
|
williamr@2
|
254 |
private:
|
williamr@2
|
255 |
/**
|
williamr@2
|
256 |
* Contained command button object.
|
williamr@2
|
257 |
* Owned
|
williamr@2
|
258 |
*/
|
williamr@2
|
259 |
CEikCommandButtonBase* iButton;
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
* Contained label to implement the text
|
williamr@2
|
263 |
* Owned
|
williamr@2
|
264 |
*/
|
williamr@2
|
265 |
CEikLabel* iLabel; // Owned
|
williamr@2
|
266 |
|
williamr@2
|
267 |
TInt iHotKeyCode;
|
williamr@2
|
268 |
TInt iLButFlags;
|
williamr@2
|
269 |
|
williamr@2
|
270 |
TInt iSpare[2];
|
williamr@2
|
271 |
};
|
williamr@2
|
272 |
|
williamr@2
|
273 |
#endif
|