williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-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@2
|
5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.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: Slider editor class
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#ifndef __AKNSLIDER_H__
|
williamr@2
|
20 |
#define __AKNSLIDER_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
// INCLUDES
|
williamr@2
|
23 |
#include <eikbctrl.h>
|
williamr@2
|
24 |
#include <eiklabel.h>
|
williamr@2
|
25 |
#include <eikimage.h>
|
williamr@2
|
26 |
#include <avkon.hrh> // For TAknOrientation
|
williamr@2
|
27 |
|
williamr@2
|
28 |
// CONSTANTS
|
williamr@2
|
29 |
|
williamr@2
|
30 |
// The following is max. length of the entire formatted value text including
|
williamr@2
|
31 |
// number, special characters and supplied text.
|
williamr@2
|
32 |
const TInt KValueLabelTextMaxLength = 30;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
// Forward declarations
|
williamr@2
|
35 |
class CGulIcon;
|
williamr@2
|
36 |
class MAknsSkinInstance;
|
williamr@2
|
37 |
class CAknSliderExtension;
|
williamr@2
|
38 |
class CAknSliderData;
|
williamr@2
|
39 |
struct TAknSliderGfx;
|
williamr@2
|
40 |
|
williamr@2
|
41 |
// CLASS DECLARATION
|
williamr@2
|
42 |
class CAknSlider : public CEikBorderedControl
|
williamr@2
|
43 |
{
|
williamr@2
|
44 |
public: // Enumerations
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
* Elements that currently support custom graphics.
|
williamr@2
|
47 |
*
|
williamr@2
|
48 |
* @since 3.2
|
williamr@2
|
49 |
*/
|
williamr@2
|
50 |
enum TSliderGfxElements
|
williamr@2
|
51 |
{
|
williamr@2
|
52 |
/**
|
williamr@2
|
53 |
* Left cap component of the slider, without filling. Left cap equals
|
williamr@2
|
54 |
* to bottom cap in vertical layout.
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
EElemEmptyLeftCap,
|
williamr@2
|
57 |
|
williamr@2
|
58 |
/**
|
williamr@2
|
59 |
* Right cap component of the slider, without filling. Right cap equals
|
williamr@2
|
60 |
* to top cap in vertical layout.
|
williamr@2
|
61 |
*/
|
williamr@2
|
62 |
EElemEmptyRightCap,
|
williamr@2
|
63 |
|
williamr@2
|
64 |
/**
|
williamr@2
|
65 |
* Line component of the slider, without filling.
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
EElemEmptyLine,
|
williamr@2
|
68 |
|
williamr@2
|
69 |
/**
|
williamr@2
|
70 |
* Line component of the slider, with filling.
|
williamr@2
|
71 |
*/
|
williamr@2
|
72 |
EElemFilledLine,
|
williamr@2
|
73 |
|
williamr@2
|
74 |
/**
|
williamr@2
|
75 |
* Left cap component of the slider, with filling.
|
williamr@2
|
76 |
*/
|
williamr@2
|
77 |
EElemFilledLeftCap,
|
williamr@2
|
78 |
|
williamr@2
|
79 |
/**
|
williamr@2
|
80 |
* Right cap component of the slider, with filling.
|
williamr@2
|
81 |
*/
|
williamr@2
|
82 |
EElemFilledRightCap,
|
williamr@2
|
83 |
|
williamr@2
|
84 |
/**
|
williamr@2
|
85 |
* Marker component of the slider.
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
EElemMarker,
|
williamr@2
|
88 |
|
williamr@2
|
89 |
/**
|
williamr@2
|
90 |
* Tick mark component of the slider. Small evenly spaced lines,
|
williamr@2
|
91 |
* placed vertically in relation to slider itself.
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
EElemTickMark,
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
* Marker component of the slider when dragged
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
EElemMarkerSelected
|
williamr@2
|
99 |
};
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/**
|
williamr@2
|
102 |
* Supported slider position indicators.
|
williamr@2
|
103 |
*
|
williamr@2
|
104 |
* @since 3.2
|
williamr@2
|
105 |
*/
|
williamr@2
|
106 |
enum
|
williamr@2
|
107 |
{
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
* Flag for enabling/disabling line filling. With line filling different
|
williamr@2
|
110 |
* graphics will be used for the the slider line's left and right sides
|
williamr@2
|
111 |
* (the current marker position as pivot). The left side is considered
|
williamr@2
|
112 |
* filled line and the right side empty line.
|
williamr@2
|
113 |
*
|
williamr@2
|
114 |
* When line filling is enabled the graphics element @c EElemFilledLine
|
williamr@2
|
115 |
* is used for the left side and @c EElemEmptyLine for the right. If
|
williamr@2
|
116 |
* line filling is disabled @c EElemEmptyLine is used for the whole
|
williamr@2
|
117 |
* line.
|
williamr@2
|
118 |
*/
|
williamr@2
|
119 |
EPosFilling = 0x01,
|
williamr@2
|
120 |
/**
|
williamr@2
|
121 |
* Flag for enabling/disabling line marker (the knob). While disabled
|
williamr@2
|
122 |
* marker is not visible, the marker area will still be used for touch
|
williamr@2
|
123 |
* input.
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
EPosMarker = 0x02
|
williamr@2
|
126 |
};
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
* Event for slider thumb/marker dragging.
|
williamr@2
|
130 |
*
|
williamr@2
|
131 |
* @since 5.0
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
enum
|
williamr@2
|
134 |
{
|
williamr@2
|
135 |
/**
|
williamr@2
|
136 |
* Slider thumb/marker drag start
|
williamr@2
|
137 |
*/
|
williamr@2
|
138 |
EDragMarkerStart = 1000,
|
williamr@2
|
139 |
/**
|
williamr@2
|
140 |
* Slider thumb/marker drag end
|
williamr@2
|
141 |
*/
|
williamr@2
|
142 |
EDragMarkerEnd
|
williamr@2
|
143 |
};
|
williamr@2
|
144 |
|
williamr@2
|
145 |
public:
|
williamr@2
|
146 |
/**
|
williamr@2
|
147 |
* Default Constructor.
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C CAknSlider();
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* Destructor.
|
williamr@2
|
153 |
*/
|
williamr@2
|
154 |
IMPORT_C ~CAknSlider();
|
williamr@2
|
155 |
|
williamr@2
|
156 |
/**
|
williamr@2
|
157 |
* Sets the value of the slider control and also updates the iValueLabel
|
williamr@2
|
158 |
* text. There are the following constraints on the value:
|
williamr@2
|
159 |
* it must be within the current range,
|
williamr@2
|
160 |
* it must be at a value that is minimum + N * stepsize.
|
williamr@2
|
161 |
* If these are not both true, then the method will Panic
|
williamr@2
|
162 |
*
|
williamr@2
|
163 |
* @param aValue Sets the value of the slider.
|
williamr@2
|
164 |
*/
|
williamr@2
|
165 |
IMPORT_C void SetValueL( TInt aValue );
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* Returns the value of the slider control
|
williamr@2
|
169 |
*
|
williamr@2
|
170 |
* @return Slider value.
|
williamr@2
|
171 |
*/
|
williamr@2
|
172 |
IMPORT_C TInt Value() const;
|
williamr@2
|
173 |
|
williamr@2
|
174 |
/**
|
williamr@2
|
175 |
* Sets the range of the slider control. Maximum value must be greater than
|
williamr@2
|
176 |
* the minimum value, or the method will Panic.
|
williamr@2
|
177 |
*
|
williamr@2
|
178 |
* @param aMinimumValue The minimum value of the slider control
|
williamr@2
|
179 |
* @param aMaximumValue The maximum value of the slider control
|
williamr@2
|
180 |
*/
|
williamr@2
|
181 |
IMPORT_C void SetRange( TInt aMinimumValue, TInt aMaximumValue );
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/**
|
williamr@2
|
184 |
* Gets the range of the slider control. Maximum value must be greater than
|
williamr@2
|
185 |
* the minimum value, or the method will Panic.
|
williamr@2
|
186 |
*
|
williamr@2
|
187 |
* @since 3.2
|
williamr@2
|
188 |
* @param aMinimumValue The minimum value of the slider control
|
williamr@2
|
189 |
* @param aMaximumValue The maximum value of the slider control
|
williamr@2
|
190 |
*/
|
williamr@2
|
191 |
IMPORT_C void GetRange( TInt& aMinimumValue, TInt& aMaximumValue );
|
williamr@2
|
192 |
|
williamr@2
|
193 |
/**
|
williamr@2
|
194 |
* Sets the step size. The step size must divide evenly into the Range. This
|
williamr@2
|
195 |
* routine should be called after SetRange if either is called.
|
williamr@2
|
196 |
*
|
williamr@2
|
197 |
* @param aStepSize The value of the step size
|
williamr@2
|
198 |
*/
|
williamr@2
|
199 |
IMPORT_C void SetStepSize( TInt aStepSize );
|
williamr@2
|
200 |
|
williamr@2
|
201 |
/**
|
williamr@2
|
202 |
* Sets the text to the minimum label.
|
williamr@2
|
203 |
*
|
williamr@2
|
204 |
* @param aText The text passed is set to the minimum label
|
williamr@2
|
205 |
*/
|
williamr@2
|
206 |
IMPORT_C void SetMinimumTextL( const TDesC& aText );
|
williamr@2
|
207 |
|
williamr@2
|
208 |
/**
|
williamr@2
|
209 |
* Sets the text to the maximum label.
|
williamr@2
|
210 |
*
|
williamr@2
|
211 |
* @param aText The text passed is set to the maximum label
|
williamr@2
|
212 |
*/
|
williamr@2
|
213 |
IMPORT_C void SetMaximumTextL( const TDesC& aText );
|
williamr@2
|
214 |
|
williamr@2
|
215 |
/**
|
williamr@2
|
216 |
* Sets the value of decimal places. The legal range is 0 - 9 inclusive.
|
williamr@2
|
217 |
*
|
williamr@2
|
218 |
* @param aDecimalPlaces The value of the decimal place
|
williamr@2
|
219 |
*/
|
williamr@2
|
220 |
IMPORT_C void SetDecimalPlaces( TInt aDecimalPlaces );
|
williamr@2
|
221 |
|
williamr@2
|
222 |
/**
|
williamr@2
|
223 |
* Returns the value of decimal place.
|
williamr@2
|
224 |
*
|
williamr@2
|
225 |
* @return the value of decimal place.
|
williamr@2
|
226 |
*/
|
williamr@2
|
227 |
IMPORT_C TInt DecimalPlaces() const;
|
williamr@2
|
228 |
|
williamr@2
|
229 |
/**
|
williamr@2
|
230 |
* Allows setting custom graphics for a certain slider element. Existing
|
williamr@2
|
231 |
* icons (custom or default) for the element are discarded. Note that some
|
williamr@2
|
232 |
* elements might not be visible until the corresponding functionality is
|
williamr@2
|
233 |
* enabled, see @c SetPositionIndicators and @c SetTicksEnabled.
|
williamr@2
|
234 |
*
|
williamr@2
|
235 |
* Slider takes care of scaling the given icons to the correct size,
|
williamr@2
|
236 |
* provided that they have been created with @c AknIconUtils or @c AknsUtils
|
williamr@2
|
237 |
* interfaces. It also handles re-scaling the icons if the slider layout
|
williamr@2
|
238 |
* changes.
|
williamr@2
|
239 |
*
|
williamr@2
|
240 |
* If the custom icons are created by using skin items (e.g. using color
|
williamr@2
|
241 |
* from skin), remember to change the icons whenever skin changes, see
|
williamr@2
|
242 |
* @c CCoeControl::HandleResourceChange. In addition, note that slider can
|
williamr@2
|
243 |
* be with horizontal or vertical layout, @see Orientation
|
williamr@2
|
244 |
*
|
williamr@2
|
245 |
* @param aElement The element ID to which the icons are assigned, one of
|
williamr@2
|
246 |
* @c TGfxElements.
|
williamr@2
|
247 |
*
|
williamr@2
|
248 |
* @param aBitmap The icon used for the element, must be non-NULL,
|
williamr@2
|
249 |
* ownership is transferred to slider.
|
williamr@2
|
250 |
*
|
williamr@2
|
251 |
* @param aMask Optional mask for the aBitmap, can be NULL, ownership
|
williamr@2
|
252 |
* is transferred to slider.
|
williamr@2
|
253 |
*
|
williamr@2
|
254 |
* @par Exceptions:
|
williamr@2
|
255 |
* Will panic with EAknPanicInvalidValue if the element ID is invalid or
|
williamr@2
|
256 |
* aBitmap is NULL.
|
williamr@2
|
257 |
*
|
williamr@2
|
258 |
* @since 3.2
|
williamr@2
|
259 |
*/
|
williamr@2
|
260 |
IMPORT_C void SetGraphics( TInt aElement,
|
williamr@2
|
261 |
CFbsBitmap* aBitmap,
|
williamr@2
|
262 |
CFbsBitmap* aMask );
|
williamr@2
|
263 |
|
williamr@2
|
264 |
/**
|
williamr@2
|
265 |
* Makes an element to use default graphics. Possible custom graphics for
|
williamr@2
|
266 |
* the element is discarded.
|
williamr@2
|
267 |
*
|
williamr@2
|
268 |
* @param aElement The element ID which should use default graphics, one of
|
williamr@2
|
269 |
* @c TGfxElements.
|
williamr@2
|
270 |
*
|
williamr@2
|
271 |
* @par Exceptions:
|
williamr@2
|
272 |
* Will panic with EAknPanicInvalidValue if the element index is invalid.
|
williamr@2
|
273 |
*
|
williamr@2
|
274 |
* @since 3.2
|
williamr@2
|
275 |
*/
|
williamr@2
|
276 |
IMPORT_C void UseDefaultGraphics( TInt aElement );
|
williamr@2
|
277 |
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
* Queries whether some element is using default graphics.
|
williamr@2
|
280 |
*
|
williamr@2
|
281 |
* @param aElement The element ID which should use default graphics, one of
|
williamr@2
|
282 |
* @c TGfxElements.
|
williamr@2
|
283 |
*
|
williamr@2
|
284 |
* @return ETrue if default graphics is used for the element, EFalse
|
williamr@2
|
285 |
* otherwise (custom graphics used).
|
williamr@2
|
286 |
*
|
williamr@2
|
287 |
* @par Exceptions:
|
williamr@2
|
288 |
* Will panic with EAknPanicInvalidValue if the element index is invalid.
|
williamr@2
|
289 |
*
|
williamr@2
|
290 |
* @since 3.2
|
williamr@2
|
291 |
*/
|
williamr@2
|
292 |
IMPORT_C TBool UsesDefaultGraphics( TInt aElement ) const;
|
williamr@2
|
293 |
|
williamr@2
|
294 |
/**
|
williamr@2
|
295 |
* Configures line position indicators, which display the slider's current
|
williamr@2
|
296 |
* position. Possible indicators are defined in @c EPositionIndicator, at
|
williamr@2
|
297 |
* least one of them must be defined (to display some position information).
|
williamr@2
|
298 |
* Multiple values can be enabled by using bitwise or, e.g. @c EPosFilling |
|
williamr@2
|
299 |
* EPosMarker. The new flags will fully override the old values. The default
|
williamr@2
|
300 |
* value is @c EPosMarker.
|
williamr@2
|
301 |
*
|
williamr@2
|
302 |
* @param aFlags Bitmask containing flags from @c EPositionIndicator. At
|
williamr@2
|
303 |
* least one flag should be set.
|
williamr@2
|
304 |
*
|
williamr@2
|
305 |
* @par Exceptions:
|
williamr@2
|
306 |
* If none of the flags in @c EPositionIndicator is set, the code defaults
|
williamr@2
|
307 |
* silently to @c EPosMarker.
|
williamr@2
|
308 |
*
|
williamr@2
|
309 |
* @since 3.2
|
williamr@2
|
310 |
*/
|
williamr@2
|
311 |
IMPORT_C void SetPositionIndicators( TUint32 aFlags );
|
williamr@2
|
312 |
|
williamr@2
|
313 |
|
williamr@2
|
314 |
/**
|
williamr@2
|
315 |
* Queries the current status of position indicators.
|
williamr@2
|
316 |
*
|
williamr@2
|
317 |
* @return Bitmask containing flags as defined in @c EPositionIndicator
|
williamr@2
|
318 |
*
|
williamr@2
|
319 |
* @since 3.2
|
williamr@2
|
320 |
*/
|
williamr@2
|
321 |
IMPORT_C TUint32 PositionIndicators() const;
|
williamr@2
|
322 |
|
williamr@2
|
323 |
/**
|
williamr@2
|
324 |
* Queries the current orientation status.
|
williamr@2
|
325 |
*
|
williamr@2
|
326 |
* @return The current orientation, see @c TAknOrientation.
|
williamr@2
|
327 |
*
|
williamr@2
|
328 |
* @since 3.2
|
williamr@2
|
329 |
*/
|
williamr@2
|
330 |
IMPORT_C TAknOrientation Orientation() const;
|
williamr@2
|
331 |
|
williamr@2
|
332 |
/**
|
williamr@2
|
333 |
* Enables/disables the tick marks. Tick marks are disabled by default.
|
williamr@2
|
334 |
* Enabling tick marks affects only the visual appearance of slider. That is,
|
williamr@2
|
335 |
* enabling slider step handling is not changed.
|
williamr@2
|
336 |
*
|
williamr@2
|
337 |
* @param aStatus ETrue to enable tick marks, EFalse to disable.
|
williamr@2
|
338 |
*
|
williamr@2
|
339 |
* @since 3.2
|
williamr@2
|
340 |
*/
|
williamr@2
|
341 |
IMPORT_C void SetTicksEnabled( TBool aStatus );
|
williamr@2
|
342 |
|
williamr@2
|
343 |
/**
|
williamr@2
|
344 |
* Queries the current tick mark status.
|
williamr@2
|
345 |
*
|
williamr@2
|
346 |
* @return ETrue if tick marks are enabled, EFalse otherwise.
|
williamr@2
|
347 |
*
|
williamr@2
|
348 |
* @since 3.2
|
williamr@2
|
349 |
*/
|
williamr@2
|
350 |
IMPORT_C TBool TicksEnabled() const;
|
williamr@2
|
351 |
|
williamr@2
|
352 |
/**
|
williamr@2
|
353 |
* Sets the tick interval used for drawing the tick marks. Tick interval is
|
williamr@2
|
354 |
* in the slider range units (not in pixels). If interval value is set to 0,
|
williamr@2
|
355 |
* the slider step size is used as tick interval, see @c SetStepSize. The
|
williamr@2
|
356 |
* default interval value is 0.
|
williamr@2
|
357 |
*
|
williamr@2
|
358 |
* @param aInterval The value set as tick interval, always >= 0.
|
williamr@2
|
359 |
*
|
williamr@2
|
360 |
* @since 3.2
|
williamr@2
|
361 |
*/
|
williamr@2
|
362 |
IMPORT_C void SetTickInterval( TUint aInterval );
|
williamr@2
|
363 |
|
williamr@2
|
364 |
/**
|
williamr@2
|
365 |
* Queries the current tick interval value.
|
williamr@2
|
366 |
*
|
williamr@2
|
367 |
* @return Current tick interval, always >= 0.
|
williamr@2
|
368 |
*
|
williamr@2
|
369 |
* @since 3.2
|
williamr@2
|
370 |
*/
|
williamr@2
|
371 |
IMPORT_C TUint TickInterval() const;
|
williamr@2
|
372 |
|
williamr@2
|
373 |
/**
|
williamr@2
|
374 |
* Returns slider bitmap to "list pane for setting item" (setting option
|
williamr@2
|
375 |
* item slider graphic). Ownership of the returned bitmap is transfered to
|
williamr@2
|
376 |
* the caller.
|
williamr@2
|
377 |
*
|
williamr@2
|
378 |
* @param aValue Current value
|
williamr@2
|
379 |
* @param aResourceId Slider resource that contains minimum and maximum
|
williamr@2
|
380 |
* values
|
williamr@2
|
381 |
* @return Slider bitmap. Ownership of the bitmap is transfered to the
|
williamr@2
|
382 |
* caller.
|
williamr@2
|
383 |
*/
|
williamr@2
|
384 |
IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
|
williamr@2
|
385 |
TInt aResourceId );
|
williamr@2
|
386 |
|
williamr@2
|
387 |
/**
|
williamr@2
|
388 |
* Returns slider bitmap to "list pane for setting item" (setting option
|
williamr@2
|
389 |
* item slider graphic). Ownership of the returned bitmap is transfered to
|
williamr@2
|
390 |
* the caller.
|
williamr@2
|
391 |
*
|
williamr@2
|
392 |
* @param aValue Current value
|
williamr@2
|
393 |
* @param aMinimumValue Slider minimum value
|
williamr@2
|
394 |
* @param aMaximumValue Slider maximum value
|
williamr@2
|
395 |
* @return Slider bitmap. Ownership of the bitmap is transfered to the
|
williamr@2
|
396 |
* caller
|
williamr@2
|
397 |
*/
|
williamr@2
|
398 |
IMPORT_C static CFbsBitmap* CreateBitmapL( TInt aValue,
|
williamr@2
|
399 |
TInt aMinimumValue,
|
williamr@2
|
400 |
TInt aMaximumValue );
|
williamr@2
|
401 |
|
williamr@2
|
402 |
/**
|
williamr@2
|
403 |
* Returns slider icon to "list pane for setting item" (setting option item
|
williamr@2
|
404 |
* slider graphic). Ownership of the returned icon is transfered to the
|
williamr@2
|
405 |
* caller.
|
williamr@2
|
406 |
*
|
williamr@2
|
407 |
* @param aValue Current value
|
williamr@2
|
408 |
* @param aResourceId Slider resource that contains minimum and maximum
|
williamr@2
|
409 |
* values
|
williamr@2
|
410 |
* @return Slider icon. Ownership of the icon is transfered to the caller
|
williamr@2
|
411 |
*/
|
williamr@2
|
412 |
IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
|
williamr@2
|
413 |
TInt aResourceId );
|
williamr@2
|
414 |
|
williamr@2
|
415 |
/**
|
williamr@2
|
416 |
* Returns slider icon to "list pane for setting item" (setting option item
|
williamr@2
|
417 |
* slider graphic). Ownership of the returned icon is transfered to the
|
williamr@2
|
418 |
* caller.
|
williamr@2
|
419 |
*
|
williamr@2
|
420 |
* @param aValue Current value
|
williamr@2
|
421 |
* @param aMinimumValue Slider minimum value
|
williamr@2
|
422 |
* @param aMaximumValue Slider maximum value
|
williamr@2
|
423 |
* @return Slider bitmap. Ownership of the icon is transfered to the caller
|
williamr@2
|
424 |
*/
|
williamr@2
|
425 |
IMPORT_C static CGulIcon* CreateSetStyleListBoxIconL( TInt aValue,
|
williamr@2
|
426 |
TInt aMinimumValue,
|
williamr@2
|
427 |
TInt aMaximumValue );
|
williamr@2
|
428 |
/**
|
williamr@2
|
429 |
* Call CCoeControl::EnableDragEvents()
|
williamr@2
|
430 |
*
|
williamr@2
|
431 |
* @since 3.2
|
williamr@2
|
432 |
*/
|
williamr@2
|
433 |
IMPORT_C void EnableDrag();
|
williamr@2
|
434 |
|
williamr@2
|
435 |
public:
|
williamr@2
|
436 |
/**
|
williamr@2
|
437 |
* From CCoeControl, returns the size of the control. And yes, this method
|
williamr@2
|
438 |
* is non-const.
|
williamr@2
|
439 |
*
|
williamr@2
|
440 |
* @return size of the control
|
williamr@2
|
441 |
*/
|
williamr@2
|
442 |
TSize MinimumSize();
|
williamr@2
|
443 |
|
williamr@2
|
444 |
/**
|
williamr@2
|
445 |
* From CCoeControl, Handles key event.
|
williamr@2
|
446 |
*
|
williamr@2
|
447 |
* @param aKeyEvent The key event.
|
williamr@2
|
448 |
* @param aType The type of the event.
|
williamr@2
|
449 |
* @return Indicates whether the key event was used by this control or not
|
williamr@2
|
450 |
*/
|
williamr@2
|
451 |
TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
|
williamr@2
|
452 |
TEventCode aType );
|
williamr@2
|
453 |
|
williamr@2
|
454 |
/**
|
williamr@2
|
455 |
* From CCoeControl, essential for Dialog/Form construction.
|
williamr@2
|
456 |
*
|
williamr@2
|
457 |
* @param aReader which reads the values specified in the resource file
|
williamr@2
|
458 |
*/
|
williamr@2
|
459 |
IMPORT_C void ConstructFromResourceL( TResourceReader& aReader );
|
williamr@2
|
460 |
|
williamr@2
|
461 |
/**
|
williamr@2
|
462 |
* This function is used for constructing the control.
|
williamr@2
|
463 |
*
|
williamr@2
|
464 |
* @param aParent Pointer to the parent control.
|
williamr@2
|
465 |
* @paran aValue Current value of the slider control.
|
williamr@2
|
466 |
* @param aReader which reads the values specified in the resource file.
|
williamr@2
|
467 |
*/
|
williamr@2
|
468 |
IMPORT_C void ConstructFromResourceL( CCoeControl* aParent,
|
williamr@2
|
469 |
TInt aValue,
|
williamr@2
|
470 |
TResourceReader& aReader );
|
williamr@2
|
471 |
|
williamr@2
|
472 |
/**
|
williamr@2
|
473 |
* This function toggles between edit and view modes
|
williamr@2
|
474 |
*
|
williamr@2
|
475 |
* @param aType Specifies the mode.
|
williamr@2
|
476 |
*/
|
williamr@2
|
477 |
IMPORT_C void HandleResourceChange( TInt aType );
|
williamr@2
|
478 |
|
williamr@2
|
479 |
/**
|
williamr@2
|
480 |
* This function will be called when focus changed.
|
williamr@2
|
481 |
*
|
williamr@2
|
482 |
* @param aDrawNow if the control needs to call DrawNow().
|
williamr@2
|
483 |
*/
|
williamr@2
|
484 |
IMPORT_C virtual void FocusChanged(TDrawNow aDrawNow);
|
williamr@2
|
485 |
|
williamr@2
|
486 |
public:
|
williamr@2
|
487 |
/**
|
williamr@2
|
488 |
* This function is used specifically in the forms. (For Forms/Dialogs to
|
williamr@2
|
489 |
* use with LAF) Returns the number of lines on the control.
|
williamr@2
|
490 |
*
|
williamr@2
|
491 |
* @return Number of lines
|
williamr@2
|
492 |
*/
|
williamr@2
|
493 |
IMPORT_C TInt NumberOfLines() const;
|
williamr@2
|
494 |
|
williamr@2
|
495 |
/**
|
williamr@2
|
496 |
* This routine can be used to combine the resource for a Slider with a
|
williamr@2
|
497 |
* value to get the same value text that you would get if you had the
|
williamr@2
|
498 |
* instantiated control
|
williamr@2
|
499 |
*
|
williamr@2
|
500 |
* @param aValue The value to format
|
williamr@2
|
501 |
* @param aResourceId AKN_SLIDER resource id
|
williamr@2
|
502 |
*
|
williamr@2
|
503 |
* @return Transfer of ownership of descriptor containing the value text
|
williamr@2
|
504 |
*/
|
williamr@2
|
505 |
IMPORT_C static HBufC* CreateValueTextInHBufCL( TInt aValue,
|
williamr@2
|
506 |
TInt aResourceId );
|
williamr@2
|
507 |
|
williamr@2
|
508 |
void SuppressDrawing( TBool aSuppress );
|
williamr@2
|
509 |
|
williamr@2
|
510 |
protected:
|
williamr@2
|
511 |
/**
|
williamr@2
|
512 |
* From CCoeControl, Called by framework when the view size is changed.
|
williamr@2
|
513 |
*/
|
williamr@2
|
514 |
void SizeChanged();
|
williamr@2
|
515 |
|
williamr@2
|
516 |
/**
|
williamr@2
|
517 |
* From CCoeControl, Drawing function which draws the control
|
williamr@2
|
518 |
*
|
williamr@2
|
519 |
* @param aRect Specified area to be drawn
|
williamr@2
|
520 |
*/
|
williamr@2
|
521 |
void Draw( const TRect& aRect ) const;
|
williamr@2
|
522 |
|
williamr@2
|
523 |
/**
|
williamr@2
|
524 |
* From CCoeControl, Returns number of components.
|
williamr@2
|
525 |
*
|
williamr@2
|
526 |
* @return Number of component controls
|
williamr@2
|
527 |
*/
|
williamr@2
|
528 |
IMPORT_C virtual TInt CountComponentControls() const;
|
williamr@2
|
529 |
|
williamr@2
|
530 |
/**
|
williamr@2
|
531 |
* From CCoeControl, Returns pointer to particular component
|
williamr@2
|
532 |
*
|
williamr@2
|
533 |
* @param aIndex Index whose control's pointer has to returned.
|
williamr@2
|
534 |
* @return Pointer to component control
|
williamr@2
|
535 |
*/
|
williamr@2
|
536 |
IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
|
williamr@2
|
537 |
|
williamr@2
|
538 |
public:
|
williamr@2
|
539 |
/**
|
williamr@2
|
540 |
* From CCoeControl. Handles pointer event
|
williamr@2
|
541 |
*
|
williamr@2
|
542 |
* @param aPointerEvent Pointer event to be handled
|
williamr@2
|
543 |
*/
|
williamr@2
|
544 |
IMPORT_C void HandlePointerEventL( const TPointerEvent& aPointerEvent );
|
williamr@2
|
545 |
TInt StepSize() const;
|
williamr@2
|
546 |
|
williamr@2
|
547 |
private:
|
williamr@2
|
548 |
/**
|
williamr@2
|
549 |
* From CAknControl
|
williamr@2
|
550 |
*/
|
williamr@2
|
551 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
552 |
|
williamr@2
|
553 |
protected:
|
williamr@2
|
554 |
/**
|
williamr@2
|
555 |
* Sets the text to the value label
|
williamr@2
|
556 |
*/
|
williamr@2
|
557 |
IMPORT_C void SetValueTextL();
|
williamr@2
|
558 |
|
williamr@2
|
559 |
public:
|
williamr@2
|
560 |
|
williamr@2
|
561 |
/**
|
williamr@2
|
562 |
* Report event for thumb/marker dragging via HandleControlEventL
|
williamr@2
|
563 |
*
|
williamr@2
|
564 |
* @since 5.0
|
williamr@2
|
565 |
*/
|
williamr@2
|
566 |
void ReportMarkerDragEvent( TBool aEnable );
|
williamr@2
|
567 |
|
williamr@2
|
568 |
private:
|
williamr@2
|
569 |
/**
|
williamr@2
|
570 |
* This function creates the bitmaps and labels. Also it sets the
|
williamr@2
|
571 |
* container window for the labels.
|
williamr@2
|
572 |
*/
|
williamr@2
|
573 |
void ConstructL();
|
williamr@2
|
574 |
|
williamr@2
|
575 |
void InitializeBitmapsL();
|
williamr@2
|
576 |
|
williamr@2
|
577 |
/**
|
williamr@2
|
578 |
* static routine for setting the value text.
|
williamr@2
|
579 |
* @param valueBuf Buffer to hold the result. Must be big enough to hold
|
williamr@2
|
580 |
* value label as formatted from the resources and value provided, though
|
williamr@2
|
581 |
* it is protected from overflow. Contained text will be truncated to
|
williamr@2
|
582 |
* KValueLabelTextMaxLength
|
williamr@2
|
583 |
* @param aValue Slider value to format
|
williamr@2
|
584 |
* @param aResourceData resource Id to read from
|
williamr@2
|
585 |
*/
|
williamr@2
|
586 |
static void DoSetValueTextL( TDes& valueBuf, TInt aValue,
|
williamr@2
|
587 |
const CAknSliderData& aResourceData );
|
williamr@2
|
588 |
|
williamr@2
|
589 |
/**
|
williamr@2
|
590 |
* This method is used to trap all the accesses to the internal data. It
|
williamr@2
|
591 |
* panics with EAknPanicObjectNotFullyConstructed if iData is not
|
williamr@2
|
592 |
* constructed, that is, if 2nd stage construction has not taken place (or
|
williamr@2
|
593 |
* has failed).
|
williamr@2
|
594 |
*/
|
williamr@2
|
595 |
CAknSliderData* SliderData() const;
|
williamr@2
|
596 |
|
williamr@2
|
597 |
/**
|
williamr@2
|
598 |
* This class is a utility to protect StringLoader::Format from being
|
williamr@2
|
599 |
* called without a formatting token.
|
williamr@2
|
600 |
*
|
williamr@2
|
601 |
* StringLoader is used in current implementation. See StringLoader::Format
|
williamr@2
|
602 |
* for the semantics of the parameters.
|
williamr@2
|
603 |
*
|
williamr@2
|
604 |
* The other thing to note is that the output for descriptor must be able
|
williamr@2
|
605 |
* to accept up to KValueLabelTextMaxLength characters.
|
williamr@2
|
606 |
*
|
williamr@2
|
607 |
* @param aOutput Output of format operation
|
williamr@2
|
608 |
* @param aFormat Formatting descriptor.
|
williamr@2
|
609 |
* @param aValue Descriptor to substitute for the %U token potentially
|
williamr@2
|
610 |
* present in the formatting descriptor.
|
williamr@2
|
611 |
*/
|
williamr@2
|
612 |
static void FormatWithOrWithoutTokenL( TDes& aOutput,
|
williamr@2
|
613 |
const TDesC& aFormat,
|
williamr@2
|
614 |
const TDesC& aValue );
|
williamr@2
|
615 |
|
williamr@2
|
616 |
// layout methods
|
williamr@2
|
617 |
void FormSliderLayout1();
|
williamr@2
|
618 |
void FormSliderLayout2();
|
williamr@2
|
619 |
void FormSliderLayout3();
|
williamr@2
|
620 |
void SettingsItemSliderLayout();
|
williamr@2
|
621 |
void VerticalSliderLayout();
|
williamr@2
|
622 |
void HorizontalSliderLayout();
|
williamr@2
|
623 |
void MIDPFormSliderLayout();
|
williamr@2
|
624 |
|
williamr@2
|
625 |
void SetLabelColor();
|
williamr@2
|
626 |
|
williamr@2
|
627 |
|
williamr@2
|
628 |
void CreateDecoratorImageFromResourceL( TInt aImageResourceId );
|
williamr@2
|
629 |
|
williamr@2
|
630 |
// Internal access methods
|
williamr@2
|
631 |
TInt Layout() const;
|
williamr@2
|
632 |
TInt MaximumValue() const;
|
williamr@2
|
633 |
TInt MinimumValue() const;
|
williamr@2
|
634 |
TInt Range() const;
|
williamr@2
|
635 |
|
williamr@2
|
636 |
// Starts a timer for feedback effect visualization.
|
williamr@2
|
637 |
void StartTimerL();
|
williamr@2
|
638 |
|
williamr@2
|
639 |
// Callback for feedback effect.
|
williamr@2
|
640 |
static TInt IndicationDrawCallbackL( TAny* aThis );
|
williamr@2
|
641 |
|
williamr@2
|
642 |
// Implementation of the feedback effect.
|
williamr@2
|
643 |
void SmallDirectionIndicationL();
|
williamr@2
|
644 |
|
williamr@2
|
645 |
void DrawHorizontalTickMarks( CWindowGc& aGc ) const;
|
williamr@2
|
646 |
void DrawVerticalTickMarks( CWindowGc& aGc ) const;
|
williamr@2
|
647 |
|
williamr@2
|
648 |
void TranslateValueL( TInt aDelta, TBool aFeedback = EFalse );
|
williamr@2
|
649 |
|
williamr@2
|
650 |
void GetMarkerRect( TRect& aRect ) const;
|
williamr@2
|
651 |
TSize MarkerSize() const;
|
williamr@2
|
652 |
TPoint MarkerPos() const;
|
williamr@2
|
653 |
|
williamr@2
|
654 |
void DrawHorizontal( TBool aDrawMarker ) const;
|
williamr@2
|
655 |
void DrawVertical( TBool aDrawMarker ) const;
|
williamr@2
|
656 |
|
williamr@2
|
657 |
void DrawHorizontalLine( CWindowGc& aGc ) const;
|
williamr@2
|
658 |
void DrawVerticalLine( CWindowGc& aGc ) const;
|
williamr@2
|
659 |
|
williamr@2
|
660 |
void FetchGfx( TAknSliderGfx& aGfx, TInt aElement, const TSize& aSize ) const;
|
williamr@2
|
661 |
|
williamr@2
|
662 |
// calculate the correct value according to the input point
|
williamr@2
|
663 |
TInt CalcAlignedValue( const TPoint& aPoint );
|
williamr@2
|
664 |
|
williamr@2
|
665 |
private:
|
williamr@2
|
666 |
CEikImage* iImage;
|
williamr@2
|
667 |
CEikLabel* iValueLabel;
|
williamr@2
|
668 |
CEikLabel* iMinLabel;
|
williamr@2
|
669 |
CEikLabel* iMaxLabel;
|
williamr@2
|
670 |
CFbsBitmap* iMarkerBmp;
|
williamr@2
|
671 |
CFbsBitmap* iMarkerMaskBmp;
|
williamr@2
|
672 |
TRect iMarkerArea;
|
williamr@2
|
673 |
TRect iLineRect;
|
williamr@2
|
674 |
TInt iValue;
|
williamr@2
|
675 |
TBool iEditable;
|
williamr@2
|
676 |
TRgb iColor;
|
williamr@2
|
677 |
|
williamr@2
|
678 |
// Not used, kept for binary compatibility. Another pointer with same name
|
williamr@2
|
679 |
// in iData is really used
|
williamr@2
|
680 |
HBufC* iSingularText;
|
williamr@2
|
681 |
|
williamr@2
|
682 |
CAknSliderData* iData;
|
williamr@2
|
683 |
CAknSliderExtension* iExt;
|
williamr@2
|
684 |
|
williamr@2
|
685 |
TInt iSpare[4];
|
williamr@2
|
686 |
};
|
williamr@2
|
687 |
|
williamr@2
|
688 |
#endif // __AKNSLIDER_H__
|
williamr@2
|
689 |
|
williamr@2
|
690 |
// End of File
|