williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 1997-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:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#if !defined(__EIKSCRLB_H__)
|
williamr@2
|
20 |
#define __EIKSCRLB_H__
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#if !defined(__EIKBCTRL_H__)
|
williamr@2
|
23 |
#include <eikbctrl.h>
|
williamr@2
|
24 |
#endif
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#if !defined(__EIKSBOBS_H__)
|
williamr@2
|
27 |
#include <eiksbobs.h>
|
williamr@2
|
28 |
#endif
|
williamr@2
|
29 |
|
williamr@2
|
30 |
#if !defined(__AKNSCBUT_H__)
|
williamr@2
|
31 |
#include <aknscbut.h>
|
williamr@2
|
32 |
#endif
|
williamr@2
|
33 |
|
williamr@2
|
34 |
#include <lafpublc.h>
|
williamr@2
|
35 |
|
williamr@2
|
36 |
class CEikCba;
|
williamr@2
|
37 |
class CAknDoubleSpanScrollIndicator;
|
williamr@2
|
38 |
class CEikScrollBarExtensionImpl;
|
williamr@2
|
39 |
class CEikScrollBarExtension;
|
williamr@2
|
40 |
class CAknDoubleSpanScrollBarExtension;
|
williamr@2
|
41 |
|
williamr@2
|
42 |
const TInt KEikScrollEventFromVBar=0;
|
williamr@2
|
43 |
const TInt KEikScrollEventFromHBar=0x01;
|
williamr@2
|
44 |
const TInt KEikScrollEventBarMask=0x01;
|
williamr@2
|
45 |
|
williamr@2
|
46 |
// sets all bits in EButtonsXxx range
|
williamr@2
|
47 |
const TInt KButtonPositionMask=KLafScrollBarButtonPositionMask;
|
williamr@2
|
48 |
|
williamr@2
|
49 |
// sets all bits in determining which components exist
|
williamr@2
|
50 |
const TInt KDisplayComponentsMask=0x1f;
|
williamr@2
|
51 |
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Scroll bar models encapsulate the range of integers which a scroll bar can
|
williamr@2
|
55 |
* represent, from zero to n, and the current position of the scroll bar thumb
|
williamr@2
|
56 |
* within that range.
|
williamr@2
|
57 |
*
|
williamr@2
|
58 |
* Supported from Symbian 5.0.
|
williamr@2
|
59 |
*/
|
williamr@2
|
60 |
class TEikScrollBarModel
|
williamr@2
|
61 |
{
|
williamr@2
|
62 |
|
williamr@2
|
63 |
public:
|
williamr@2
|
64 |
|
williamr@2
|
65 |
/**
|
williamr@2
|
66 |
* C++ default constructor. Creates, allocates and initialises a new @c
|
williamr@2
|
67 |
* TEikScrollBarModel.
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
inline TEikScrollBarModel();
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/**
|
williamr@2
|
72 |
* Constructor. Creates, allocates and initialises a new @c
|
williamr@2
|
73 |
* TEikScrollBarModel.
|
williamr@2
|
74 |
*
|
williamr@2
|
75 |
* @param aScrollSpan The span of this model, numbered from zero.
|
williamr@2
|
76 |
* @param aThumbSpan Number of positions spanned by the thumb.In default
|
williamr@2
|
77 |
* this is zero.
|
williamr@2
|
78 |
* @param aThumbPosition Position of the thumb within the model span. In
|
williamr@2
|
79 |
* default this is zero.
|
williamr@2
|
80 |
*/
|
williamr@2
|
81 |
IMPORT_C TEikScrollBarModel(TInt aScrollSpan,
|
williamr@2
|
82 |
TInt aThumbSpan=0,
|
williamr@2
|
83 |
TInt aThumbPosition=0);
|
williamr@2
|
84 |
|
williamr@2
|
85 |
/**
|
williamr@2
|
86 |
* Tests two models for equality. The two models are the current model and
|
williamr@2
|
87 |
* the model specified by @c aModel.
|
williamr@2
|
88 |
*
|
williamr@2
|
89 |
* @param The model against which the current model is tested.
|
williamr@2
|
90 |
*
|
williamr@2
|
91 |
* @return @c ETrue if the two models are equal.
|
williamr@2
|
92 |
*/
|
williamr@2
|
93 |
IMPORT_C TBool operator==(const TEikScrollBarModel aModel) const;
|
williamr@2
|
94 |
|
williamr@2
|
95 |
/**
|
williamr@2
|
96 |
* Tests two models for inequality. The two models are the current model
|
williamr@2
|
97 |
* and the model specified by @c aModel.
|
williamr@2
|
98 |
*
|
williamr@2
|
99 |
* @param The model against which the current model is tested.
|
williamr@2
|
100 |
* @return @c ETrue if the two models are not equal.
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
inline TBool operator!=(const TEikScrollBarModel aModel) const;
|
williamr@2
|
103 |
|
williamr@2
|
104 |
public:
|
williamr@2
|
105 |
|
williamr@2
|
106 |
/**
|
williamr@2
|
107 |
* Tests whether the scroll bar model is useful. Scroll bar models are only
|
williamr@2
|
108 |
* useful if their thumb span is smaller than their entire span.
|
williamr@2
|
109 |
*
|
williamr@2
|
110 |
* @return Whether this scroll bar can be used.
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
IMPORT_C TBool ScrollBarUseful() const;
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/**
|
williamr@2
|
115 |
* Gets the maximum position possible for the low edge of the thumb within
|
williamr@2
|
116 |
* the total span.
|
williamr@2
|
117 |
*
|
williamr@2
|
118 |
* @return Maximum value possible for @c iThumbPosition.
|
williamr@2
|
119 |
*/
|
williamr@2
|
120 |
IMPORT_C TInt MaxThumbPos() const;
|
williamr@2
|
121 |
|
williamr@2
|
122 |
/**
|
williamr@2
|
123 |
* Ensures that the thumb position remains within its valid range by
|
williamr@2
|
124 |
* altering it if necessary.
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C void CheckBounds();
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/**
|
williamr@2
|
129 |
* Type of scroll bar model. The different models store the scrolling
|
williamr@2
|
130 |
* information in different way, so correct model must be used with correct
|
williamr@2
|
131 |
* scrollbar type.
|
williamr@2
|
132 |
*/
|
williamr@2
|
133 |
enum TEikScrollBarModelType
|
williamr@2
|
134 |
{
|
williamr@2
|
135 |
|
williamr@2
|
136 |
/** This model type is for storing data for the arrowhead scrollbar. */
|
williamr@2
|
137 |
EEikScrollBarModel = 0x00000000,
|
williamr@2
|
138 |
|
williamr@2
|
139 |
/** This model type is for storing data for the spanned scrollbar. */
|
williamr@2
|
140 |
EAknDoubleSpanScrollBarModel = 0x80000000
|
williamr@2
|
141 |
};
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
* Gets type of scroll bar model which is one of the enum values from @c
|
williamr@2
|
145 |
* TEikScrollBarModelType enum.
|
williamr@2
|
146 |
*/
|
williamr@2
|
147 |
TEikScrollBarModel::TEikScrollBarModelType ScrollBarModelType() const;
|
williamr@2
|
148 |
|
williamr@2
|
149 |
public:
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/** Entire range of integers for this model. */
|
williamr@2
|
152 |
TInt iScrollSpan;
|
williamr@2
|
153 |
|
williamr@2
|
154 |
/** Range spanned by the thumb. */
|
williamr@2
|
155 |
TInt iThumbSpan;
|
williamr@2
|
156 |
|
williamr@2
|
157 |
/** Position of the low edge of the thumb within 0...@c iScrollSpan. */
|
williamr@2
|
158 |
TInt iThumbPosition;
|
williamr@2
|
159 |
};
|
williamr@2
|
160 |
|
williamr@2
|
161 |
inline TEikScrollBarModel::TEikScrollBarModel() {}
|
williamr@2
|
162 |
inline TBool TEikScrollBarModel::operator!=(const TEikScrollBarModel aModel) const { return !(*this==aModel); }
|
williamr@2
|
163 |
|
williamr@2
|
164 |
|
williamr@2
|
165 |
//
|
williamr@2
|
166 |
// TAknDoubleSpanScrollBarModel class
|
williamr@2
|
167 |
//
|
williamr@2
|
168 |
// This class is binary compatible with TEikScrollBarModel and can
|
williamr@2
|
169 |
// be used in places where TEikScrollBarModel is used but few restrictions exist:
|
williamr@2
|
170 |
//
|
williamr@2
|
171 |
// - Base class (TEikScrollBarModel) public members must NOT be accessed directly.
|
williamr@2
|
172 |
// - Base class (TEikScrollBarModel) public methods must NOT be called.
|
williamr@2
|
173 |
//
|
williamr@2
|
174 |
// If this model is not supported by the scrollbar system, then values are stored
|
williamr@2
|
175 |
// as in the base class for compatibility resons. See ModelIsSupported()-method
|
williamr@2
|
176 |
// documentation for more information.
|
williamr@2
|
177 |
//
|
williamr@2
|
178 |
class TAknDoubleSpanScrollBarModel : public TEikScrollBarModel
|
williamr@2
|
179 |
{
|
williamr@2
|
180 |
|
williamr@2
|
181 |
public:
|
williamr@2
|
182 |
|
williamr@2
|
183 |
/**
|
williamr@2
|
184 |
* Default constructor.
|
williamr@2
|
185 |
*/
|
williamr@2
|
186 |
IMPORT_C TAknDoubleSpanScrollBarModel();
|
williamr@2
|
187 |
|
williamr@2
|
188 |
/**
|
williamr@2
|
189 |
* Constructor which converts TEikScrollBarModel into TAknDoubleSpanScrollBarModel.
|
williamr@2
|
190 |
*
|
williamr@2
|
191 |
* @since 2.6
|
williamr@2
|
192 |
* @param aEikModel a model that will be converted.
|
williamr@2
|
193 |
*
|
williamr@2
|
194 |
* Allowed range for TEikScrollBarModel values is from 0x1FFF7FFF to -0x1FFF7FFF.
|
williamr@2
|
195 |
* Values outside the allowed range will be truncated to max or min value.
|
williamr@2
|
196 |
* Value will be internally stored with 15 bit accuracy, this means
|
williamr@2
|
197 |
* that the actual stored value may differ from the value given as parameter.
|
williamr@2
|
198 |
*
|
williamr@2
|
199 |
* Values will be converted as:
|
williamr@2
|
200 |
*
|
williamr@2
|
201 |
* TEikScrollBarModel TAknDoubleSpanScrollBarModel
|
williamr@2
|
202 |
* ------------------ ----------------------------
|
williamr@2
|
203 |
* iScrollSpan -> ScrollSpan
|
williamr@2
|
204 |
* iThumbPosition -> FocusPosition
|
williamr@2
|
205 |
* iThumbSpan -> WindowSize
|
williamr@2
|
206 |
* 0 -> FieldPosition
|
williamr@2
|
207 |
* 0 -> FieldSize
|
williamr@2
|
208 |
*
|
williamr@2
|
209 |
*
|
williamr@2
|
210 |
* Values will be internally stored with 15 bit accuracy, this means that the
|
williamr@2
|
211 |
* actual stored value may differ from the value given inside parameter.
|
williamr@2
|
212 |
*
|
williamr@2
|
213 |
*/
|
williamr@2
|
214 |
IMPORT_C TAknDoubleSpanScrollBarModel(const TEikScrollBarModel& aEikModel);
|
williamr@2
|
215 |
|
williamr@2
|
216 |
|
williamr@2
|
217 |
/**
|
williamr@2
|
218 |
* Set methods for model attributes. These MUST be used instead of setting
|
williamr@2
|
219 |
* base class model values directly.
|
williamr@2
|
220 |
*
|
williamr@2
|
221 |
* @since 2.6
|
williamr@2
|
222 |
* @param aValue Value to be stored. Allowed range 0x1FFF7FFF to -0x1FFF7FFF.
|
williamr@2
|
223 |
* Value outside the allowed range will be truncated to max
|
williamr@2
|
224 |
* or min value. Value will be internally stored with
|
williamr@2
|
225 |
* 15 bit accuracy, this means that the actual stored value
|
williamr@2
|
226 |
* may differ from the value given as parameter.
|
williamr@2
|
227 |
*
|
williamr@2
|
228 |
* This inaccuracy means that e.g. following can happen:
|
williamr@2
|
229 |
* TInt value1 = 23456789;
|
williamr@2
|
230 |
* TInt value2 = 0;
|
williamr@2
|
231 |
*
|
williamr@2
|
232 |
* model.SetScrollSpan(value1);
|
williamr@2
|
233 |
* value2 = model.ScrollSpan();
|
williamr@2
|
234 |
* if (value1 != value2)
|
williamr@2
|
235 |
* {
|
williamr@2
|
236 |
* // we can end up here !!!!
|
williamr@2
|
237 |
* }
|
williamr@2
|
238 |
*
|
williamr@2
|
239 |
*/
|
williamr@2
|
240 |
IMPORT_C void SetScrollSpan(TInt aValue); // Size of the scrolled list.
|
williamr@2
|
241 |
IMPORT_C void SetFocusPosition(TInt aValue); // Position of the current field in the list.
|
williamr@2
|
242 |
IMPORT_C void SetWindowSize(TInt aValue); // Size of the visible part of the list.
|
williamr@2
|
243 |
IMPORT_C void SetFieldSize(TInt aValue); // Size of the current field. (Optional double span)
|
williamr@2
|
244 |
IMPORT_C void SetFieldPosition(TInt aValue); // Position inside the current field. (Optional double span)
|
williamr@2
|
245 |
|
williamr@2
|
246 |
|
williamr@2
|
247 |
/**
|
williamr@2
|
248 |
* Get methods for model attributes. These MUST be used instead of getting
|
williamr@2
|
249 |
* base class model values directly.
|
williamr@2
|
250 |
*
|
williamr@2
|
251 |
* @since 2.6
|
williamr@2
|
252 |
* @return Values from range 0x1FFF7FFF to -0x1FFF7FFF.
|
williamr@2
|
253 |
* Values are internally stored with 15 bit accuracy, this means that
|
williamr@2
|
254 |
* the returned value may differ from the value which was set using the
|
williamr@2
|
255 |
* corresponding set method. Difference can be about 0x3FFF in the high
|
williamr@2
|
256 |
* end of the range.
|
williamr@2
|
257 |
*
|
williamr@2
|
258 |
*/
|
williamr@2
|
259 |
IMPORT_C TInt ScrollSpan() const; // Size of the scrolled list.
|
williamr@2
|
260 |
IMPORT_C TInt FocusPosition() const; // Position of the current field in the list.
|
williamr@2
|
261 |
IMPORT_C TInt WindowSize() const; // Size of the visible part of the list.
|
williamr@2
|
262 |
IMPORT_C TInt FieldSize() const; // Size of the current field. (Optional double span)
|
williamr@2
|
263 |
IMPORT_C TInt FieldPosition() const; // Position inside the current field. (Optional double span)
|
williamr@2
|
264 |
|
williamr@2
|
265 |
|
williamr@2
|
266 |
/**
|
williamr@2
|
267 |
* This method can be used to query if this model type is supported by the device. If model
|
williamr@2
|
268 |
* is not supported then this model and the behaviour of ALL methods defaults to TEikScrollBarModel
|
williamr@2
|
269 |
* behaviour with following rules:
|
williamr@2
|
270 |
*
|
williamr@2
|
271 |
* TAknDoubleSpanScrollBarModel TEikScrollBarModel
|
williamr@2
|
272 |
* ---------------------------- ------------------
|
williamr@2
|
273 |
* ScrollSpan methods -> iScrollSpan
|
williamr@2
|
274 |
* FocusPosition methods -> iThumbPosition
|
williamr@2
|
275 |
* WindowSize methods -> iThumbSize
|
williamr@2
|
276 |
* FieldPosition methods -> N/A
|
williamr@2
|
277 |
* FieldSize methods -> N/A
|
williamr@2
|
278 |
*
|
williamr@2
|
279 |
* @since 2.6
|
williamr@2
|
280 |
* @return ETrue if this model is supported by the devices scrollbar system. Otherwise EFalse is
|
williamr@2
|
281 |
* returned.
|
williamr@2
|
282 |
*
|
williamr@2
|
283 |
*/
|
williamr@2
|
284 |
static TBool ModelIsSupported();
|
williamr@2
|
285 |
|
williamr@2
|
286 |
private:
|
williamr@2
|
287 |
/**
|
williamr@2
|
288 |
* Gets the internal scale value.
|
williamr@2
|
289 |
*
|
williamr@2
|
290 |
* @since 2.6
|
williamr@2
|
291 |
* @return Internal scaling value.
|
williamr@2
|
292 |
*
|
williamr@2
|
293 |
*/
|
williamr@2
|
294 |
TUint16 Scale() const;
|
williamr@2
|
295 |
|
williamr@2
|
296 |
/**
|
williamr@2
|
297 |
* Sets the internal scale value.
|
williamr@2
|
298 |
*
|
williamr@2
|
299 |
* @since 2.6
|
williamr@2
|
300 |
* @param aScale New internal scaling value.
|
williamr@2
|
301 |
*
|
williamr@2
|
302 |
*/
|
williamr@2
|
303 |
void SetScale(TUint16 aScale);
|
williamr@2
|
304 |
|
williamr@2
|
305 |
private:
|
williamr@2
|
306 |
/**
|
williamr@2
|
307 |
* Get methods for model attributes values without scaling.
|
williamr@2
|
308 |
*
|
williamr@2
|
309 |
* @since 2.6
|
williamr@2
|
310 |
* @return Stored value without scaling.
|
williamr@2
|
311 |
*
|
williamr@2
|
312 |
*/
|
williamr@2
|
313 |
TInt16 ScrollSpanValue() const;
|
williamr@2
|
314 |
TInt16 FocusPositionValue() const;
|
williamr@2
|
315 |
TInt16 FieldPositionValue() const;
|
williamr@2
|
316 |
TInt16 FieldSizeValue() const;
|
williamr@2
|
317 |
TInt16 WindowSizeValue() const;
|
williamr@2
|
318 |
|
williamr@2
|
319 |
/**
|
williamr@2
|
320 |
* Set methods for model attributes values without scaling.
|
williamr@2
|
321 |
*
|
williamr@2
|
322 |
* @since 2.6
|
williamr@2
|
323 |
* @param aValue Value without scaling to be stored.
|
williamr@2
|
324 |
*
|
williamr@2
|
325 |
*/
|
williamr@2
|
326 |
void SetScrollSpanValue(TInt16 aValue);
|
williamr@2
|
327 |
void SetFocusPositionValue(TInt16 aValue);
|
williamr@2
|
328 |
void SetFieldPositionValue(TInt16 aValue);
|
williamr@2
|
329 |
void SetFieldSizeValue(TInt16 aValue);
|
williamr@2
|
330 |
void SetWindowSizeValue(TInt16 aValue);
|
williamr@2
|
331 |
|
williamr@2
|
332 |
/**
|
williamr@2
|
333 |
* Gets two lowest bytes from TInt and constructs TInt16 from those.
|
williamr@2
|
334 |
*
|
williamr@2
|
335 |
* @since 2.6
|
williamr@2
|
336 |
* @param aInt Value from which the lowest bytes are extracted.
|
williamr@2
|
337 |
* @return TInt16 constructed from two lowest bytes.
|
williamr@2
|
338 |
*/
|
williamr@2
|
339 |
TInt16 LowBytes(TInt aInt) const;
|
williamr@2
|
340 |
|
williamr@2
|
341 |
/**
|
williamr@2
|
342 |
* Gets two highest bytes from TInt and constructs TInt16 from those.
|
williamr@2
|
343 |
*
|
williamr@2
|
344 |
* @since 2.6
|
williamr@2
|
345 |
* @param aInt Value from which the highest bytes are extracted.
|
williamr@2
|
346 |
* @return TInt16 constructed from two highest bytes.
|
williamr@2
|
347 |
*/
|
williamr@2
|
348 |
TInt16 HighBytes(TInt aInt) const;
|
williamr@2
|
349 |
|
williamr@2
|
350 |
|
williamr@2
|
351 |
/**
|
williamr@2
|
352 |
* Sets two lowest bytes of TInt.
|
williamr@2
|
353 |
*
|
williamr@2
|
354 |
* @since 2.6
|
williamr@2
|
355 |
* @param aInt TInt of which the lowest bytes are set.
|
williamr@2
|
356 |
* @param aValue Value for the lowest bytes.
|
williamr@2
|
357 |
*/
|
williamr@2
|
358 |
void SetLowBytes(TInt& aInt, TInt16 aValue);
|
williamr@2
|
359 |
|
williamr@2
|
360 |
/**
|
williamr@2
|
361 |
* Sets two highest bytes of TInt.
|
williamr@2
|
362 |
*
|
williamr@2
|
363 |
* @since 2.6
|
williamr@2
|
364 |
* @param aInt TInt of which the highest bytes are set.
|
williamr@2
|
365 |
* @param aValue Value for the highest bytes.
|
williamr@2
|
366 |
*/
|
williamr@2
|
367 |
void SetHighBytes(TInt& aInt, TInt16 aValue);
|
williamr@2
|
368 |
|
williamr@2
|
369 |
|
williamr@2
|
370 |
/**
|
williamr@2
|
371 |
* Constructs a scaled TInt16 value from given TInt value. Changes
|
williamr@2
|
372 |
* internal member variable values using ReScale()-method if needed.
|
williamr@2
|
373 |
*
|
williamr@2
|
374 |
* @since 2.6
|
williamr@2
|
375 |
* @param aNonScaledValue Value which will be changed to scaled one.
|
williamr@2
|
376 |
* @return Scaled value.
|
williamr@2
|
377 |
*/
|
williamr@2
|
378 |
TInt16 PrepareScaledValue(TInt aNonScaledValue);
|
williamr@2
|
379 |
|
williamr@2
|
380 |
/**
|
williamr@2
|
381 |
* Changes the used scale value and updates all stored attribute values
|
williamr@2
|
382 |
* if needed.
|
williamr@2
|
383 |
*
|
williamr@2
|
384 |
* @since 2.6
|
williamr@2
|
385 |
* @param aNewScale New value to be used scaling.
|
williamr@2
|
386 |
*
|
williamr@2
|
387 |
*/
|
williamr@2
|
388 |
void ReScale(TUint16 aNewScale);
|
williamr@2
|
389 |
|
williamr@2
|
390 |
/**
|
williamr@2
|
391 |
* Sets the scrollbar type.
|
williamr@2
|
392 |
*
|
williamr@2
|
393 |
* @since 2.6
|
williamr@2
|
394 |
* @param aModelType Scrollbar type. Supported types are
|
williamr@2
|
395 |
* EEikScrollBarModel and EAknDoubleSpanScrollBarModel.
|
williamr@2
|
396 |
*
|
williamr@2
|
397 |
*/
|
williamr@2
|
398 |
void SetScrollBarModelType(TEikScrollBarModelType aModelType);
|
williamr@2
|
399 |
|
williamr@2
|
400 |
/**
|
williamr@2
|
401 |
* Checks if given parameter is between internal min and max values.
|
williamr@2
|
402 |
*
|
williamr@2
|
403 |
* @since 2.6
|
williamr@2
|
404 |
* @param aValue Value to be checked.
|
williamr@2
|
405 |
* @return Checked value which will be between internal min
|
williamr@2
|
406 |
* and max values.
|
williamr@2
|
407 |
*
|
williamr@2
|
408 |
*/
|
williamr@2
|
409 |
TInt CheckMinMaxValue(TInt aValue);
|
williamr@2
|
410 |
};
|
williamr@2
|
411 |
|
williamr@2
|
412 |
|
williamr@2
|
413 |
//
|
williamr@2
|
414 |
// CEikScrollBar
|
williamr@2
|
415 |
//
|
williamr@2
|
416 |
|
williamr@2
|
417 |
class CEikScrollThumb;
|
williamr@2
|
418 |
class CEikScrollBarFrame;
|
williamr@2
|
419 |
|
williamr@2
|
420 |
/**
|
williamr@2
|
421 |
* The CEikScrollBar class implements a scroll bar. Scroll bars are used when
|
williamr@2
|
422 |
* the contents of a view require a greater area than can be physically
|
williamr@2
|
423 |
* displayed. Scroll bars allow a user to move different parts of the content
|
williamr@2
|
424 |
* into the view and to indicate what proportion of the total contents are
|
williamr@2
|
425 |
* visible at any one time.
|
williamr@2
|
426 |
*/
|
williamr@2
|
427 |
class CEikScrollBar : public CEikBorderedControl, public MCoeControlObserver
|
williamr@2
|
428 |
{
|
williamr@2
|
429 |
friend class CEikScrollBarExtension;
|
williamr@2
|
430 |
friend class CAknDoubleSpanScrollBarExtension;
|
williamr@2
|
431 |
|
williamr@2
|
432 |
public:
|
williamr@2
|
433 |
|
williamr@2
|
434 |
/** Scroll bar orientation. */
|
williamr@2
|
435 |
enum TOrientation
|
williamr@2
|
436 |
{
|
williamr@2
|
437 |
/** Scroll bar is oriented vertically. */
|
williamr@2
|
438 |
EVertical = SLafScrollBar::EVertical,
|
williamr@2
|
439 |
|
williamr@2
|
440 |
/** Scroll bar is oriented horizontally. */
|
williamr@2
|
441 |
EHorizontal = SLafScrollBar::EHorizontal
|
williamr@2
|
442 |
};
|
williamr@2
|
443 |
|
williamr@2
|
444 |
/** Type of the scroll bar.*/
|
williamr@2
|
445 |
enum TScrollBarType
|
williamr@2
|
446 |
{
|
williamr@2
|
447 |
/** Normal scrollbar. */
|
williamr@2
|
448 |
ENormalScrollBar =0x0,
|
williamr@2
|
449 |
|
williamr@2
|
450 |
/** Used scrollbar type is an old one. (arrows in the CBA-area) */
|
williamr@2
|
451 |
EArrowHead =0x200,
|
williamr@2
|
452 |
|
williamr@2
|
453 |
/**
|
williamr@2
|
454 |
* The created scrollbar is the current and commonly used in Series 60
|
williamr@2
|
455 |
* platform, spanned scrollbar. (scrollable bar on the right side of
|
williamr@2
|
456 |
* the control, like in windows etc.).
|
williamr@2
|
457 |
*/
|
williamr@2
|
458 |
EDoubleSpan =0x400
|
williamr@2
|
459 |
};
|
williamr@2
|
460 |
|
williamr@2
|
461 |
/**
|
williamr@2
|
462 |
* Scroll bar initialisation flags. The default is for the scroll bar
|
williamr@2
|
463 |
* to have both a shaft and a thumb.
|
williamr@2
|
464 |
*/
|
williamr@2
|
465 |
enum TEikScrollBarFlags
|
williamr@2
|
466 |
{
|
williamr@2
|
467 |
/** */
|
williamr@2
|
468 |
EEikScrollBarDefaultBehaviour =
|
williamr@2
|
469 |
SLafScrollBar::EEikScrollBarDefaultBehaviour,
|
williamr@2
|
470 |
|
williamr@2
|
471 |
/** Does not display nudge buttons.*/
|
williamr@2
|
472 |
EEikScrollBarNoNudgeButtons =
|
williamr@2
|
473 |
SLafScrollBar::EEikScrollBarNoNudgeButtons,
|
williamr@2
|
474 |
|
williamr@2
|
475 |
/** Has buttons which move it a page at a time. */
|
williamr@2
|
476 |
EEikScrollBarHasPageButtons =
|
williamr@2
|
477 |
SLafScrollBar::EEikScrollBarHasPageButtons,
|
williamr@2
|
478 |
|
williamr@2
|
479 |
/** Has buttons which move it its entire extent. */
|
williamr@2
|
480 |
EEikScrollBarHasHomeEndButtons =
|
williamr@2
|
481 |
SLafScrollBar::EEikScrollBarHasHomeEndButtons,
|
williamr@2
|
482 |
|
williamr@2
|
483 |
/** Central area is empty. */
|
williamr@2
|
484 |
EEikScrollBarNoShaftOrThumb =
|
williamr@2
|
485 |
SLafScrollBar::EEikScrollBarNoShaftOrThumb,
|
williamr@2
|
486 |
|
williamr@2
|
487 |
/** Central area has no scroll thumb. */
|
williamr@2
|
488 |
EEikScrollBarShaftButNoThumb =
|
williamr@2
|
489 |
SLafScrollBar::EEikScrollBarShaftButNoThumb,
|
williamr@2
|
490 |
|
williamr@2
|
491 |
/** Buttons are placed at the start of the bar. */
|
williamr@2
|
492 |
EButtonsAtStartOfShaft =
|
williamr@2
|
493 |
SLafScrollBar::EButtonsAtStartOfShaft,
|
williamr@2
|
494 |
|
williamr@2
|
495 |
/** Buttons are placed at the end of the bar. */
|
williamr@2
|
496 |
EButtonsAtEndOfShaft =
|
williamr@2
|
497 |
SLafScrollBar::EButtonsAtEndOfShaft,
|
williamr@2
|
498 |
|
williamr@2
|
499 |
/**
|
williamr@2
|
500 |
* Buttons are placed at either end of the bar @c
|
williamr@2
|
501 |
* (EButtonsAtStartOfShaft | @c EButtonsAtEndOfShaft).
|
williamr@2
|
502 |
*/
|
williamr@2
|
503 |
EButtonsEitherSideOfShaft =
|
williamr@2
|
504 |
SLafScrollBar::EButtonsEitherSideOfShaft,
|
williamr@2
|
505 |
|
williamr@2
|
506 |
/**
|
williamr@2
|
507 |
* Buttons do not automatically dim when scroll bar is at its maximum
|
williamr@2
|
508 |
* extent.
|
williamr@2
|
509 |
*/
|
williamr@2
|
510 |
ENoAutoDimming =
|
williamr@2
|
511 |
SLafScrollBar::ENoAutoDimming,
|
williamr@2
|
512 |
|
williamr@2
|
513 |
/** Enable the nudge buttons. */
|
williamr@2
|
514 |
EEnableNudgeButtons = 0x0200,
|
williamr@2
|
515 |
|
williamr@2
|
516 |
/** Disable the expanded touch area. */
|
williamr@2
|
517 |
EDisableExpandedTouchArea = 0x0400
|
williamr@2
|
518 |
};
|
williamr@2
|
519 |
|
williamr@2
|
520 |
/** Type of the scroll extension area.*/
|
williamr@2
|
521 |
enum TScrollBarExtensionAreaType
|
williamr@2
|
522 |
{
|
williamr@2
|
523 |
/** Normal scrollbar extension area. */
|
williamr@2
|
524 |
ENormalExpandedTouchArea,
|
williamr@2
|
525 |
|
williamr@2
|
526 |
/** Scale scrollbar extension area. */
|
williamr@2
|
527 |
EScaleExpandedTouchArea,
|
williamr@2
|
528 |
|
williamr@2
|
529 |
/** none scrollbar extension area. */
|
williamr@2
|
530 |
ENoExpandedTouchArea
|
williamr@2
|
531 |
};
|
williamr@2
|
532 |
|
williamr@2
|
533 |
typedef TEikScrollBarFlags TAknScrollBarFlags;
|
williamr@2
|
534 |
|
williamr@2
|
535 |
public:
|
williamr@2
|
536 |
|
williamr@2
|
537 |
/**
|
williamr@2
|
538 |
* Destructor.
|
williamr@2
|
539 |
*/
|
williamr@2
|
540 |
IMPORT_C ~CEikScrollBar();
|
williamr@2
|
541 |
|
williamr@2
|
542 |
/**
|
williamr@2
|
543 |
* C++ default constructor.
|
williamr@2
|
544 |
*/
|
williamr@2
|
545 |
IMPORT_C CEikScrollBar();
|
williamr@2
|
546 |
|
williamr@2
|
547 |
public:
|
williamr@2
|
548 |
|
williamr@2
|
549 |
/**
|
williamr@2
|
550 |
* Second phase constructor of the scroll bar.
|
williamr@2
|
551 |
*
|
williamr@2
|
552 |
* @param aScrollBarObserver The scroll bar observer which is to be
|
williamr@2
|
553 |
* informed of scroll events by this scroll bar.
|
williamr@2
|
554 |
* @param aParent Parent control for this new scroll bar.
|
williamr@2
|
555 |
* @param aOrientation Orientation of the new scroll bar.
|
williamr@2
|
556 |
* @param aLength Not used.
|
williamr@2
|
557 |
* @param aScrollBarFlags Not used.
|
williamr@2
|
558 |
*/
|
williamr@2
|
559 |
IMPORT_C virtual void ConstructL(
|
williamr@2
|
560 |
MEikScrollBarObserver* aScrollBarObserver,
|
williamr@2
|
561 |
const CCoeControl* aParent,
|
williamr@2
|
562 |
TOrientation aOrientation,
|
williamr@2
|
563 |
TInt aLength,
|
williamr@2
|
564 |
TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
|
williamr@2
|
565 |
|
williamr@2
|
566 |
/**
|
williamr@2
|
567 |
* Not implemented.
|
williamr@2
|
568 |
*
|
williamr@2
|
569 |
* @param aLength Not used.
|
williamr@2
|
570 |
*/
|
williamr@2
|
571 |
IMPORT_C void SetLengthL(TInt aLength);
|
williamr@2
|
572 |
|
williamr@2
|
573 |
/**
|
williamr@2
|
574 |
* Change the scrollbar model.
|
williamr@2
|
575 |
*
|
williamr@2
|
576 |
* @param aModel The new model to use.
|
williamr@2
|
577 |
*/
|
williamr@2
|
578 |
IMPORT_C void SetModelL(const TEikScrollBarModel* aModel);
|
williamr@2
|
579 |
|
williamr@2
|
580 |
/**
|
williamr@2
|
581 |
* Change the scrollbar model.
|
williamr@2
|
582 |
*
|
williamr@2
|
583 |
* @param aModel The new model to use.
|
williamr@2
|
584 |
*/
|
williamr@2
|
585 |
IMPORT_C void SetModel(const TEikScrollBarModel* aModel);
|
williamr@2
|
586 |
|
williamr@2
|
587 |
/**
|
williamr@2
|
588 |
* Change the model at once to avoid a double update of the scroll bar.
|
williamr@2
|
589 |
*
|
williamr@2
|
590 |
* @param aLength Not used.
|
williamr@2
|
591 |
* @param aModel New scroll bar model.
|
williamr@2
|
592 |
*/
|
williamr@2
|
593 |
IMPORT_C void SetLengthAndModelL(TInt aLength,
|
williamr@2
|
594 |
const TEikScrollBarModel* aModel);
|
williamr@2
|
595 |
|
williamr@2
|
596 |
/**
|
williamr@2
|
597 |
* Not implemented.
|
williamr@2
|
598 |
*
|
williamr@2
|
599 |
* @param aThumbPos Not used.
|
williamr@2
|
600 |
*/
|
williamr@2
|
601 |
IMPORT_C void SetModelThumbPosition(TInt aThumbPos);
|
williamr@2
|
602 |
|
williamr@2
|
603 |
/**
|
williamr@2
|
604 |
* Not implemented.
|
williamr@2
|
605 |
*
|
williamr@2
|
606 |
* @param aFocusPosition Not used.
|
williamr@2
|
607 |
*/
|
williamr@2
|
608 |
IMPORT_C void SetFocusPosToThumbPos(TInt aFocusPosition);
|
williamr@2
|
609 |
|
williamr@2
|
610 |
/**
|
williamr@2
|
611 |
* Gets the default width of the scroll bar.
|
williamr@2
|
612 |
*
|
williamr@2
|
613 |
* @return Default scroll bar breadth.
|
williamr@2
|
614 |
*/
|
williamr@2
|
615 |
IMPORT_C static TInt DefaultScrollBarBreadth();
|
williamr@2
|
616 |
|
williamr@2
|
617 |
/**
|
williamr@2
|
618 |
* Allows scroll bar observer to be changed also after the construction.
|
williamr@2
|
619 |
* This function is not exported, but the applications can use it via
|
williamr@2
|
620 |
* @c CEikScrollBarFrame::SetScrollBarFrameObserver function.
|
williamr@2
|
621 |
*
|
williamr@2
|
622 |
* @param aScrollBarObserver New observer replacing the previous (if any).
|
williamr@2
|
623 |
*/
|
williamr@2
|
624 |
void SetScrollBarObserver(MEikScrollBarObserver* aScrollBarObserver);
|
williamr@2
|
625 |
|
williamr@2
|
626 |
/**
|
williamr@2
|
627 |
* Gets the scroll bar model used by this scroll bar.
|
williamr@2
|
628 |
*/
|
williamr@2
|
629 |
inline const TEikScrollBarModel* Model() const;
|
williamr@2
|
630 |
|
williamr@2
|
631 |
/**
|
williamr@2
|
632 |
* Gets the position within the scroll bar model. This function would
|
williamr@2
|
633 |
* normally be called by an @c MEikScrollBarObserver implementation in
|
williamr@2
|
634 |
* response to a scroll bar event.
|
williamr@2
|
635 |
*
|
williamr@2
|
636 |
* @return Current position within the scroll bar model’s range.
|
williamr@2
|
637 |
*/
|
williamr@2
|
638 |
IMPORT_C TInt ThumbPosition() const;
|
williamr@2
|
639 |
|
williamr@2
|
640 |
/**
|
williamr@2
|
641 |
* Gets the height of a horizontal scrollbar or width of a vertical
|
williamr@2
|
642 |
* scrollbar.
|
williamr@2
|
643 |
*
|
williamr@2
|
644 |
* @return Scroll bar breadth.
|
williamr@2
|
645 |
*/
|
williamr@2
|
646 |
IMPORT_C TInt ScrollBarBreadth() const;
|
williamr@2
|
647 |
|
williamr@2
|
648 |
/**
|
williamr@2
|
649 |
* Not implemented.
|
williamr@2
|
650 |
*
|
williamr@2
|
651 |
* @param aScrollBarFlags Not used.
|
williamr@2
|
652 |
*
|
williamr@2
|
653 |
* @return Zero.
|
williamr@2
|
654 |
*/
|
williamr@2
|
655 |
IMPORT_C static TInt MinVisibleLength(const TInt aScrollBarFlags);
|
williamr@2
|
656 |
|
williamr@2
|
657 |
/**
|
williamr@2
|
658 |
* Not implemented.
|
williamr@2
|
659 |
*
|
williamr@2
|
660 |
* @param aDimmed Not used.
|
williamr@2
|
661 |
*/
|
williamr@2
|
662 |
IMPORT_C void SetDecreaseButtonsDimmed(TBool aDimmed);
|
williamr@2
|
663 |
|
williamr@2
|
664 |
/**
|
williamr@2
|
665 |
* Not implemented.
|
williamr@2
|
666 |
*
|
williamr@2
|
667 |
* @param aDimmed Not used.
|
williamr@2
|
668 |
*/
|
williamr@2
|
669 |
IMPORT_C void SetIncreaseButtonsDimmed(TBool aDimmed);
|
williamr@2
|
670 |
|
williamr@2
|
671 |
/**
|
williamr@2
|
672 |
* Not implemented.
|
williamr@2
|
673 |
*
|
williamr@2
|
674 |
* @param aDimmed Not used.
|
williamr@2
|
675 |
*/
|
williamr@2
|
676 |
IMPORT_C void SetAllButtonsDimmed(TBool aDimmed);
|
williamr@2
|
677 |
|
williamr@2
|
678 |
/**
|
williamr@2
|
679 |
* Gets handle to the controls that draw arrows in the both ends of spanned
|
williamr@2
|
680 |
* scrollbar. These arrows are for pen support to enable exact moving of
|
williamr@2
|
681 |
* the scrollbar with pen. The arrow is tapped with the pen to move the
|
williamr@2
|
682 |
* scrollbar with one step.
|
williamr@2
|
683 |
*
|
williamr@2
|
684 |
* @return Pointer to the increace button.
|
williamr@2
|
685 |
*/
|
williamr@2
|
686 |
inline CAknScrollButton* IncreaseNudgeButton() const;
|
williamr@2
|
687 |
|
williamr@2
|
688 |
/**
|
williamr@2
|
689 |
* Gets handle to the controls that draw arrows in the both ends of spanned
|
williamr@2
|
690 |
* scrollbar. These arrows are for pen support to enable exact moving of
|
williamr@2
|
691 |
* the scrollbar with pen. The arrow is tapped with the pen to move the
|
williamr@2
|
692 |
* scrollbar with one step.
|
williamr@2
|
693 |
*
|
williamr@2
|
694 |
* @return Pointer to the decreace button.
|
williamr@2
|
695 |
*/
|
williamr@2
|
696 |
inline CAknScrollButton* DecreaseNudgeButton() const;
|
williamr@2
|
697 |
|
williamr@2
|
698 |
// This function should only be used by CEikCba
|
williamr@2
|
699 |
/**
|
williamr@2
|
700 |
* Sets command button area. This function should only be used by @c
|
williamr@2
|
701 |
* CEikCba.
|
williamr@2
|
702 |
*
|
williamr@2
|
703 |
* @param aCba Command button area.
|
williamr@2
|
704 |
* @panic EEikPanicScrollBarExtensionNotCreated Extension of
|
williamr@2
|
705 |
* the scroll bar not created.
|
williamr@2
|
706 |
*/
|
williamr@2
|
707 |
IMPORT_C void SetContainingCba(CEikCba* aCba);
|
williamr@2
|
708 |
|
williamr@2
|
709 |
/**
|
williamr@2
|
710 |
* From @c CCoeControl.
|
williamr@2
|
711 |
*
|
williamr@2
|
712 |
* Sets this control as visible or invisible.
|
williamr@2
|
713 |
*
|
williamr@2
|
714 |
* If @c MakeVisible() is used to make a component visible, and the control
|
williamr@2
|
715 |
* captures the pointer (see @c CapturesPointer()), @c MakeVisible() throws
|
williamr@2
|
716 |
* away any pending pointer events for that control.
|
williamr@2
|
717 |
*
|
williamr@2
|
718 |
* @param aVisible @c ETrue to make the control visible, @c EFalse to make
|
williamr@2
|
719 |
* it invisible.
|
williamr@2
|
720 |
*/
|
williamr@2
|
721 |
IMPORT_C void MakeVisible(TBool aVisible);
|
williamr@2
|
722 |
|
williamr@2
|
723 |
//
|
williamr@2
|
724 |
/**
|
williamr@2
|
725 |
* From @c CCoeControl
|
williamr@2
|
726 |
*
|
williamr@2
|
727 |
* Called by the framework to handle pointer events.
|
williamr@2
|
728 |
*
|
williamr@2
|
729 |
* @param aPointerEvent A pointer event.
|
williamr@2
|
730 |
*/
|
williamr@2
|
731 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
732 |
|
williamr@2
|
733 |
/**
|
williamr@2
|
734 |
* Not implemented.
|
williamr@2
|
735 |
*
|
williamr@2
|
736 |
* @param aType The extension area to use.
|
williamr@2
|
737 |
*/
|
williamr@2
|
738 |
|
williamr@2
|
739 |
IMPORT_C void SetExtensionAreaType(TScrollBarExtensionAreaType aType);
|
williamr@2
|
740 |
protected:
|
williamr@2
|
741 |
|
williamr@2
|
742 |
/**
|
williamr@2
|
743 |
* From @c CCoeControl
|
williamr@2
|
744 |
*
|
williamr@2
|
745 |
* Gets the specified scrollbar component. Each component control is
|
williamr@2
|
746 |
* identified by an index, where the index depends on the order the
|
williamr@2
|
747 |
* controls were added: the first is given an index of 0, the next an index
|
williamr@2
|
748 |
* of 1.
|
williamr@2
|
749 |
*
|
williamr@2
|
750 |
* @param aIndex The index of the control to get.
|
williamr@2
|
751 |
*
|
williamr@2
|
752 |
* @return The component control with an index of aIndex.
|
williamr@2
|
753 |
*/
|
williamr@2
|
754 |
IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@2
|
755 |
|
williamr@2
|
756 |
/**
|
williamr@2
|
757 |
* From @cCCoeControl.
|
williamr@2
|
758 |
*
|
williamr@2
|
759 |
* Gets the number of controls contained in this scrollbar.
|
williamr@2
|
760 |
*
|
williamr@2
|
761 |
* @return The number of component controls contained by this scrollbar.
|
williamr@2
|
762 |
*/
|
williamr@2
|
763 |
IMPORT_C TInt CountComponentControls() const;
|
williamr@2
|
764 |
|
williamr@2
|
765 |
private: // from MCoeControlObserver
|
williamr@2
|
766 |
IMPORT_C virtual void HandleControlEventL(CCoeControl* aControl,
|
williamr@2
|
767 |
TCoeEvent aEventType);
|
williamr@2
|
768 |
private: // virtual - reserved from CCoeControl
|
williamr@2
|
769 |
IMPORT_C virtual void Reserved_2();
|
williamr@2
|
770 |
private:
|
williamr@2
|
771 |
/**
|
williamr@2
|
772 |
* From CAknControl
|
williamr@2
|
773 |
*/
|
williamr@2
|
774 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
775 |
|
williamr@2
|
776 |
protected:
|
williamr@2
|
777 |
|
williamr@2
|
778 |
/**
|
williamr@2
|
779 |
* The scroll bar frame is a control assemblage manager that relates a
|
williamr@2
|
780 |
* control, or control body, to two scroll bars and a corner window. A
|
williamr@2
|
781 |
* corner window is that part of the screen that is common to both the
|
williamr@2
|
782 |
* horizontal, and the vertical elements of a scroll bar.
|
williamr@2
|
783 |
*
|
williamr@2
|
784 |
* This class helps with access to, and set up of, scroll bars and also
|
williamr@2
|
785 |
* with the layout of the scrolled control or control body. A scroll bar
|
williamr@2
|
786 |
* frame is not a control, but it does implement the standard control
|
williamr@2
|
787 |
* composite pattern to manage the assemblage.
|
williamr@2
|
788 |
*/
|
williamr@2
|
789 |
friend class CEikScrollBarFrame;
|
williamr@2
|
790 |
|
williamr@2
|
791 |
// enums
|
williamr@2
|
792 |
/**
|
williamr@2
|
793 |
* Flags to determine whether there are visible components and whether to
|
williamr@2
|
794 |
* dim the increase, or decrease, buttons.
|
williamr@2
|
795 |
*/
|
williamr@2
|
796 |
enum TPrivateScrollBarFlags
|
williamr@2
|
797 |
{
|
williamr@2
|
798 |
|
williamr@2
|
799 |
/** There are no visible components in the scroll bar. */
|
williamr@2
|
800 |
ENoComponentsToDisplay =0x10000,
|
williamr@2
|
801 |
|
williamr@2
|
802 |
/** Dim the increase buttons. */
|
williamr@2
|
803 |
EIncreaseButtonsDimmed =0x20000,
|
williamr@2
|
804 |
|
williamr@2
|
805 |
/** Dim the decrease buttons. */
|
williamr@2
|
806 |
EDecreaseButtonsDimmed =0x40000
|
williamr@2
|
807 |
};
|
williamr@2
|
808 |
|
williamr@2
|
809 |
/** Determines where on a scroll bar a pointer down event occurred. */
|
williamr@2
|
810 |
enum TPointerDownOn
|
williamr@2
|
811 |
{
|
williamr@2
|
812 |
/** No pointer down event occurred on the scroll bar. */
|
williamr@2
|
813 |
ENone,
|
williamr@2
|
814 |
|
williamr@2
|
815 |
/** A pointer down event occurred on the home button. */
|
williamr@2
|
816 |
EHomeButton,
|
williamr@2
|
817 |
|
williamr@2
|
818 |
/** A pointer down event occurred on the decrease page button. */
|
williamr@2
|
819 |
EDecreasePageButton,
|
williamr@2
|
820 |
|
williamr@2
|
821 |
/** A pointer down event occurred on the decrease nudge button. */
|
williamr@2
|
822 |
EDecreaseNudgeButton,
|
williamr@2
|
823 |
|
williamr@2
|
824 |
/** A pointer down event occurred on the decrease shaft button. */
|
williamr@2
|
825 |
EDecreaseShaft,
|
williamr@2
|
826 |
|
williamr@2
|
827 |
/** A pointer down event occurred on the scroll bar thumb. */
|
williamr@2
|
828 |
EThumb,
|
williamr@2
|
829 |
|
williamr@2
|
830 |
/** A pointer down event occurred on the increase shaft button. */
|
williamr@2
|
831 |
EIncreaseShaft,
|
williamr@2
|
832 |
|
williamr@2
|
833 |
/** A pointer down event occurred on the increase nudge button. */
|
williamr@2
|
834 |
EIncreaseNudgeButton,
|
williamr@2
|
835 |
|
williamr@2
|
836 |
/** A pointer down event occurred on the increase page button. */
|
williamr@2
|
837 |
EIncreasePageButton,
|
williamr@2
|
838 |
|
williamr@2
|
839 |
/** A pointer down event occurred on the end button. */
|
williamr@2
|
840 |
EEndButton
|
williamr@2
|
841 |
};
|
williamr@2
|
842 |
|
williamr@2
|
843 |
/** Determines whether to redraw the scroll bar shaft. */
|
williamr@2
|
844 |
enum TShaftRedrawRequired
|
williamr@2
|
845 |
{
|
williamr@2
|
846 |
/** Do not redraw the scroll bar shaft. */
|
williamr@2
|
847 |
ENoRedrawRequired,
|
williamr@2
|
848 |
|
williamr@2
|
849 |
/** Redraw the scroll bar shaft. */
|
williamr@2
|
850 |
ERedrawShaft
|
williamr@2
|
851 |
};
|
williamr@2
|
852 |
|
williamr@2
|
853 |
/** Determines which buttons are displayed. */
|
williamr@2
|
854 |
enum TWhichButtons
|
williamr@2
|
855 |
{
|
williamr@2
|
856 |
/** Display the increase buttons only. */
|
williamr@2
|
857 |
EIncreaseOnly,
|
williamr@2
|
858 |
|
williamr@2
|
859 |
/** Display the decrease buttons only. */
|
williamr@2
|
860 |
EDecreaseOnly,
|
williamr@2
|
861 |
|
williamr@2
|
862 |
/** Display all buttons. */
|
williamr@2
|
863 |
EAll
|
williamr@2
|
864 |
};
|
williamr@2
|
865 |
|
williamr@2
|
866 |
/**
|
williamr@2
|
867 |
* Encapsulates pointers to the scroll bar buttons. A maximum of three
|
williamr@2
|
868 |
* pairs of buttons are available, you may choose to use only one pair or
|
williamr@2
|
869 |
* two pairs.
|
williamr@2
|
870 |
*/
|
williamr@2
|
871 |
struct SEikScrollBarButtons
|
williamr@2
|
872 |
{
|
williamr@2
|
873 |
/** Pointer to the decrease nudge button. */
|
williamr@2
|
874 |
CAknScrollButton* iDecreaseNudge;
|
williamr@2
|
875 |
|
williamr@2
|
876 |
/** Pointer to the increase nudge button. */
|
williamr@2
|
877 |
CAknScrollButton* iIncreaseNudge;
|
williamr@2
|
878 |
};
|
williamr@2
|
879 |
|
williamr@2
|
880 |
|
williamr@2
|
881 |
private:
|
williamr@2
|
882 |
// construction/destruction
|
williamr@2
|
883 |
IMPORT_C virtual void CreateButtonL(CAknScrollButton*& aButton,
|
williamr@2
|
884 |
CAknScrollButton::TType aType);
|
williamr@2
|
885 |
|
williamr@2
|
886 |
void SizeChanged();
|
williamr@2
|
887 |
|
williamr@2
|
888 |
// set state functions
|
williamr@2
|
889 |
void DoSetModel(const TEikScrollBarModel* aModel);
|
williamr@2
|
890 |
|
williamr@2
|
891 |
CEikCba* Cba() const;
|
williamr@2
|
892 |
|
williamr@2
|
893 |
// These functions are for use only be CEikScrollBarFrame (a friend class)
|
williamr@2
|
894 |
void AddExternalFrameL(CEikScrollBarFrame* aFrame);
|
williamr@2
|
895 |
void RemoveExternalFrame(CEikScrollBarFrame* aFrame);
|
williamr@2
|
896 |
|
williamr@2
|
897 |
void DisconnectExternalFrames();
|
williamr@2
|
898 |
|
williamr@2
|
899 |
protected:
|
williamr@2
|
900 |
|
williamr@2
|
901 |
/**
|
williamr@2
|
902 |
* Allocates and constructs all the required components of the scrollbar.
|
williamr@2
|
903 |
*/
|
williamr@2
|
904 |
void CreateRequiredComponentsL();
|
williamr@2
|
905 |
|
williamr@2
|
906 |
/**
|
williamr@2
|
907 |
* Destroys a button.
|
williamr@2
|
908 |
*
|
williamr@2
|
909 |
* @param aButton A button that will be destroyed.
|
williamr@2
|
910 |
*/
|
williamr@2
|
911 |
void DestroyButton(CAknScrollButton*& aButton);
|
williamr@2
|
912 |
|
williamr@2
|
913 |
/**
|
williamr@2
|
914 |
* Not implemented
|
williamr@2
|
915 |
*
|
williamr@2
|
916 |
* @param aButton Not used.
|
williamr@2
|
917 |
*/
|
williamr@2
|
918 |
IMPORT_C virtual void SetButtonPositionL(CAknScrollButton* aButton);
|
williamr@2
|
919 |
|
williamr@2
|
920 |
public:
|
williamr@2
|
921 |
|
williamr@2
|
922 |
/**
|
williamr@2
|
923 |
* Gets the scroll bar type.
|
williamr@2
|
924 |
*
|
williamr@2
|
925 |
* @return Value of the enum @c TScrollBarType.
|
williamr@2
|
926 |
*/
|
williamr@2
|
927 |
TScrollBarType ScrollBarType();
|
williamr@2
|
928 |
|
williamr@2
|
929 |
public:
|
williamr@2
|
930 |
|
williamr@2
|
931 |
/** Not used, but cannot be removed due binary compatibility issues. */
|
williamr@2
|
932 |
TDblQueLink iSBLink;
|
williamr@2
|
933 |
|
williamr@2
|
934 |
protected:
|
williamr@2
|
935 |
|
williamr@2
|
936 |
/** Scroll bar buttons struct. */
|
williamr@2
|
937 |
SEikScrollBarButtons iButtons;
|
williamr@2
|
938 |
|
williamr@2
|
939 |
/** Scroll bar orientation. */
|
williamr@2
|
940 |
TOrientation iOrientation;
|
williamr@2
|
941 |
|
williamr@2
|
942 |
private:
|
williamr@2
|
943 |
TEikScrollBarModel iModel;
|
williamr@2
|
944 |
|
williamr@2
|
945 |
protected:
|
williamr@2
|
946 |
|
williamr@2
|
947 |
/** A pointer to @c CEikScrollBarExtensionImpl class. */
|
williamr@2
|
948 |
CEikScrollBarExtensionImpl* iExtension;
|
williamr@2
|
949 |
};
|
williamr@2
|
950 |
|
williamr@2
|
951 |
|
williamr@2
|
952 |
/**
|
williamr@2
|
953 |
* The CEikArrowHeadScrollBar class is a scroll bar which uses only
|
williamr@2
|
954 |
* two small nudge button arrows to scroll up and down. It has no shaft.
|
williamr@2
|
955 |
* It therefore takes up very little space.
|
williamr@2
|
956 |
*
|
williamr@2
|
957 |
* @since ER5U
|
williamr@2
|
958 |
* @ internal
|
williamr@2
|
959 |
* Internal to Symbian
|
williamr@2
|
960 |
*
|
williamr@2
|
961 |
*/
|
williamr@2
|
962 |
class CEikArrowHeadScrollBar : public CEikScrollBar
|
williamr@2
|
963 |
{
|
williamr@2
|
964 |
public:
|
williamr@2
|
965 |
IMPORT_C CEikArrowHeadScrollBar(CCoeControl* aParentWindow);
|
williamr@2
|
966 |
IMPORT_C ~CEikArrowHeadScrollBar();
|
williamr@2
|
967 |
public: // from CEikScrollBar
|
williamr@2
|
968 |
IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
|
williamr@2
|
969 |
TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
|
williamr@2
|
970 |
public: // From CCoeControl
|
williamr@2
|
971 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
972 |
private: // from CEikScrollBar
|
williamr@2
|
973 |
void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
|
williamr@2
|
974 |
void SetButtonPositionL(CAknScrollButton* aButton);
|
williamr@2
|
975 |
private:
|
williamr@2
|
976 |
private:
|
williamr@2
|
977 |
/**
|
williamr@2
|
978 |
* From CAknControl
|
williamr@2
|
979 |
*/
|
williamr@2
|
980 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
981 |
private:
|
williamr@2
|
982 |
CCoeControl* iParentControl;
|
williamr@2
|
983 |
TInt iSpare;
|
williamr@2
|
984 |
};
|
williamr@2
|
985 |
|
williamr@2
|
986 |
|
williamr@2
|
987 |
/**
|
williamr@2
|
988 |
* The CAknDoubleSpanScrollBar class is a scroll bar without buttons,
|
williamr@2
|
989 |
* but it has a shaft. Additionally it has in its shaft a double
|
williamr@2
|
990 |
* span feature which means that there can be another thumb inside the thumb
|
williamr@2
|
991 |
* if needed.
|
williamr@2
|
992 |
*
|
williamr@2
|
993 |
* This class uses TAknDoubleSpanScrollBarModel instead of TEikScrollBarModel
|
williamr@2
|
994 |
* as its internal scrollbar model. TAknDoubleSpanScrollBarModel in binary
|
williamr@2
|
995 |
* compatible with TEikScrollBarModel. User must take care that TAknDoubleSpanScrollBarModel
|
williamr@2
|
996 |
* is really used in API calls in places where TEikScrollBarModel is declared.
|
williamr@2
|
997 |
*
|
williamr@2
|
998 |
* @since 2.6
|
williamr@2
|
999 |
*
|
williamr@2
|
1000 |
*/
|
williamr@2
|
1001 |
class CAknDoubleSpanScrollBar : public CEikScrollBar
|
williamr@2
|
1002 |
{
|
williamr@2
|
1003 |
public:
|
williamr@2
|
1004 |
IMPORT_C CAknDoubleSpanScrollBar(CCoeControl* aParentWindow);
|
williamr@2
|
1005 |
IMPORT_C ~CAknDoubleSpanScrollBar();
|
williamr@2
|
1006 |
|
williamr@2
|
1007 |
/**
|
williamr@2
|
1008 |
* Sets fixed layout to scrollbar. If set, then scrollbar size
|
williamr@2
|
1009 |
* changes done by the CEikScrollBarFrame class are disabled.
|
williamr@2
|
1010 |
*
|
williamr@2
|
1011 |
* @since 2.6
|
williamr@2
|
1012 |
* @param aScrollBarRect Scrollbar rectangle.
|
williamr@2
|
1013 |
*
|
williamr@2
|
1014 |
*/
|
williamr@2
|
1015 |
IMPORT_C void SetFixedLayoutRect(TRect aScrollBarRect);
|
williamr@2
|
1016 |
|
williamr@2
|
1017 |
/**
|
williamr@2
|
1018 |
* Method for constructing the object.
|
williamr@2
|
1019 |
*
|
williamr@2
|
1020 |
* @since 2.6
|
williamr@2
|
1021 |
* @param aWindowOwning True if scrollbar is to be a window owning control.
|
williamr@2
|
1022 |
* @param aScrollBarObserver Same as in CEikScrollBar::ConstructL()
|
williamr@2
|
1023 |
* @param aParent Same as in CEikScrollBar::ConstructL()
|
williamr@2
|
1024 |
* @param aOrientation Same as in CEikScrollBar::ConstructL()
|
williamr@2
|
1025 |
* @param aLength Same as in CEikScrollBar::ConstructL()
|
williamr@2
|
1026 |
* @param aScrollBarFlags Same as in CEikScrollBar::ConstructL()
|
williamr@2
|
1027 |
*
|
williamr@2
|
1028 |
*/
|
williamr@2
|
1029 |
IMPORT_C void ConstructL(TBool aWindowOwning, MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
|
williamr@2
|
1030 |
TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
|
williamr@2
|
1031 |
|
williamr@2
|
1032 |
/**
|
williamr@2
|
1033 |
* Sets scroll popup info text to be shown while dragging with stylus.
|
williamr@2
|
1034 |
* Popup is shown until next pointer up event.
|
williamr@2
|
1035 |
* KNullDesC parameter can be used to hide popup earlier.
|
williamr@2
|
1036 |
*
|
williamr@2
|
1037 |
* @since 3.2
|
williamr@2
|
1038 |
* @param aText Text to be shown
|
williamr@2
|
1039 |
*
|
williamr@2
|
1040 |
*/
|
williamr@2
|
1041 |
IMPORT_C void SetScrollPopupInfoTextL( const TDesC& aText );
|
williamr@2
|
1042 |
|
williamr@2
|
1043 |
/**
|
williamr@2
|
1044 |
* Gets the fixed layoutrect of the scrollbar.
|
williamr@2
|
1045 |
* @since 2.6
|
williamr@2
|
1046 |
* @return Scrollbar rectangle.
|
williamr@2
|
1047 |
*
|
williamr@2
|
1048 |
*/
|
williamr@2
|
1049 |
TRect FixedLayoutRect();
|
williamr@2
|
1050 |
|
williamr@2
|
1051 |
public: // from CEikScrollBar
|
williamr@2
|
1052 |
IMPORT_C void ConstructL(MEikScrollBarObserver* aScrollBarObserver,const CCoeControl* aParent,
|
williamr@2
|
1053 |
TOrientation aOrientation,TInt aLength,TInt aScrollBarFlags=EEikScrollBarDefaultBehaviour);
|
williamr@2
|
1054 |
IMPORT_C void MakeVisible(TBool aVisible);
|
williamr@2
|
1055 |
|
williamr@2
|
1056 |
public: // from CCoeControl
|
williamr@2
|
1057 |
IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
|
williamr@2
|
1058 |
|
williamr@2
|
1059 |
protected: // from CCoeControl
|
williamr@2
|
1060 |
IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const;
|
williamr@2
|
1061 |
IMPORT_C TInt CountComponentControls() const;
|
williamr@2
|
1062 |
|
williamr@2
|
1063 |
private: // from CCoeControl
|
williamr@2
|
1064 |
IMPORT_C void SizeChanged();
|
williamr@2
|
1065 |
|
williamr@2
|
1066 |
public:
|
williamr@2
|
1067 |
|
williamr@2
|
1068 |
TBool DrawBackgroundState();
|
williamr@2
|
1069 |
|
williamr@2
|
1070 |
void DrawBackground(TBool aDrawHorizontal);
|
williamr@2
|
1071 |
|
williamr@4
|
1072 |
/**
|
williamr@4
|
1073 |
* Resets pressed down highlight so that default highlight is used when
|
williamr@4
|
1074 |
* the scrollbar is drawn.
|
williamr@4
|
1075 |
*
|
williamr@4
|
1076 |
* @since S60 5.2
|
williamr@4
|
1077 |
*/
|
williamr@4
|
1078 |
void ResetPressedDownHighlight();
|
williamr@4
|
1079 |
|
williamr@2
|
1080 |
private:
|
williamr@2
|
1081 |
/**
|
williamr@2
|
1082 |
* From CAknControl
|
williamr@2
|
1083 |
*/
|
williamr@2
|
1084 |
IMPORT_C void* ExtensionInterface( TUid aInterface );
|
williamr@2
|
1085 |
private: // from CEikScrollBar
|
williamr@2
|
1086 |
void CreateButtonL(CAknScrollButton*& aButton,CAknScrollButton::TType aType);
|
williamr@2
|
1087 |
void SetButtonPositionL(CAknScrollButton* aButton);
|
williamr@2
|
1088 |
|
williamr@2
|
1089 |
/**
|
williamr@2
|
1090 |
* Sets scrollbar background transparency as given in the parameter.
|
williamr@2
|
1091 |
*
|
williamr@2
|
1092 |
* @param aTransparentBackground If ETrue then scrollbar will have transparent background.
|
williamr@2
|
1093 |
* @since 2.6
|
williamr@2
|
1094 |
*
|
williamr@2
|
1095 |
*/
|
williamr@2
|
1096 |
void SetTransparentBackground(TBool aTransparentBackground);
|
williamr@2
|
1097 |
|
williamr@2
|
1098 |
/**
|
williamr@2
|
1099 |
* Calculates scrollbar's extension area relative to its own position.
|
williamr@2
|
1100 |
*/
|
williamr@2
|
1101 |
TRect ExtensionArea() const;
|
williamr@2
|
1102 |
private:
|
williamr@2
|
1103 |
CCoeControl* iParentControl;
|
williamr@2
|
1104 |
TInt iSpare;
|
williamr@2
|
1105 |
};
|
williamr@2
|
1106 |
|
williamr@2
|
1107 |
|
williamr@2
|
1108 |
//
|
williamr@2
|
1109 |
// Inlines
|
williamr@2
|
1110 |
//
|
williamr@2
|
1111 |
|
williamr@2
|
1112 |
|
williamr@2
|
1113 |
inline const TEikScrollBarModel* CEikScrollBar::Model() const
|
williamr@2
|
1114 |
{ return &iModel; }
|
williamr@2
|
1115 |
|
williamr@2
|
1116 |
inline CAknScrollButton* CEikScrollBar::IncreaseNudgeButton() const
|
williamr@2
|
1117 |
{ return iButtons.iIncreaseNudge; }
|
williamr@2
|
1118 |
|
williamr@2
|
1119 |
inline CAknScrollButton* CEikScrollBar::DecreaseNudgeButton() const
|
williamr@2
|
1120 |
{ return iButtons.iDecreaseNudge; }
|
williamr@2
|
1121 |
|
williamr@2
|
1122 |
|
williamr@2
|
1123 |
#endif
|