|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef HGSCROLLBAR_H_ |
|
20 #define HGSCROLLBAR_H_ |
|
21 |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <ganes/HgScroller.h> |
|
25 |
|
26 struct TPointerEvent; |
|
27 class TAknsItemID; |
|
28 class CWindowGc; |
|
29 class CFbsBitmap; |
|
30 class CGulIcon; |
|
31 class CFont; |
|
32 |
|
33 class MHgScrollbarObserver; |
|
34 |
|
35 NONSHARABLE_CLASS( CHgScrollbar ) : public CBase |
|
36 { |
|
37 public: |
|
38 static CHgScrollbar* NewL( MHgScrollbarObserver& aObserver ); |
|
39 |
|
40 virtual ~CHgScrollbar(); |
|
41 |
|
42 public: |
|
43 |
|
44 void InitScrollBarL( |
|
45 TRect aScrollbarRect, |
|
46 TSize aTotalSize, |
|
47 TSize aViewSize, |
|
48 TBool aLandscapeScrolling ); |
|
49 |
|
50 void SetViewPosition( TPoint aPosition ); |
|
51 |
|
52 TBool HandlePointerEventL( const TPointerEvent& aEvent ); |
|
53 |
|
54 void Draw( CWindowGc& aGc ); |
|
55 |
|
56 const CGulIcon* ScrollbarBg() const; |
|
57 |
|
58 const CGulIcon* ScrollbarHandleBg() const; |
|
59 |
|
60 const CGulIcon* ScrollbarHandle() const; |
|
61 |
|
62 const CGulIcon* ScrollbarBgSelected() const; |
|
63 |
|
64 const CGulIcon* ScrollbarHandleSelected() const; |
|
65 |
|
66 const TRect& ScrollbarRect() const; |
|
67 |
|
68 const TPoint& HandlePosition() const; |
|
69 |
|
70 TBool IsStatic() const; |
|
71 |
|
72 TBool IsDragging() const; |
|
73 |
|
74 TBool Handler() const; |
|
75 |
|
76 void Reset(); |
|
77 |
|
78 protected: |
|
79 CHgScrollbar( MHgScrollbarObserver& aObserver ); |
|
80 |
|
81 void ConstructL(); |
|
82 |
|
83 private: |
|
84 |
|
85 void DrawScrollbar( CWindowGc& aGc ); |
|
86 |
|
87 TBool HandleScrollBarPointerEvent( const TPointerEvent& aEvent ); |
|
88 |
|
89 void CheckHandlePosition( TBool aReportChange ); |
|
90 |
|
91 void InitIconsL( TBool aInitBgIcons ); |
|
92 |
|
93 void CreateIconL( CGulIcon*& aIcon, TSize aSize); |
|
94 |
|
95 void DrawIconL( CGulIcon& aIcon, |
|
96 const TAknsItemID& aTop, |
|
97 const TAknsItemID& aMiddle, |
|
98 const TAknsItemID& aBottom ); |
|
99 |
|
100 void DrawBitmapL( CGulIcon& aIcon, |
|
101 const TAknsItemID& aItem, |
|
102 const TRect& aDestRect ); |
|
103 |
|
104 void ScaleBitmapL( const TRect& aDestRect, |
|
105 CFbsBitmap* aDest, |
|
106 const CFbsBitmap* aSrc); |
|
107 |
|
108 private: |
|
109 MHgScrollbarObserver& iObserver; |
|
110 |
|
111 CGulIcon* iScrollbarBg; |
|
112 CGulIcon* iScrollbarHandleBg; |
|
113 CGulIcon* iScrollbarHandle; |
|
114 CGulIcon* iScrollbarBgSelected; |
|
115 CGulIcon* iScrollbarHandleSelected; |
|
116 |
|
117 TRect iScrollbarRect; |
|
118 TRect iNaviRect; |
|
119 TPoint iHandlePosition; |
|
120 TPoint iPrevDrag; |
|
121 TSize iTotalSize; |
|
122 TSize iViewSize; |
|
123 TSize iHandleSize; |
|
124 TBool iLandscapeScrolling; |
|
125 TBool iDragging; |
|
126 TBool iHandler; |
|
127 TBool iStatic; |
|
128 |
|
129 TInt iScrollLength; |
|
130 TInt iTotalLength; |
|
131 }; |
|
132 |
|
133 #endif /*HGSCROLLBAR_H_*/ |