1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 /* |
|
21 * File: VeiSlider.h |
|
22 * Created: 30-10-2004 |
|
23 * Author: |
|
24 * |
|
25 */ |
|
26 |
|
27 #ifndef __VEISLIDER_H__ |
|
28 #define __VEISLIDER_H__ |
|
29 |
|
30 #include <coecntrl.h> |
|
31 |
|
32 class CFbsBitmap; |
|
33 |
|
34 /*! |
|
35 @class CVeiSlider |
|
36 @discussion Simple slider control base class. |
|
37 */ |
|
38 |
|
39 class CVeiSlider : public CCoeControl |
|
40 { |
|
41 public: |
|
42 |
|
43 /*! |
|
44 @function ~CVeiSlider |
|
45 @discussion Destroy the object and release all memory objects |
|
46 */ |
|
47 IMPORT_C ~CVeiSlider(); |
|
48 |
|
49 public: // new functions |
|
50 |
|
51 /*! |
|
52 @function SetMinimum |
|
53 @param aValue the new minimum value |
|
54 @discussion Sets the minimum value of the slider |
|
55 */ |
|
56 IMPORT_C void SetMinimum(TInt aValue); |
|
57 |
|
58 /*! |
|
59 @function SetMaximum |
|
60 @param aValue the new maximum value |
|
61 @discussion Sets the maximum value of the slider |
|
62 */ |
|
63 IMPORT_C void SetMaximum(TInt aValue); |
|
64 |
|
65 /*! |
|
66 @function SetStepL |
|
67 @param aValue the new step value |
|
68 @discussion Sets the step of the slider |
|
69 */ |
|
70 IMPORT_C void SetStep(TUint aValue); |
|
71 |
|
72 /*! |
|
73 @function SetStepAmount |
|
74 @param aValue the new step amount |
|
75 @discussion Sets the number of steps in the slider |
|
76 */ |
|
77 IMPORT_C void SetStepAmount(TUint8 aValue); |
|
78 |
|
79 /*! |
|
80 @function SetPosition |
|
81 @discussion Sets the position of the slider. Panics if the position is out of bounds. |
|
82 */ |
|
83 IMPORT_C void SetPosition(TInt aValue); |
|
84 |
|
85 /*! |
|
86 @function Minimum |
|
87 @discussion Gets the minimum value of the slider |
|
88 @return minimum value |
|
89 */ |
|
90 IMPORT_C TInt Minimum() const; |
|
91 |
|
92 /*! |
|
93 @function Maximum |
|
94 @discussion Gets the maximum value of the slider |
|
95 @return maximum value |
|
96 */ |
|
97 IMPORT_C TInt Maximum() const; |
|
98 |
|
99 /*! |
|
100 @function Step |
|
101 @discussion Gets the step of the slider |
|
102 @return current step |
|
103 */ |
|
104 IMPORT_C TInt Step() const; |
|
105 |
|
106 /*! |
|
107 @function SliderPosition |
|
108 @discussion Gets the position of the slider |
|
109 @return current position |
|
110 */ |
|
111 IMPORT_C TInt SliderPosition() const; |
|
112 |
|
113 /*! |
|
114 @function Increment |
|
115 @discussion Increments the slider |
|
116 */ |
|
117 IMPORT_C void Increment(); |
|
118 |
|
119 /*! |
|
120 @function Decrement |
|
121 @discussion Decrements the slider |
|
122 */ |
|
123 IMPORT_C void Decrement(); |
|
124 |
|
125 /*! |
|
126 @function MinimumSize |
|
127 @discussion Gets the minimum size of this component |
|
128 @return a minimum size of the control |
|
129 */ |
|
130 virtual TSize MinimumSize() = 0; |
|
131 |
|
132 protected: |
|
133 |
|
134 /*! |
|
135 @function CVeiSlider |
|
136 @discussion Constructs this object |
|
137 */ |
|
138 CVeiSlider(); |
|
139 |
|
140 /*! |
|
141 @function LoadBitmapL |
|
142 @discussion Loads one bitmap and its mask |
|
143 */ |
|
144 void LoadBitmapL( |
|
145 CFbsBitmap*& aBitmap, |
|
146 CFbsBitmap*& aMask, |
|
147 TInt aBitmapIndex, |
|
148 TInt aMaskIndex |
|
149 ) const; |
|
150 |
|
151 public: // from CoeControl |
|
152 |
|
153 /*! |
|
154 @function CountComponentControls |
|
155 @return Number of component controls |
|
156 */ |
|
157 virtual TInt CountComponentControls() const; |
|
158 |
|
159 /*! |
|
160 @function ComponentControl. |
|
161 @param aIndex index of the component control |
|
162 @return Pointer to component control |
|
163 */ |
|
164 virtual CCoeControl* ComponentControl(TInt aIndex) const; |
|
165 |
|
166 |
|
167 protected: // data |
|
168 |
|
169 /// bitmap holding the slider background |
|
170 CFbsBitmap* iSliderBg; |
|
171 |
|
172 /// mask for the slider background |
|
173 CFbsBitmap* iSliderBgMask; |
|
174 |
|
175 /// bitmap holding the slider tab that moves |
|
176 CFbsBitmap* iSliderTab; |
|
177 |
|
178 /// mask for the slider tab |
|
179 CFbsBitmap* iSliderTabMask; |
|
180 |
|
181 private: // data |
|
182 |
|
183 /// minimum value of the slider |
|
184 TInt iMinimumValue; |
|
185 |
|
186 /// maximum value of the slider |
|
187 TInt iMaximumValue; |
|
188 |
|
189 /// step value |
|
190 TUint iStep; |
|
191 |
|
192 /// number of steps |
|
193 TUint8 iNumberOfSteps; |
|
194 |
|
195 /// current position |
|
196 TInt iPosition; |
|
197 |
|
198 }; |
|
199 |
|
200 |
|
201 |
|
202 /*! |
|
203 @class CVeiVerticalSlider |
|
204 @discussion Vertical slider control |
|
205 */ |
|
206 |
|
207 NONSHARABLE_CLASS( CVeiVerticalSlider ) : public CVeiSlider |
|
208 { |
|
209 public: |
|
210 |
|
211 /*! |
|
212 @function NewL |
|
213 @discussion Create a CVeiVerticalSlider object, which will draw itself to aRect |
|
214 @param aRect the rectangle this view will be drawn to |
|
215 @return a pointer to the created instance of CVeiVerticalSlider |
|
216 */ |
|
217 IMPORT_C static CVeiVerticalSlider* NewL(const TRect& aRect, const CCoeControl& aControl); |
|
218 |
|
219 /*! |
|
220 @function NewLC |
|
221 @discussion Create a CVeiSlider object, which will draw itself to aRect |
|
222 @param aRect the rectangle this view will be drawn to |
|
223 @return a pointer to the created instance of CVeiSlider |
|
224 */ |
|
225 IMPORT_C static CVeiVerticalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl); |
|
226 |
|
227 /*! |
|
228 @function ~CVeiSlider |
|
229 @discussion Destroy the object and release all memory objects |
|
230 */ |
|
231 IMPORT_C ~CVeiVerticalSlider(); |
|
232 |
|
233 /*! |
|
234 @function MinimumSize |
|
235 @discussion Gets the minimum size of this component |
|
236 @return a minimum size of the control |
|
237 */ |
|
238 IMPORT_C TSize MinimumSize(); |
|
239 |
|
240 private: |
|
241 |
|
242 /*! |
|
243 @fuction ConstructL |
|
244 @discussion Perform the second phase construction of a CVeiVerticalSlider object |
|
245 @param aRect Frame rectangle for container. |
|
246 */ |
|
247 void ConstructL(const TRect& aRect, const CCoeControl& aControl); |
|
248 |
|
249 /*! |
|
250 @function CVeiVerticalSlider |
|
251 @discussion Constructs this object |
|
252 */ |
|
253 CVeiVerticalSlider(); |
|
254 |
|
255 public: // from CoeControl |
|
256 |
|
257 /*! |
|
258 @function Draw |
|
259 @discussion Draw this CVeiVerticalSlider to the screen |
|
260 @param aRect the rectangle of this view that needs updating |
|
261 */ |
|
262 virtual void Draw(const TRect& aRect) const; |
|
263 |
|
264 /*! |
|
265 @function SizeChanged |
|
266 @discussion Responds to changes to the size and position of the contents of this control. |
|
267 */ |
|
268 virtual void SizeChanged(); |
|
269 |
|
270 }; |
|
271 |
|
272 |
|
273 |
|
274 /*! |
|
275 @class CVeiHorizontalSlider |
|
276 @discussion Horizontal slider control |
|
277 */ |
|
278 |
|
279 NONSHARABLE_CLASS( CVeiHorizontalSlider ) : public CVeiSlider |
|
280 { |
|
281 public: |
|
282 |
|
283 /*! |
|
284 @function NewL |
|
285 @discussion Create a CVeiHorizontalSlider object, which will draw itself to aRect |
|
286 @param aRect the rectangle this view will be drawn to |
|
287 @return a pointer to the created instance of CVeiHorizontalSlider |
|
288 */ |
|
289 IMPORT_C static CVeiHorizontalSlider* NewL(const TRect& aRect, const CCoeControl& aControl); |
|
290 |
|
291 /*! |
|
292 @function NewLC |
|
293 @discussion Create a CVeiSlider object, which will draw itself to aRect |
|
294 @param aRect the rectangle this view will be drawn to |
|
295 @return a pointer to the created instance of CVeiSlider |
|
296 */ |
|
297 IMPORT_C static CVeiHorizontalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl); |
|
298 |
|
299 /*! |
|
300 @function ~CVeiSlider |
|
301 @discussion Destroy the object and release all memory objects |
|
302 */ |
|
303 IMPORT_C ~CVeiHorizontalSlider(); |
|
304 |
|
305 /*! |
|
306 @function MinimumSize |
|
307 @discussion Gets the minimum size of this component |
|
308 @return a minimum size of the control |
|
309 */ |
|
310 IMPORT_C TSize MinimumSize(); |
|
311 |
|
312 private: |
|
313 |
|
314 /*! |
|
315 @fuction ConstructL |
|
316 @discussion Perform the second phase construction of a CVeiHorizontalSlider object |
|
317 @param aRect Frame rectangle for container. |
|
318 */ |
|
319 void ConstructL(const TRect& aRect, const CCoeControl& aControl); |
|
320 |
|
321 /*! |
|
322 @function CVeiHorizontalSlider |
|
323 @discussion Constructs this object |
|
324 */ |
|
325 CVeiHorizontalSlider(); |
|
326 |
|
327 public: // from CoeControl |
|
328 |
|
329 /*! |
|
330 @function Draw |
|
331 @discussion Draw this CVeiHorizontalSlider to the screen |
|
332 @param aRect the rectangle of this view that needs updating |
|
333 */ |
|
334 virtual void Draw(const TRect& aRect) const; |
|
335 |
|
336 /*! |
|
337 @function SizeChanged |
|
338 @discussion Responds to changes to the size and position of the contents of this control. |
|
339 */ |
|
340 virtual void SizeChanged(); |
|
341 |
|
342 }; |
|
343 |
|
344 #endif // __VEISLIDER_H__ |
|
345 |
|
346 // End of File |
|