|
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 #ifndef __VERTICALSLIDER_H__ |
|
22 #define __VERTICALSLIDER_H__ |
|
23 |
|
24 #include <aknview.h> |
|
25 |
|
26 class CFbsBitmap; |
|
27 |
|
28 /*! |
|
29 @class CVerticalSlider |
|
30 @discussion Simple control which draws a vertical slider |
|
31 */ |
|
32 |
|
33 class CVerticalSlider : public CCoeControl |
|
34 { |
|
35 public: |
|
36 |
|
37 /*! |
|
38 @function NewL |
|
39 @discussion Create a CVerticalSlider object, which will draw itself to aRect |
|
40 @param aRect the rectangle this view will be drawn to |
|
41 @return a pointer to the created instance of CVerticalSlider |
|
42 */ |
|
43 IMPORT_C static CVerticalSlider* NewL(const TRect& aRect, const CCoeControl& aControl); |
|
44 |
|
45 /*! |
|
46 @function NewLC |
|
47 @discussion Create a CVerticalSlider object, which will draw itself to aRect |
|
48 @param aRect the rectangle this view will be drawn to |
|
49 @return a pointer to the created instance of CVerticalSlider |
|
50 */ |
|
51 IMPORT_C static CVerticalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl); |
|
52 |
|
53 /*! |
|
54 @function ~CVerticalSlider |
|
55 @discussion Destroy the object and release all memory objects |
|
56 */ |
|
57 IMPORT_C ~CVerticalSlider(); |
|
58 |
|
59 |
|
60 public: |
|
61 // new functions |
|
62 |
|
63 /*! |
|
64 @function SetMinimum |
|
65 @param aValue the new minimum value |
|
66 @discussion Sets the minimum value of the slider |
|
67 */ |
|
68 IMPORT_C void SetMinimum(TInt aValue); |
|
69 |
|
70 /*! |
|
71 @function SetMaximum |
|
72 @param aValue the new maximum value |
|
73 @discussion Sets the maximum value of the slider |
|
74 */ |
|
75 IMPORT_C void SetMaximum(TInt aValue); |
|
76 |
|
77 /*! |
|
78 @function SetStepL |
|
79 @param aValue the new step value |
|
80 @discussion Sets the step of the slider |
|
81 */ |
|
82 IMPORT_C void SetStep(TUint aValue); |
|
83 |
|
84 /*! |
|
85 @function SetStepAmount |
|
86 @param aValue the new step amount |
|
87 @discussion Sets the number of steps in the slider |
|
88 */ |
|
89 IMPORT_C void SetStepAmount(TUint8 aValue); |
|
90 |
|
91 /*! |
|
92 @function SetPosition |
|
93 @discussion Sets the position of the slider. Panics if the position is out of bounds. |
|
94 */ |
|
95 IMPORT_C void SetPosition(TInt aValue); |
|
96 |
|
97 /*! |
|
98 @function Minimum |
|
99 @discussion Gets the minimum value of the slider |
|
100 @return minimum value |
|
101 */ |
|
102 IMPORT_C TInt Minimum() const; |
|
103 |
|
104 /*! |
|
105 @function Maximum |
|
106 @discussion Gets the maximum value of the slider |
|
107 @return maximum value |
|
108 */ |
|
109 IMPORT_C TInt Maximum() const; |
|
110 |
|
111 /*! |
|
112 @function Step |
|
113 @discussion Gets the step of the slider |
|
114 @return current step |
|
115 */ |
|
116 IMPORT_C TInt Step() const; |
|
117 |
|
118 /*! |
|
119 @function Position |
|
120 @discussion Gets the position of the slider |
|
121 @return current position |
|
122 */ |
|
123 IMPORT_C TInt Position() const; |
|
124 |
|
125 /*! |
|
126 @function Increment |
|
127 @discussion Increments the slider |
|
128 */ |
|
129 IMPORT_C void Increment(); |
|
130 |
|
131 /*! |
|
132 @function Decrement |
|
133 @discussion Decrements the slider |
|
134 */ |
|
135 IMPORT_C void Decrement(); |
|
136 |
|
137 private: |
|
138 |
|
139 /*! |
|
140 @fuction ConstructL |
|
141 @discussion Perform the second phase construction of a CVerticalSlider object |
|
142 @param aRect Frame rectangle for container. |
|
143 */ |
|
144 void ConstructL(const TRect& aRect, const CCoeControl& aControl); |
|
145 |
|
146 /*! |
|
147 @function CVerticalSlider |
|
148 @discussion Constructs this object |
|
149 */ |
|
150 CVerticalSlider(); |
|
151 |
|
152 /*! |
|
153 @function LoadBitmapL |
|
154 @discussion Loads one bitmap and its mask |
|
155 */ |
|
156 void LoadBitmapL( |
|
157 CFbsBitmap*& aBitmap, |
|
158 CFbsBitmap*& aMask, |
|
159 TInt aBitmapIndex, |
|
160 TInt aMaskIndex |
|
161 ) const; |
|
162 |
|
163 /*! |
|
164 @function SetBitmapSize |
|
165 @discussion Set size of the bitmaps to reflect the current screen resolution |
|
166 */ |
|
167 void SetBitmapSize() const; |
|
168 |
|
169 |
|
170 public: // from CoeControl |
|
171 /*! |
|
172 @function CountComponentControls |
|
173 @return Number of component controls |
|
174 */ |
|
175 IMPORT_C TInt CountComponentControls() const; |
|
176 |
|
177 /*! |
|
178 @function ComponentControl. |
|
179 @param aIndex index of the component control |
|
180 @return Pointer to component control |
|
181 */ |
|
182 IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; |
|
183 |
|
184 /*! |
|
185 @function Draw |
|
186 @discussion Draw this CVerticalSlider to the screen |
|
187 @param aRect the rectangle of this view that needs updating |
|
188 */ |
|
189 IMPORT_C void Draw(const TRect& aRect) const; |
|
190 |
|
191 /*! |
|
192 @function MinimumSize |
|
193 @discussion Gets the minimum size of this component |
|
194 @return a minimum size of the control |
|
195 */ |
|
196 IMPORT_C TSize MinimumSize(); |
|
197 |
|
198 private: |
|
199 |
|
200 /// minimum value of the slider |
|
201 TInt iMinimumValue; |
|
202 |
|
203 /// maximum value of the slider |
|
204 TInt iMaximumValue; |
|
205 |
|
206 /// step value |
|
207 TUint iStep; |
|
208 |
|
209 /// number of steps |
|
210 TUint8 iNumberOfSteps; |
|
211 |
|
212 /// current position |
|
213 TInt iPosition; |
|
214 |
|
215 /// bitmap holding the slider background |
|
216 CFbsBitmap* iSliderBg; |
|
217 |
|
218 /// mask for the slider background |
|
219 CFbsBitmap* iSliderBgMask; |
|
220 |
|
221 /// bitmap holding the slider tab that moves |
|
222 CFbsBitmap* iSliderTab; |
|
223 |
|
224 /// mask for the slider tab |
|
225 CFbsBitmap* iSliderTabMask; |
|
226 }; |
|
227 |
|
228 #endif // __VERTICALSLIDER_H__ |
|
229 |
|
230 // End of File |
|
231 |
|
232 |