|
1 /* |
|
2 * Copyright (c) 2008 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: This file defines class TScrollBarClet. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __HUISCROLLBARPART_H__ |
|
19 #define __HUISCROLLBARPART_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 /* Forward declarations. */ |
|
24 class TScrollBarClet; |
|
25 class TAlfEvent; |
|
26 class CAlfVisual; |
|
27 |
|
28 /** |
|
29 * Scroll bar controlet. |
|
30 * |
|
31 * This class handles the logic and drawing of a scrollbar. |
|
32 * You pass in a series of visuals, and then the class will |
|
33 * resize them to reflect the state of the scrollbar. |
|
34 */ |
|
35 class TScrollBarClet |
|
36 { |
|
37 public: |
|
38 |
|
39 /* Constructors and destructor. */ |
|
40 |
|
41 /** |
|
42 * Constructor. |
|
43 */ |
|
44 IMPORT_C TScrollBarClet(); |
|
45 |
|
46 /** |
|
47 * Constructor with more visuals. |
|
48 * |
|
49 * @param aVisual The parent visual, should be a layout containing the entire scrollbar. |
|
50 * @param aBar The scrollbar visual - the background of the controlet. |
|
51 * @param aThumb The thumb scroll bar of the controlet. |
|
52 */ |
|
53 IMPORT_C TScrollBarClet(CAlfVisual* aVisual, CAlfVisual* aBar, CAlfVisual* aThumb); |
|
54 |
|
55 /* Methods. */ |
|
56 |
|
57 /** |
|
58 * Set the position of the scrollbar. Will not actually move |
|
59 * the scrollbar until Update() is called. |
|
60 * |
|
61 * @param aPos Index of the first item visible, i.e. the index of the topmost item in a list box. |
|
62 */ |
|
63 IMPORT_C void SetPos(TInt aPos); |
|
64 |
|
65 /** |
|
66 * Set the range of the scrollbar. Will not actually move |
|
67 * the scrollbar until Update() is called. |
|
68 * |
|
69 * @param aMin Smallest value the scrollbar position can be set to. |
|
70 * @param aMax Largest value the scrollbar position can be set to. |
|
71 */ |
|
72 IMPORT_C void SetRange(TInt aMin, TInt aMax); |
|
73 |
|
74 IMPORT_C void SetHorizontal(TBool aHorizontal); |
|
75 |
|
76 IMPORT_C void SetVisibleCount(TInt aVisibleCount); |
|
77 |
|
78 IMPORT_C void SetThumbSize(TInt aSize); |
|
79 |
|
80 IMPORT_C void Update(TInt aDelayMilliSeconds = 0); |
|
81 |
|
82 private: |
|
83 |
|
84 /* Private methods */ |
|
85 |
|
86 |
|
87 public: |
|
88 /** Main visual of the part. */ |
|
89 CAlfVisual* iVisual; |
|
90 |
|
91 /** Thumbnail of the item. */ |
|
92 CAlfVisual* iScrollBar; |
|
93 |
|
94 /** Thumb of the item. */ |
|
95 CAlfVisual* iThumb; |
|
96 |
|
97 /** The current scrollbar position */ |
|
98 TInt iPos; |
|
99 |
|
100 /** The minimum value of the scrollbar position */ |
|
101 TInt iMin; |
|
102 |
|
103 /** The maximum value of the scrollbar position */ |
|
104 TInt iMax; |
|
105 |
|
106 /** The size of the visible area in scrollbar values */ |
|
107 TInt iVisibleCount; |
|
108 |
|
109 /** The size of the thumb */ |
|
110 TInt iThumbSize; |
|
111 |
|
112 /** The minimum thumb size */ |
|
113 TInt iMinThumbSize; |
|
114 |
|
115 /** The scroll bar is vertical by default. */ |
|
116 TBool iHorizontal; |
|
117 |
|
118 }; |
|
119 |
|
120 #endif // __HUISCROLLBARPART_H__ |