|
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 #ifndef HGVGSCROLLBAR_H_ |
|
19 #define HGVGSCROLLBAR_H_ |
|
20 |
|
21 // INCLUDES |
|
22 #include <ganes/HgScroller.h> |
|
23 #include <e32base.h> |
|
24 #include <VG/openvg.h> |
|
25 #include <gulcolor.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 |
|
29 class MHgScrollbarObserver; |
|
30 class CHgScrollbar; |
|
31 |
|
32 /** |
|
33 * Helper class for drawing and interacting scrollbars. |
|
34 */ |
|
35 NONSHARABLE_CLASS(CHgVgScrollBar) : CBase |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Creates new CHgVGScrollBar. |
|
41 * |
|
42 * @param aObserver observer for the scrollbar. |
|
43 */ |
|
44 static CHgVgScrollBar* NewL( MHgScrollbarObserver& aObserver, |
|
45 TRect aScrollbarRect, |
|
46 TSize aTotalSize, |
|
47 TSize aViewSize, |
|
48 TBool aLandscapeScrolling, |
|
49 CHgScroller::THgScrollBarType aScrollBarType ); |
|
50 |
|
51 // Destructor. |
|
52 virtual ~CHgVgScrollBar(); |
|
53 |
|
54 public: // METHODS |
|
55 |
|
56 void SetViewPosition( TPoint aPosition ); |
|
57 |
|
58 TBool HandlePointerEventL( const TPointerEvent& aEvent ); |
|
59 |
|
60 void Draw(const TRect& aWindowRect, TReal aAlpha) const; |
|
61 |
|
62 TBool IsEnabled() const; |
|
63 |
|
64 void SetEnabled(TBool aEnabled); |
|
65 |
|
66 void ResizeL(MHgScrollbarObserver& aObserver, TRect aScrollbarRect, |
|
67 TSize aTotalSize, |
|
68 TSize aViewSize, |
|
69 TBool aLandscapeScrolling, |
|
70 CHgScroller::THgScrollBarType aScrollBarType); |
|
71 |
|
72 protected: // Constructors |
|
73 CHgVgScrollBar( ); |
|
74 |
|
75 void ConstructL (MHgScrollbarObserver& aObserver, TRect aScrollbarRect, |
|
76 TSize aTotalSize, |
|
77 TSize aViewSize, |
|
78 TBool aLandscapeScrolling, |
|
79 CHgScroller::THgScrollBarType aScrollBarType); |
|
80 |
|
81 protected: // Internal implementation |
|
82 |
|
83 void CreateImagesL(); |
|
84 |
|
85 void DrawImage(const TPoint& aPosition, VGImage aImage, |
|
86 const TSize& aSize, const TRect& aWindowRect, TReal aAlpha) const; |
|
87 |
|
88 private: |
|
89 TBool iEnabled; |
|
90 |
|
91 CHgScrollbar* iScrollbar; |
|
92 |
|
93 VGImage iScrollbarBg; |
|
94 VGImage iScrollbarHandleBg; |
|
95 VGImage iScrollbarHandle; |
|
96 VGImage iScrollbarBgSelected; |
|
97 VGImage iScrollbarHandleSelected; |
|
98 |
|
99 }; |
|
100 |
|
101 #endif /* HGVGSCROLLBAR */ |