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: Controlet to implement marquee functionality for visuals |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef T_TIRMARQUEECLET_H |
|
20 #define T_TIRMARQUEECLET_H |
|
21 |
|
22 #include <alf/alfeventhandler.h> |
|
23 |
|
24 class CAlfControl; |
|
25 class CAlfViewportLayout; |
|
26 class CAlfTextVisual; |
|
27 /** |
|
28 * Small controlet to implement marquee effects to visuals. |
|
29 * |
|
30 * Responsible for managing the supplied viewport layout to achieve a marquee effect. |
|
31 * Provides events to the control about scroll status changes. |
|
32 */ |
|
33 class TIRMarqueeClet : public MAlfEventHandler |
|
34 { |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Supported scroll styles. |
|
40 */ |
|
41 enum TIRScrollStyle |
|
42 { |
|
43 /** |
|
44 * Scroll is performed only once. |
|
45 * When scrolling is completed, the viewport is set to its original position. |
|
46 * This is the default scroll style if no other is explicitly set. |
|
47 */ |
|
48 EIRScrollStyleOnce, |
|
49 /** |
|
50 * Scroll is continuous scroll. |
|
51 */ |
|
52 EIRScrollStyleLoop |
|
53 }; |
|
54 |
|
55 /** |
|
56 * Supported scroll directions. |
|
57 */ |
|
58 enum TIRScrollDirection |
|
59 { |
|
60 /** |
|
61 * Scrolling is performed to left (western). |
|
62 * This is the default scroll direction if no other is explicitly set. |
|
63 */ |
|
64 EIRScrollDirectionLeft, |
|
65 /** |
|
66 * Scrolling is performed to right (arabic). |
|
67 */ |
|
68 EIRScrollDirectionRight |
|
69 }; |
|
70 |
|
71 public: |
|
72 |
|
73 /** |
|
74 * Constructor. |
|
75 */ |
|
76 TIRMarqueeClet(); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 ~TIRMarqueeClet(); |
|
82 |
|
83 /** |
|
84 * Sets the required information for this marquee controlet. |
|
85 * |
|
86 * @param aViewport Viewport layout to use. |
|
87 * @param aTextVisual Text visual to use. |
|
88 */ |
|
89 void Set( CAlfViewportLayout& aViewport, CAlfTextVisual& aTextVisual ); |
|
90 |
|
91 /** |
|
92 * Sets scroll speed in pixels per second. |
|
93 * |
|
94 * The actual scroll time is calculated dynamically by the controlet to achieve |
|
95 * smooth motion. |
|
96 * |
|
97 * @param aScrollSpeed Pixels per second to scroll. |
|
98 */ |
|
99 void SetScrollSpeed( TInt aScrollSpeed ); |
|
100 |
|
101 /** |
|
102 * Sets the scroll direction. |
|
103 * |
|
104 * @param aScrollDirection Scroll direction to use. |
|
105 */ |
|
106 void SetScrollDirection( TIRScrollDirection aScrollDirection ); |
|
107 |
|
108 /** |
|
109 * Sets the scroll style. |
|
110 * |
|
111 * @param aScrollStyle Scroll style to use. |
|
112 */ |
|
113 void SetScrollStyle( TIRScrollStyle aScrollStyle ); |
|
114 |
|
115 /** |
|
116 * Starts scrolling. |
|
117 * |
|
118 * Notifications of scroll start and stop events are sent to the registered control. |
|
119 * |
|
120 * @param aDelay Delay in milliseconds after which the scroll is started. |
|
121 * @param aSnooze Snooze period in milliseconds after scroll is completed. |
|
122 * The use of the snooze period is dependant on the scroll style. |
|
123 * When the scroll style is <code>EVRScrollStyleOnce</code>, the snooze |
|
124 * period indicates the amount of time after scrolling is completed before |
|
125 * the control is notified of the scroll complete event. |
|
126 */ |
|
127 void StartL( TInt aDelay = 0, TInt aSnooze = 0 ); |
|
128 |
|
129 // from base class MAlfEventHandler |
|
130 |
|
131 TBool OfferEventL( const TAlfEvent& aEvent ); |
|
132 |
|
133 private: |
|
134 |
|
135 /** |
|
136 * Supported scroll notification events. |
|
137 * Notification about these events are sent to the registered control when they occur. |
|
138 * Pointer to the viewport layout for which the event completed is passed as custom event data. |
|
139 */ |
|
140 enum TIRScrollEvent |
|
141 { |
|
142 /** |
|
143 * Notification that is sent when the scroll starts. |
|
144 * This is sent after the delay period, if any, expires. |
|
145 */ |
|
146 EIRCustomEventScrollStarted = 0x00002000, |
|
147 /** |
|
148 * Notification that is sent when the scroll has completed. |
|
149 * This is sent after scrolling is completed and after the snooze |
|
150 * period has passed. |
|
151 */ |
|
152 EIRCustomEventScrollCompleted |
|
153 }; |
|
154 |
|
155 /** |
|
156 * Viewport layout to manage. |
|
157 * Not owned. |
|
158 */ |
|
159 CAlfViewportLayout* iViewport; |
|
160 |
|
161 /** |
|
162 * Text visual. |
|
163 * Not owned. |
|
164 */ |
|
165 CAlfTextVisual* iTextVisual; |
|
166 |
|
167 /** |
|
168 * Text visual scroll size. |
|
169 */ |
|
170 TSize iScrollSize; |
|
171 |
|
172 /** |
|
173 * Scroll speed in pixels per second. |
|
174 */ |
|
175 TInt iScrollSpeed; |
|
176 |
|
177 /** |
|
178 * Scroll direction to use. |
|
179 */ |
|
180 TIRScrollDirection iScrollDirection; |
|
181 |
|
182 /** |
|
183 * Scroll style to use. |
|
184 */ |
|
185 TIRScrollStyle iScrollStyle; |
|
186 |
|
187 /** |
|
188 * The snooze period. |
|
189 */ |
|
190 TInt iSnoozeTime; |
|
191 |
|
192 /** |
|
193 * Point of origin for the viewport. |
|
194 */ |
|
195 TAlfRealPoint iOrigin; |
|
196 |
|
197 /** |
|
198 * The width of the original text. |
|
199 */ |
|
200 TInt iOriginalTextWidth; |
|
201 |
|
202 }; |
|
203 |
|
204 #endif // T_TVRMARQUEECLET_H |
|