1 /* |
|
2 * Copyright (c) 2007 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: highlight timer class |
|
15 * Version : %version: MM_11.1.4 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_MMHIGHLIGHTTIMER_H |
|
21 #define C_MMHIGHLIGHTTIMER_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 |
|
26 class CMmWidgetContainer; |
|
27 |
|
28 /** |
|
29 * Used by Multimedia Menu to handle highlight behaviour. |
|
30 * If the timer is set up highlight is due to disappera after set up |
|
31 * time. |
|
32 * |
|
33 * @code |
|
34 * @endcode |
|
35 * @lib mmwidgets |
|
36 * @since S60 v3.0 |
|
37 * @ingroup group_mmwidgets |
|
38 */ |
|
39 NONSHARABLE_CLASS( CMmHighlightTimer ) : public CActive |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Two-phased constructor. |
|
44 * |
|
45 * @since S60 v3.0 |
|
46 * @param aContainer Widget container that will use timer. |
|
47 * @return Instance of highlight timer. |
|
48 */ |
|
49 IMPORT_C static CMmHighlightTimer* NewL( |
|
50 CMmWidgetContainer* aContainer ); |
|
51 |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 * |
|
55 * @since S60 v3.0 |
|
56 * @param aContainer Widget container that will use timer. |
|
57 * @return Instance of highlight timer. |
|
58 */ |
|
59 IMPORT_C static CMmHighlightTimer* NewLC( |
|
60 CMmWidgetContainer* aContainer ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 * |
|
65 * @since S60 v3.0 |
|
66 */ |
|
67 virtual ~CMmHighlightTimer(); |
|
68 |
|
69 /** |
|
70 * Starts the timer with the time specified. Also draws the highlight. |
|
71 * Highlight timer is the only element eligible to draw highlight with single click. |
|
72 * If aTime parameter is negative or null the highlight is set permanently until it is |
|
73 * cancelled manually (e.g. by calling StopL). |
|
74 * |
|
75 * @since S60 v5.0 |
|
76 * @param aTime Time after which timer expires. |
|
77 * @param aPressDownState The highlight state to be drawn. Default is highlight pressed down. |
|
78 */ |
|
79 void StartL( TInt aTime, TBool aPressDownState = ETrue ); |
|
80 |
|
81 /** |
|
82 * Continues the highlight visibility for a specific time. |
|
83 * If highlight wasn't active (visible) then this method does nothing. |
|
84 * |
|
85 * @since S60 v5.0 |
|
86 * @param aTime Time after which timer expires. |
|
87 */ |
|
88 void ContinueL( TInt aTime ); |
|
89 |
|
90 /** |
|
91 * Cancels the asynchronous request and draws over the highlighted item (if told to). |
|
92 * |
|
93 * @since S60 v5.0 |
|
94 * @param aDrawOverHighlight Tells if previous highlight should be drawn over with no highlight. |
|
95 */ |
|
96 void StopL( TBool aDrawOverHighlight = ETrue ); |
|
97 |
|
98 |
|
99 /** |
|
100 * Returns the previously drawn highlight index. |
|
101 * |
|
102 * @since S60 v5.0 |
|
103 * @return Previously drawn highlight index. |
|
104 */ |
|
105 TInt TimerHighlightIndex() const; |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Constructor. |
|
111 * |
|
112 * @since S60 v3.0 |
|
113 * @param aContainer The widget for which highlight is handled by the timer. |
|
114 */ |
|
115 CMmHighlightTimer( CMmWidgetContainer* aContainer ); |
|
116 |
|
117 /** |
|
118 * 2nd phase constructor. |
|
119 * |
|
120 * @since S60 v3.0 |
|
121 */ |
|
122 void ConstructL(); |
|
123 |
|
124 /** |
|
125 * Disables highlight and redraws the view. |
|
126 * |
|
127 * @since S60 v3.0 |
|
128 */ |
|
129 void RunL(); |
|
130 |
|
131 /** |
|
132 * Cancels timer. |
|
133 * |
|
134 * @since S60 v3.0 |
|
135 */ |
|
136 void DoCancel(); |
|
137 |
|
138 /** |
|
139 * Run if error occurred. |
|
140 * |
|
141 * @since S60 v3.0 |
|
142 * @param aError Error for which error handling should be run. |
|
143 * @return Error code. |
|
144 */ |
|
145 TInt RunError( TInt aError ); |
|
146 |
|
147 /** |
|
148 * Draws the highlight. |
|
149 * |
|
150 * @since S60 v5.0 |
|
151 * @param aItemIndex The index of the highlight. |
|
152 */ |
|
153 void DrawHighlightL( TInt aItemIndex ); |
|
154 |
|
155 /** |
|
156 * Sets press down state on widget drawer to draw highlight as told. |
|
157 * |
|
158 * @since S60 v5.0 |
|
159 * @param aPressDownState ETrue to set press down state. Otherwise press down state is disabled. |
|
160 */ |
|
161 void SetPressDownState(TBool aPressDownState); |
|
162 |
|
163 private: |
|
164 |
|
165 /** |
|
166 * Defines states of the CMmHighlightTimer. |
|
167 */ |
|
168 enum THighlightTimerState |
|
169 { |
|
170 EInactivityState, |
|
171 ETimerExpirationCompletionState, |
|
172 EExternalCompletionState |
|
173 }; |
|
174 |
|
175 /** |
|
176 * Actual state of the CMmHighlightTimer. |
|
177 */ |
|
178 TInt iState; |
|
179 |
|
180 /** |
|
181 * Timer class. CMmHighlightTimer requests notifications |
|
182 * from this member every 6 seconds. |
|
183 */ |
|
184 RTimer iTimer; |
|
185 |
|
186 /** |
|
187 * Manages highlight. Receives notifications. |
|
188 * Not own. |
|
189 */ |
|
190 CMmWidgetContainer* iContainer; |
|
191 |
|
192 /** |
|
193 * Index of drawn item. |
|
194 */ |
|
195 TInt iTimerHighlightIndex; |
|
196 |
|
197 }; |
|
198 |
|
199 #endif // C_MMHIGHLIGHTTIMER_H |
|
200 |
|