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