1 /* |
|
2 * Copyright (c) 2002-2204 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 the License "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: Definition of the Browser On-screen scrollbar |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef SCROLLBAR_H |
|
19 #define SCROLLBAR_H |
|
20 |
|
21 //---------------------------------------------------------------------------- |
|
22 // INCLUDES |
|
23 //---------------------------------------------------------------------------- |
|
24 #include <coecntrl.h> |
|
25 #include <e32std.h> |
|
26 |
|
27 //---------------------------------------------------------------------------- |
|
28 // CONSTANTS |
|
29 //---------------------------------------------------------------------------- |
|
30 const TInt KTrackBkgdThickness = 1; // Thickness of the scrollbar track |
|
31 |
|
32 //---------------------------------------------------------------------------- |
|
33 // FORWARD DECLARATIONS |
|
34 //---------------------------------------------------------------------------- |
|
35 class CScrollThumb; |
|
36 |
|
37 //---------------------------------------------------------------------------- |
|
38 // CLASS DEFINITION |
|
39 //---------------------------------------------------------------------------- |
|
40 |
|
41 /** |
|
42 * Browser On-screen scrollbar |
|
43 * |
|
44 * @since Series60_version 2.5 |
|
45 */ |
|
46 class CScrollBar : public CCoeControl |
|
47 { |
|
48 public: |
|
49 |
|
50 // Used by scrollbars and its components to detemine the orientation of |
|
51 // a scrollbar |
|
52 enum TOrientation |
|
53 { |
|
54 EVertical, |
|
55 EHorizontal |
|
56 }; |
|
57 |
|
58 //------------------------------------------------------------------ |
|
59 // Constructors and Destructors - Public |
|
60 //------------------------------------------------------------------ |
|
61 public: |
|
62 |
|
63 /** |
|
64 * Two-phased constructor. |
|
65 */ |
|
66 static CScrollBar* NewL(const TOrientation aOrientation, |
|
67 const CCoeControl& aParent); |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CScrollBar(); |
|
72 |
|
73 //------------------------------------------------------------------ |
|
74 // Inherited Member Functions - Public |
|
75 //------------------------------------------------------------------ |
|
76 public: |
|
77 |
|
78 virtual void Draw(const TRect& aRect) const; |
|
79 |
|
80 //------------------------------------------------------------------ |
|
81 // Member Functions - Public |
|
82 //------------------------------------------------------------------ |
|
83 public: |
|
84 |
|
85 /** |
|
86 * Sets the rect for the scroll bar and its background |
|
87 * @since Series60_version 2.5 |
|
88 * @param aRect - the rectangle in which the scrollbar is drawn into |
|
89 * @return none |
|
90 */ |
|
91 void SetTrackAndBackground(const TRect& aRect); |
|
92 |
|
93 //------------------------------------------------------------------ |
|
94 // Member Functions - Public - Get/Set |
|
95 //------------------------------------------------------------------ |
|
96 public: |
|
97 |
|
98 /** |
|
99 * Calls SetRect() on iThumb |
|
100 * @since Series60_version 2.5 |
|
101 * @param aRect - the rectangle for the scrollbar thumb |
|
102 * @return none |
|
103 */ |
|
104 void SetThumb(const TRect& aRect); |
|
105 |
|
106 /** |
|
107 * Sets the orientation of the scrollbar |
|
108 * @since Series60_version 2.5 |
|
109 * @param aOrientation - the orientation of the scrollbar |
|
110 * @return none |
|
111 */ |
|
112 inline void SetOrientation(const TOrientation aOrientation) |
|
113 { iOrientation = aOrientation; } |
|
114 |
|
115 //------------------------------------------------------------------ |
|
116 // Constructors and Destructors - Private |
|
117 //------------------------------------------------------------------ |
|
118 private: |
|
119 |
|
120 /** |
|
121 * C++ default constructor. |
|
122 */ |
|
123 CScrollBar(const TOrientation aOrientation); |
|
124 |
|
125 /** |
|
126 * Symbian 2nd phase constructor |
|
127 */ |
|
128 void ConstructL(const CCoeControl& aParent); |
|
129 |
|
130 //------------------------------------------------------------------ |
|
131 // Inherited Member Functions - Private |
|
132 //------------------------------------------------------------------ |
|
133 private: |
|
134 |
|
135 /** |
|
136 * From CCoeControl, CountComponentControls |
|
137 */ |
|
138 TInt CountComponentControls() const; |
|
139 |
|
140 /** |
|
141 * From CCoeControl, SizeChanged |
|
142 */ |
|
143 virtual void SizeChanged(); |
|
144 |
|
145 /** |
|
146 * From CCoeControl, ComponentControl |
|
147 */ |
|
148 CCoeControl* ComponentControl(TInt aIndex) const; |
|
149 |
|
150 //------------------------------------------------------------------ |
|
151 // Member Functions - Private |
|
152 //------------------------------------------------------------------ |
|
153 private: |
|
154 |
|
155 /** |
|
156 * Sets the colours of a scrollbar |
|
157 * @since Series60_version 2.5 |
|
158 * @param aTrackColour - the colour of the track |
|
159 * @param aTrackBkgdColour - the colour of the track background |
|
160 * @return none |
|
161 */ |
|
162 void SetTrackColours(const TRgb aTrackColour, const TRgb aTrackBkgdColour); |
|
163 |
|
164 //------------------------------------------------------------------ |
|
165 // Member Data - Public |
|
166 //------------------------------------------------------------------ |
|
167 public: |
|
168 |
|
169 CScrollThumb* iThumb; // Scrollbar Thumb - owned |
|
170 |
|
171 //------------------------------------------------------------------ |
|
172 // Member Data - Private |
|
173 //------------------------------------------------------------------ |
|
174 private: |
|
175 TOrientation iOrientation; // Scrollbar orientation |
|
176 |
|
177 TRgb iTrackColour; // track colour (track aka 'shaft') |
|
178 TRgb iTrackBkgdColour; // track background colour (track aka 'shaft') |
|
179 |
|
180 TRect iTrackCentre; // the rect of the track shown inside the track shadow |
|
181 }; |
|
182 |
|
183 #endif // SCROLLBAR_H |
|