|
1 /* |
|
2 * Copyright (c) 2007 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: Interface for FsControlButton class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef M_FSCONTROLBUTTONINTERFACE_H |
|
20 #define M_FSCONTROLBUTTONINTERFACE_H |
|
21 |
|
22 //<cmail> SF |
|
23 #include <alf/alfgc.h> |
|
24 #include <alf/alftimedvalue.h> |
|
25 //</cmail> |
|
26 #include "fscontrolbuttonconst.h" |
|
27 |
|
28 class CAlfTexture; |
|
29 class CAlfImageBrush; |
|
30 class CFsControlButtonVisualiser; |
|
31 class MFsTriggeredComponent; |
|
32 class CFsControlButton; |
|
33 |
|
34 /** |
|
35 * Interface for FsControlButton class. |
|
36 * |
|
37 * Interface for FsControlButton class which is available for the component |
|
38 * user. No direct access to FsControlButton methods is available. |
|
39 * |
|
40 * @code |
|
41 * |
|
42 * @endcode |
|
43 * |
|
44 * @lib fs_generic.lib |
|
45 */ |
|
46 NONSHARABLE_CLASS( MFsControlButtonInterface ) |
|
47 { |
|
48 |
|
49 public: |
|
50 |
|
51 /** Specifies the text row. */ |
|
52 enum TFsButtonContent |
|
53 { |
|
54 EFsButtonFirstLine, |
|
55 EFsButtonSecondLine |
|
56 }; |
|
57 |
|
58 /** Auto size modes for button. */ |
|
59 enum TFsAutoSizeMode |
|
60 { |
|
61 EFsManual, |
|
62 EFsFitToContent, |
|
63 EFsFitToParent, |
|
64 EFsLayout |
|
65 }; |
|
66 |
|
67 /** |
|
68 * Sets first line of text in button. |
|
69 * |
|
70 * @param aLabel text to be set. |
|
71 * @param aContent Specifies the text row. |
|
72 */ |
|
73 virtual void SetTextL( |
|
74 const TDesC& aLabel, |
|
75 TFsButtonContent aContent = EFsButtonFirstLine ) = 0; |
|
76 |
|
77 /** |
|
78 * Retrieves id of the button. |
|
79 * |
|
80 * @return id of the button. |
|
81 */ |
|
82 virtual TInt Id() const = 0; |
|
83 |
|
84 /** |
|
85 * Sets icon in the button. |
|
86 * |
|
87 * @param aIcon icon to be added. |
|
88 * @param aWhich specifies which icon is to be added, A or B. |
|
89 */ |
|
90 virtual void SetIconL( |
|
91 CAlfTexture& aIcon, |
|
92 TFsControlButtonElem aWhich = ECBElemIconA ) = 0; |
|
93 |
|
94 /** |
|
95 * Retrieves button's visualiser. Ownership of the new visualiser is |
|
96 * gained. |
|
97 * |
|
98 * @param aVisualiser New visualiser to be used to draw button. |
|
99 */ |
|
100 virtual void SetVisualiserL( |
|
101 CFsControlButtonVisualiser* aVisualiser ) = 0; |
|
102 |
|
103 /** |
|
104 * Sets component to button which will be triggered when button |
|
105 * is pressed. |
|
106 * |
|
107 * @param aComponent component to be set. |
|
108 */ |
|
109 virtual void SetTriggeredComponent( |
|
110 MFsTriggeredComponent& aComponent ) = 0; |
|
111 |
|
112 /** |
|
113 * Clears triggered component. No more events to triggered |
|
114 * component are sent. |
|
115 */ |
|
116 virtual void ClearTriggeredComponent() = 0; |
|
117 |
|
118 // <cmail> Platform layout changes |
|
119 /** |
|
120 * Sets position of the button (top left point). |
|
121 * |
|
122 * @param aTlPoint coordinates of top left point. |
|
123 */ |
|
124 virtual void SetPos( const TPoint& aTlPoint ) = 0; |
|
125 // </cmail> Platform layout changes |
|
126 |
|
127 /** |
|
128 * Sets alignement of element. |
|
129 * |
|
130 * @param aButtonElem element to be aligned. |
|
131 * @param aHAlign horizontal alignement of element. |
|
132 * @param aVAlign vertical alignement of element. |
|
133 */ |
|
134 virtual void SetElemAlignL( TFsControlButtonElem aButtonElem, |
|
135 TAlfAlignHorizontal aHAlign, TAlfAlignVertical aVAlign ) = 0; |
|
136 |
|
137 /** |
|
138 * Sets width of the button. |
|
139 * |
|
140 * @param aWidth width of the button. |
|
141 */ |
|
142 virtual void SetWidth( TInt aWidth ) = 0; |
|
143 |
|
144 // <cmail> Platform layout changes |
|
145 /** |
|
146 * Sets size of the button. |
|
147 * |
|
148 * @param aSize size of the button. |
|
149 */ |
|
150 virtual void SetSize( const TSize& aSize ) = 0; |
|
151 // </cmail> Platform layout changes |
|
152 |
|
153 /** |
|
154 * Set auto size mode for button. |
|
155 * Defines how the buttons size is changed. |
|
156 * |
|
157 * @param aAutoSizeMode new mode. |
|
158 */ |
|
159 virtual void SetAutoSizeMode( TFsAutoSizeMode aAutoSizeMode ) = 0; |
|
160 |
|
161 /** |
|
162 * Sets dimm state of the button. |
|
163 * |
|
164 * @param aDimmed dimm state of the the button. |
|
165 */ |
|
166 virtual void SetDimmed( TBool aDimmed = ETrue ) = 0; |
|
167 |
|
168 /** |
|
169 * Checks if button is dimmed. |
|
170 * |
|
171 * @return ETrue if dimmed, EFalse otherwise. |
|
172 */ |
|
173 virtual TBool IsDimmed() const = 0; |
|
174 |
|
175 /** |
|
176 * Shows (enables) button. |
|
177 */ |
|
178 virtual void ShowButtonL() = 0; |
|
179 |
|
180 /** |
|
181 * Hides (disables) button. |
|
182 */ |
|
183 virtual void HideButton() = 0; |
|
184 |
|
185 /** |
|
186 * Checks if button is visible (enabled). |
|
187 * |
|
188 * @return ETrue if enabled, EFalse otherwise. |
|
189 */ |
|
190 virtual TBool IsVisible() const = 0; |
|
191 |
|
192 /** |
|
193 * Sets button's background image. Ownership of the object is transfered. |
|
194 * |
|
195 * @param aImage Background image brush. |
|
196 */ |
|
197 virtual void SetBackgroundImageL( CAlfImageBrush* aImage ) = 0; |
|
198 |
|
199 /** |
|
200 * Sets button's background color. |
|
201 * |
|
202 * @param aColor color of background. |
|
203 */ |
|
204 virtual void SetBackgroundColor( const TRgb& aColor ) = 0; |
|
205 |
|
206 /** |
|
207 * Clears button's background color. Button is transparent. |
|
208 */ |
|
209 virtual void ClearBackgroundColor() = 0; |
|
210 |
|
211 /** |
|
212 * Clears button's background image. |
|
213 */ |
|
214 virtual void ClearBackgroundImage() = 0; |
|
215 |
|
216 /** |
|
217 * Checks if button has focus. |
|
218 * |
|
219 * @return ETrue if focused, EFalse otherwise. |
|
220 */ |
|
221 virtual TBool IsFocused() const = 0; |
|
222 |
|
223 /** |
|
224 * Retrieves position of button. |
|
225 * |
|
226 * @return position of button. |
|
227 */ |
|
228 virtual const TAlfTimedPoint Pos() const = 0; |
|
229 |
|
230 /** |
|
231 * Retrieves size of button. |
|
232 * |
|
233 * @return size of button. |
|
234 */ |
|
235 virtual const TAlfTimedPoint Size() const = 0; |
|
236 |
|
237 /** |
|
238 * Retrieves button's text. |
|
239 * |
|
240 * @param aContent Specifies the text row. |
|
241 * @return Text of the button. |
|
242 */ |
|
243 virtual TPtrC Text( |
|
244 TFsButtonContent aContent = EFsButtonFirstLine ) const = 0; |
|
245 |
|
246 /** |
|
247 * Set new height for the button text. |
|
248 * |
|
249 * @param aTextHeight Height in pixels. |
|
250 */ |
|
251 virtual void SetTextHeight( const TInt aTextHeight ) = 0; |
|
252 |
|
253 /** |
|
254 * Set button's text color when it's not focused or dimmed. |
|
255 * |
|
256 * @param aColor New color. |
|
257 */ |
|
258 virtual void SetNormalTextColor( const TRgb& aColor ) = 0; |
|
259 |
|
260 /** |
|
261 * Set button's text color when it's focused. |
|
262 * |
|
263 * @param aColor New color. |
|
264 */ |
|
265 virtual void SetFocusedTextColor( const TRgb& aColor ) = 0; |
|
266 |
|
267 /** |
|
268 * Set button's text color when it's dimmed. |
|
269 * |
|
270 * @param aColor New color. |
|
271 */ |
|
272 virtual void SetDimmedTextColor( const TRgb& aColor ) = 0; |
|
273 |
|
274 /** |
|
275 * Change the current font. |
|
276 * |
|
277 * @param aFont Font specification. |
|
278 */ |
|
279 virtual void SetTextFontL( const TFontSpec& aFont ) = 0; |
|
280 |
|
281 /** |
|
282 * Retrieves button's type. |
|
283 * |
|
284 * @return aImage background image. |
|
285 */ |
|
286 virtual TFsControlButtonType ControlButtonType() const = 0; |
|
287 |
|
288 // <cmail> Touch |
|
289 virtual CAlfControl* AsAlfControl() = 0; |
|
290 // </cmail> |
|
291 /** |
|
292 * Destructor. |
|
293 */ |
|
294 virtual ~MFsControlButtonInterface() {}; |
|
295 |
|
296 }; |
|
297 |
|
298 |
|
299 #endif // M_FSCONTROLBUTTONINTERFACE_H |