|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * |
|
14 * Description: Control group of different input ranges |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CAKNFEPCTRLRANGEBAR_H |
|
20 #define C_CAKNFEPCTRLRANGEBAR_H |
|
21 |
|
22 // system includes |
|
23 #include <peninputlayoutctrlgroup.h> |
|
24 |
|
25 // forward declarations |
|
26 class CFbsBitmap; |
|
27 class TResourceReader; |
|
28 class CAknFepCtrlButton; |
|
29 class CAknFepCtrlCommonButton; |
|
30 // class declaration |
|
31 /** |
|
32 * This is the class definition for control group of different |
|
33 * input ranges |
|
34 * |
|
35 * @lib fepcommonctrls.lib |
|
36 * @since S60 v3.2 |
|
37 */ |
|
38 class CAknFepCtrlRangeBar : public CControlGroup , public MEventObserver |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Style of range bar, can be horizontal or vertical |
|
44 */ |
|
45 enum TButtonGroupStyle |
|
46 { |
|
47 EBtnGroupHorizontal, |
|
48 EBtnGroupVertical |
|
49 }; |
|
50 |
|
51 /** |
|
52 * Action style of range bar, can be hide or highlight |
|
53 */ |
|
54 enum TRangeBarActionStyle |
|
55 { |
|
56 ERangeBarActionStyleHide, // all indicators action style are unitary: hide |
|
57 ERangeBarActionStyleHighLight, // all indicators action style are unitary: highlight |
|
58 ERangeBarUsingIndicatorStyle // every indicator can have different action style |
|
59 }; |
|
60 |
|
61 /** |
|
62 * Action style of indicator, can be hide or visible |
|
63 * for using indicaotr action style, every indicator's position is fixed |
|
64 */ |
|
65 enum TIndicatorActionStyle |
|
66 { |
|
67 EIndicatorActionStyleHide, // hide |
|
68 EIndicatorActionStyleHighLight, // visible and highlight |
|
69 EIndicatorActionStyleNormal // just like normal button press, highlight not latched |
|
70 }; |
|
71 |
|
72 /** |
|
73 * Two-phased constructor. |
|
74 * |
|
75 * @since S60 v3.2 |
|
76 * @param aUiLayout An instance of CFepUiLayout |
|
77 * @param aUtils An instance of the resource environment |
|
78 * @param aControlId The control id of the Range Bar |
|
79 * @param aStyle The style of Range Bar, can be vertical or horizontal |
|
80 * @return The pointer point to CAknFepCtrlRangeBar type object |
|
81 */ |
|
82 IMPORT_C static CAknFepCtrlRangeBar* NewL(CFepUiLayout* aUiLayout, |
|
83 TInt aControlId , |
|
84 TButtonGroupStyle aStyle); |
|
85 |
|
86 /** |
|
87 * Two-phased constructor. |
|
88 * |
|
89 * @since S60 v3.2 |
|
90 * @param aUiLayout An instance of CFepUiLayout |
|
91 * @param aUtils An instance of the resource environment |
|
92 * @param aControlId A control id of the Range Bar |
|
93 * @param aStyle the style of Range Bar, can be vertical or horizontal |
|
94 * @return The pointer point to CAknFepCtrlRangeBar type object |
|
95 */ |
|
96 IMPORT_C static CAknFepCtrlRangeBar* NewLC(CFepUiLayout* aUiLayout, |
|
97 TInt aControlId , |
|
98 TButtonGroupStyle aStyle); |
|
99 |
|
100 /** |
|
101 * Destructor. |
|
102 * |
|
103 * @since S60 v3.2 |
|
104 */ |
|
105 IMPORT_C virtual ~CAknFepCtrlRangeBar(); |
|
106 |
|
107 /** |
|
108 * This function creates the Range Bar from resource type AKN_FEP_INPUTRANGE_LIST. |
|
109 * The function will leave if the count of input ranges is invalid |
|
110 * |
|
111 * @since S60 v3.2 |
|
112 * @param aReader A resource reader against AKN_FEP_INPUTMODE_LIST |
|
113 * @return None |
|
114 */ |
|
115 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); |
|
116 |
|
117 /** |
|
118 * Refresh the curent Mode Control aera |
|
119 * |
|
120 * @since S60 v3.2 |
|
121 * @return None |
|
122 */ |
|
123 IMPORT_C void RefreshUI(); |
|
124 |
|
125 /** |
|
126 * Handles the SizeChanged event |
|
127 * |
|
128 * @since S60 v3.2 |
|
129 * @return None |
|
130 */ |
|
131 IMPORT_C void SizeChanged(const TRect aRect); |
|
132 |
|
133 /** |
|
134 * Set active input range |
|
135 * |
|
136 * @since S60 v3.2 |
|
137 * @param aRange A specified input range |
|
138 * @return ETrue if given input range set successfully, EFalse otherwise |
|
139 */ |
|
140 IMPORT_C TBool SetRange(const TInt aRange); |
|
141 |
|
142 /** |
|
143 * Set mode of given range |
|
144 * |
|
145 * @since S60 v3.2 |
|
146 * @param aRange A specified input range |
|
147 * @param aModeIndex The mode index in given range |
|
148 * @return None |
|
149 */ |
|
150 IMPORT_C void SetCaseL(const TInt aRange, const TInt aModeIndex); |
|
151 |
|
152 /** |
|
153 * Set permitted input ranges |
|
154 * |
|
155 * @since S60 v3.2 |
|
156 * @param aPermitted Used to decide which input ranges permitted |
|
157 * @return None |
|
158 */ |
|
159 IMPORT_C void SetPermittedRanges(const TInt aPermitted); |
|
160 |
|
161 /** |
|
162 * Permit given range or not |
|
163 * |
|
164 * @since S60 v3.2 |
|
165 * @param aRangeId The range id of given range |
|
166 * @param aPermit Used to enable given range or not |
|
167 * @return None |
|
168 */ |
|
169 IMPORT_C void SetPermittedRange(const TInt aRangeId, TBool aPermit); |
|
170 |
|
171 /** |
|
172 * Permit given range & case or not |
|
173 * |
|
174 * @since S60 v3.2 |
|
175 * @param aRangeId The range id of given range |
|
176 * @param aRealCaseId The real case id in given range |
|
177 * @param aPermit Used to enable given range & case or not |
|
178 * @return None |
|
179 */ |
|
180 IMPORT_C void SetPermittedCase(const TInt aRangeId, |
|
181 const TInt aRealCaseId, |
|
182 TBool aPermit); |
|
183 |
|
184 /** |
|
185 * Hide given range, used when whole rangebar's actions tyle is |
|
186 * hide or highlight |
|
187 * |
|
188 * @since S60 v3.2 |
|
189 * @param aRange Given input range to be hide |
|
190 * @return KErrNone if the button represent given range hided successfully, |
|
191 * otherwise system wide error codes |
|
192 */ |
|
193 IMPORT_C void HideRange(const TInt aRange); |
|
194 |
|
195 /** |
|
196 * Hide given range, function only used when whole range bar's action |
|
197 * style is using indicator style |
|
198 * |
|
199 * @since S60 v3.2 |
|
200 * @param aRange Given input range to be hide |
|
201 * @return None |
|
202 */ |
|
203 IMPORT_C void HideRangeUsingIndicatorStyle(const TInt aRange); |
|
204 |
|
205 /** |
|
206 * Show given range, used when whole rangebar's action style is |
|
207 * hide or highlight |
|
208 * |
|
209 * @since S60 v3.2 |
|
210 * @param aRange Given range to be shown |
|
211 * @return None |
|
212 */ |
|
213 IMPORT_C void ShowRange(const TInt aRange); |
|
214 |
|
215 /** |
|
216 * Show given range, function only used when whole range bar's action |
|
217 * style is using indicator style |
|
218 * |
|
219 * @since S60 v3.2 |
|
220 * @param aRange Given range to be shown |
|
221 * @return None |
|
222 */ |
|
223 IMPORT_C void ShowRangeUsingIndicatorStyle(const TInt aRange); |
|
224 |
|
225 /** |
|
226 * Add new input range |
|
227 * |
|
228 * @since S60 v3.2 |
|
229 * @param aReader Given resource reader for new input range |
|
230 * @return None |
|
231 */ |
|
232 IMPORT_C void AddRangeL(TResourceReader& aReader); |
|
233 |
|
234 /** |
|
235 * Get current real case of given Range |
|
236 * |
|
237 * @since S60 v3.2 |
|
238 * @param aRange Given range |
|
239 * @return Current real case of given range |
|
240 */ |
|
241 IMPORT_C TInt GetCase(TInt aRange) const; |
|
242 |
|
243 /** |
|
244 * Set font of range bar, this function should be called |
|
245 * by container of range bar |
|
246 * |
|
247 * @since S60 v3.2 |
|
248 * @param aFont The font to be set for range bar |
|
249 * @return None |
|
250 */ |
|
251 IMPORT_C void SetFont(const CFont* aFont); |
|
252 |
|
253 /** |
|
254 * Move range bar according to offset |
|
255 * |
|
256 * @since S60 v3.2 |
|
257 * @param aOffset The moving offset |
|
258 * @return None |
|
259 */ |
|
260 IMPORT_C void Move(const TPoint& aOffset); |
|
261 |
|
262 /** |
|
263 * Set event id which will be sent out when range button is click |
|
264 * |
|
265 * @since S60 v3.2 |
|
266 * @param aEventId the event id |
|
267 * @return None |
|
268 */ |
|
269 IMPORT_C void SetEventIdForRange(TInt aEventId); |
|
270 |
|
271 /** |
|
272 * Set event id which will be sent out when case button is click |
|
273 * |
|
274 * @since S60 v3.2 |
|
275 * @param aEventId the event id |
|
276 * @return None |
|
277 */ |
|
278 IMPORT_C void SetEventIdForCase(TInt aEventId); |
|
279 |
|
280 /** |
|
281 * Display all ranges whether it is IsHide |
|
282 * |
|
283 * @since S60 v3.2 |
|
284 * @return None |
|
285 */ |
|
286 IMPORT_C void ShowAllRanges(); |
|
287 |
|
288 /** |
|
289 * DrawRangeBar |
|
290 * |
|
291 * @since S60 v3.2 |
|
292 * @return None |
|
293 */ |
|
294 IMPORT_C void Draw(); |
|
295 |
|
296 /** |
|
297 * SetActionStyle |
|
298 * |
|
299 * @since S60 v3.2 |
|
300 * @param aActionStyle action style |
|
301 * @return None |
|
302 */ |
|
303 IMPORT_C void SetActionStyle(TRangeBarActionStyle aActionStyle); |
|
304 |
|
305 /** |
|
306 * ActiveRange |
|
307 * |
|
308 * @since S60 v3.2 |
|
309 * @param aRange range to be activated |
|
310 * @return None |
|
311 */ |
|
312 IMPORT_C void ActiveRange(TInt aRange); |
|
313 |
|
314 /** |
|
315 * Get the current input range |
|
316 * |
|
317 * @since S60 v3.2 |
|
318 * @return Current Input Range |
|
319 */ |
|
320 inline TInt InputRange() const; |
|
321 |
|
322 /** |
|
323 * Set display style of range bar |
|
324 * |
|
325 * @since S60 v3.2 |
|
326 * @param aNewStyle The style of range bar, can be vertical or horizontal |
|
327 * @return None |
|
328 */ |
|
329 inline void SetStyle(const TButtonGroupStyle aNewStyle); |
|
330 |
|
331 /** |
|
332 * Get display style of range bar |
|
333 * |
|
334 * @since S60 v3.2 |
|
335 * @return Current display style of range bar |
|
336 */ |
|
337 inline TInt Style() const; |
|
338 |
|
339 /** |
|
340 * Set layout rect of range bar, this function should be called |
|
341 * by container of range bar |
|
342 * |
|
343 * @since S60 v3.2 |
|
344 * @param aRect The layout rect to be set for range bar |
|
345 * @return None |
|
346 */ |
|
347 inline void SetCellRect(const TRect aRect); |
|
348 |
|
349 /** |
|
350 * Set display cell rects |
|
351 * |
|
352 * @since S60 v3.2 |
|
353 * @return None |
|
354 */ |
|
355 IMPORT_C void SetDispalyCellRectsL( const RArray<TRect>& aRects, |
|
356 const RArray<TRect>& aInnerRects ); |
|
357 |
|
358 |
|
359 protected: |
|
360 |
|
361 /** |
|
362 * From MEventObserver. |
|
363 * Handle event |
|
364 * |
|
365 * @since S60 v3.2 |
|
366 * @param aEventType The event type |
|
367 * @param aCtrl The pointer points to control who sends event |
|
368 * @param aEventData The event data |
|
369 * @return None |
|
370 */ |
|
371 IMPORT_C void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, |
|
372 const TDesC& aEventData); |
|
373 |
|
374 /** |
|
375 * C++ default constructor. |
|
376 * |
|
377 * @since S60 v3.2 |
|
378 * @param aUiLayout An instance of CFepUiLayout |
|
379 * @param aControlId The control id of the Range Bar |
|
380 * @param aStyle The style of Range Bar, vertical or horizontal |
|
381 */ |
|
382 IMPORT_C CAknFepCtrlRangeBar(CFepUiLayout* aUiLayout, TInt aControlId, |
|
383 TButtonGroupStyle aStyle); |
|
384 |
|
385 /** |
|
386 * By default Symbian 2nd phase constructor is private. |
|
387 * |
|
388 * @since S60 v3.2 |
|
389 * @param aUtils An instance of the resource environment |
|
390 * @return None |
|
391 */ |
|
392 IMPORT_C void ConstructL(); |
|
393 |
|
394 /** |
|
395 * handle pointer down event. |
|
396 * |
|
397 * @since S60 v3.2 |
|
398 * @param aPoint |
|
399 * @return control |
|
400 */ |
|
401 virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint); |
|
402 public: // data |
|
403 |
|
404 /** |
|
405 * Position of the default indicator |
|
406 */ |
|
407 TRect iIndicatorRect; |
|
408 |
|
409 protected: // data |
|
410 |
|
411 /** |
|
412 * This class declares the range indicator |
|
413 * Purpose of this class is to save some information for each indicator |
|
414 * |
|
415 * @since S60 v3.2 |
|
416 */ |
|
417 class TAknFepRangeIndicator |
|
418 { |
|
419 public: // data |
|
420 /** |
|
421 * Control type of button |
|
422 */ |
|
423 TInt iCtrlType; |
|
424 |
|
425 /** |
|
426 * Id of the input range |
|
427 */ |
|
428 TInt iInputRange; |
|
429 |
|
430 /** |
|
431 * Type of input range, used to judge if it is mixed |
|
432 */ |
|
433 TInt iRangeType; |
|
434 |
|
435 /** |
|
436 * control Id of button |
|
437 */ |
|
438 TInt iCtrlId; |
|
439 |
|
440 /** |
|
441 * Is button that represent iInputRange hided |
|
442 */ |
|
443 TBool iIsHide; |
|
444 |
|
445 /** |
|
446 * Pointer to the indicator button (Own) |
|
447 */ |
|
448 CAknFepCtrlCommonButton* iIndicator; |
|
449 |
|
450 /** |
|
451 * Indicator action style, |
|
452 * value from TIndicatorActionStyle |
|
453 */ |
|
454 TInt iActionStyle; |
|
455 |
|
456 /** |
|
457 * Indicator position index in cellrects list |
|
458 * only meaningful when whole action style is |
|
459 * ERangeBarUsingIndicatorStyle |
|
460 */ |
|
461 TInt iPosIdx; |
|
462 }; |
|
463 |
|
464 private: |
|
465 |
|
466 /** |
|
467 * Set layout rect of whole range bar |
|
468 * |
|
469 * @since S60 v3.2 |
|
470 * @return None |
|
471 */ |
|
472 void SetWholeRect(); |
|
473 |
|
474 /** |
|
475 * Get number of input ranges hided |
|
476 * |
|
477 * @since S60 v3.2 |
|
478 * @return Number of hided input ranges |
|
479 */ |
|
480 TInt NumOfHidedRange(); |
|
481 |
|
482 /** |
|
483 * Judge if button in given index has mixed range |
|
484 * |
|
485 * @since S60 v3.2 |
|
486 * @param aIndex Given index |
|
487 * @return ETrue if given index has mixed range, otherwise EFalse |
|
488 */ |
|
489 TBool IsMixedRange(const TInt aIndex); |
|
490 |
|
491 /** |
|
492 * Report range or mode change event to observer |
|
493 * |
|
494 * @since S60 v3.2 |
|
495 * @param aEventId the event id |
|
496 * @param aEventData the event data |
|
497 * @return None |
|
498 */ |
|
499 void ReportEventToObserver(const TInt aEventId, const TInt aEventData); |
|
500 |
|
501 /** |
|
502 * Set new position to sub controls |
|
503 * |
|
504 * @since S60 v3.2 |
|
505 * @return None |
|
506 */ |
|
507 void SetIndicatorRect(); |
|
508 |
|
509 /** |
|
510 * update new position to sub controls |
|
511 * this function used when indicator's rect get from cell rects list |
|
512 * and whole range bar's action style is highlight or hide |
|
513 * |
|
514 * @since S60 v3.2 |
|
515 * @return None |
|
516 */ |
|
517 void UpdateIndicatorRect( TBool aUpdateImage ); |
|
518 |
|
519 /** |
|
520 * update new position to sub controls |
|
521 * this function only used when indicator's rect get from cell rects list, |
|
522 * and whole range bar's action style is using indicator style, every |
|
523 * indicator's position is fixed |
|
524 * |
|
525 * @since S60 v3.2 |
|
526 * @return None |
|
527 */ |
|
528 void UpdateIndicatorRectForUsingIndicatorStyle(TBool aUpdateImage); |
|
529 |
|
530 /** |
|
531 * Get indicator index by given range |
|
532 * |
|
533 * @since S60 v3.2 |
|
534 * @return Indicator index |
|
535 */ |
|
536 TInt IndicatorIdxByRange(TInt aRange); |
|
537 |
|
538 /** |
|
539 * this function only used when indicator's rect get from cell rects list, |
|
540 * and whole range bar's action style is using indicator style, and indicator |
|
541 * to be hiden is using hide action style |
|
542 * |
|
543 * @since S60 v3.2 |
|
544 * @param aIdx Indicator index to be hiden |
|
545 * @param aHide Whether hide or show indicator |
|
546 * @return None |
|
547 */ |
|
548 void HideRangeForHidingIndicatorStyle(TInt aIdx, TBool aHide); |
|
549 |
|
550 private: // data |
|
551 |
|
552 /** |
|
553 * Array of input range indicators |
|
554 */ |
|
555 RPointerArray<TAknFepRangeIndicator> iIndicators; |
|
556 |
|
557 /** |
|
558 * Current active input range |
|
559 */ |
|
560 TInt iInputRange; |
|
561 |
|
562 /** |
|
563 * A rect used to erase the screen |
|
564 */ |
|
565 TRect iEraseRect; |
|
566 |
|
567 /** |
|
568 * Style of range bar |
|
569 */ |
|
570 TButtonGroupStyle iStyle; |
|
571 |
|
572 /** |
|
573 * Current font of range bar |
|
574 */ |
|
575 const CFont* iFont; |
|
576 |
|
577 /** |
|
578 * event id for range button click |
|
579 */ |
|
580 TInt iEventIdForRange; |
|
581 |
|
582 /** |
|
583 * event id for case button click |
|
584 */ |
|
585 TInt iEventIdForCase; |
|
586 |
|
587 /** |
|
588 * Whether resize images as well, |
|
589 * if only the position of the button changed, |
|
590 * no need to reset the images as well |
|
591 */ |
|
592 TBool iIsReloadImages; |
|
593 |
|
594 /** |
|
595 * action style |
|
596 */ |
|
597 TRangeBarActionStyle iActionStyle; |
|
598 |
|
599 /** |
|
600 * First time construct flag |
|
601 */ |
|
602 TBool iFirstTimeConstruct; |
|
603 |
|
604 /** |
|
605 * Rangebar cell rect |
|
606 */ |
|
607 RArray<TRect> iCellRects; |
|
608 RArray<TRect> iCellInnerRects; |
|
609 TBool iCellChanged; |
|
610 }; |
|
611 |
|
612 #include "peninputrangebar.inl" |
|
613 |
|
614 #endif // C_CAKNFEPCTRLRANGEBAR_H |
|
615 |
|
616 // End Of File |