|
1 /* |
|
2 * Copyright (c) 2007-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: cuicscrollbar.h |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_UICSCROLLBAR_H |
|
19 #define C_UICSCROLLBAR_H |
|
20 |
|
21 #include <alf/alfcontrol.h> |
|
22 #include <alf/alfbitmapprovider.h> |
|
23 |
|
24 #include "muicscrollbar.h" |
|
25 |
|
26 // Forward declarations |
|
27 |
|
28 class CAlfAnchorLayout; |
|
29 class CAlfDeckLayout; |
|
30 class CAlfImageVisual; |
|
31 class CAlfLayout; |
|
32 class CAlfTexture; |
|
33 |
|
34 /** |
|
35 * Composite image |
|
36 */ |
|
37 NONSHARABLE_CLASS( CUiCCompositeImage ) : public CBase |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Leave safe constructor |
|
43 */ |
|
44 static CUiCCompositeImage* NewL( CAlfControl& aControl, CAlfLayout* aParentLayout, |
|
45 CAlfTexture& aTop, CAlfTexture& aMiddle, CAlfTexture& aBottom ); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 */ |
|
50 ~CUiCCompositeImage(); |
|
51 |
|
52 /** |
|
53 * Returns layout for this component |
|
54 */ |
|
55 CAlfLayout& Layout(); |
|
56 |
|
57 private: |
|
58 |
|
59 CUiCCompositeImage(); |
|
60 void ConstructL( CAlfControl& aControl, CAlfLayout* aParentLayout, |
|
61 CAlfTexture& aTop, CAlfTexture& aMiddle, CAlfTexture& aBottom ); |
|
62 void SetAnchors(); |
|
63 |
|
64 private: |
|
65 |
|
66 CAlfAnchorLayout* iLayout; |
|
67 CAlfImageVisual* iTop; |
|
68 CAlfImageVisual* iMiddle; |
|
69 CAlfImageVisual* iBottom; |
|
70 |
|
71 }; |
|
72 |
|
73 /** |
|
74 * CUiCScrollBar |
|
75 * |
|
76 */ |
|
77 NONSHARABLE_CLASS( CUiCScrollBar ) : public CAlfControl, public MUiCScrollBar, |
|
78 public MAlfBitmapProvider |
|
79 { |
|
80 |
|
81 public: |
|
82 |
|
83 /** |
|
84 * Leave safe constructor |
|
85 */ |
|
86 static CUiCScrollBar* NewL( CAlfEnv& aEnv, CAlfLayout* aParentLayout ); |
|
87 |
|
88 public: // from MUiCScrollBar |
|
89 |
|
90 /** |
|
91 * @see MUiCScrollBar::Destroy |
|
92 */ |
|
93 virtual void Destroy(); |
|
94 |
|
95 /** |
|
96 * @see MUiCScrollBar::Show |
|
97 */ |
|
98 virtual void Show( const TBool aShow ); |
|
99 |
|
100 /** |
|
101 * @see MUiCScrollBar::UpdateModelL |
|
102 */ |
|
103 virtual void UpdateModelL( const TUiCScrollBarModel& aModel ); |
|
104 |
|
105 /** |
|
106 * @see MUiCScrollBar::ThumbPosition |
|
107 */ |
|
108 virtual TInt ThumbPosition() const; |
|
109 |
|
110 /** |
|
111 * @see MUiCScrollBar::SetRect |
|
112 */ |
|
113 virtual void SetRect( const TRect& aRect ); |
|
114 |
|
115 /** |
|
116 * @see MUiCScrollBar::Redraw |
|
117 */ |
|
118 virtual void Redraw(); |
|
119 |
|
120 /** |
|
121 * @see MUiCScrollBar::NotifyThemeChanged |
|
122 */ |
|
123 virtual void NotifyThemeChanged(); |
|
124 |
|
125 /** |
|
126 * @see MUiCScrollBar::LayoutHints |
|
127 */ |
|
128 virtual TInt LayoutHints() const; |
|
129 |
|
130 private: // from MAlfEventHandler |
|
131 |
|
132 /** |
|
133 * @see MAlfEventHandler::OfferEventL |
|
134 */ |
|
135 virtual TBool OfferEventL( const TAlfEvent& aEvent ); |
|
136 |
|
137 private: // from MAlfBitmapProvider |
|
138 |
|
139 /** |
|
140 * @see MAlfBitmapProvider::ProvideBitmapL |
|
141 */ |
|
142 virtual void ProvideBitmapL( TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap ); |
|
143 |
|
144 private: |
|
145 |
|
146 /** |
|
147 * Destructor |
|
148 */ |
|
149 ~CUiCScrollBar(); |
|
150 |
|
151 /** |
|
152 * Constructor |
|
153 */ |
|
154 CUiCScrollBar(); |
|
155 |
|
156 /** |
|
157 * 2nd constructor |
|
158 */ |
|
159 void ConstructL( CAlfEnv& aEnv, CAlfLayout* aParentLayout ); |
|
160 |
|
161 /** |
|
162 * Sets anchors for background image and thumb |
|
163 */ |
|
164 void SetAnchors(); |
|
165 |
|
166 /** |
|
167 * Sets anchors for background |
|
168 */ |
|
169 void SetBgAnchors(); |
|
170 |
|
171 /** |
|
172 * Sets anchors for thumb |
|
173 */ |
|
174 void SetThumbAnchors(); |
|
175 |
|
176 /** |
|
177 * Reads values from layout |
|
178 */ |
|
179 void UpdateLayoutValues(); |
|
180 |
|
181 private: |
|
182 |
|
183 /** |
|
184 * Custom events |
|
185 */ |
|
186 enum TEvent |
|
187 { |
|
188 EFadeOut |
|
189 }; |
|
190 |
|
191 /** |
|
192 * Unique bitmaps IDs, make sure these do no overlap with the ones defined |
|
193 * in UI |
|
194 */ |
|
195 enum TBitmapId |
|
196 { |
|
197 EThumbTop = 0x10000, |
|
198 EThumbMiddle, |
|
199 EThumbBottom, |
|
200 EBackgroundTop, |
|
201 EBackgroundMiddle, |
|
202 EBackgroundBottom |
|
203 }; |
|
204 |
|
205 private: |
|
206 |
|
207 // Container layout |
|
208 CAlfDeckLayout* iDeck; |
|
209 |
|
210 // Scrollbar background layout |
|
211 CAlfAnchorLayout* iBgLayout; |
|
212 |
|
213 // Scrollbar layout |
|
214 CAlfAnchorLayout* iThumbLayout; |
|
215 |
|
216 // Scrollbar background visual |
|
217 CUiCCompositeImage* iBackGroundVisual; |
|
218 |
|
219 // Scrollbar thumb visual |
|
220 CUiCCompositeImage* iThumbVisual; |
|
221 |
|
222 // Scrollbar model |
|
223 TUiCScrollBarModel iModel; |
|
224 |
|
225 }; |
|
226 |
|
227 #endif /* C_UICSCROLLBAR_H */ |