|
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: Base class for video telephone popups |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_VTUIPOPUPBASE_H |
|
20 #define C_VTUIPOPUPBASE_H |
|
21 |
|
22 #include <coecobs.h> |
|
23 |
|
24 #include "mvtuicomponent.h" |
|
25 #include "tvtuicomponentstate.h" |
|
26 #include "tvtuifeatureids.h" |
|
27 #include "mvtuiresourcechangeobserver.h" |
|
28 #include "mvtuikeyeventobserver.h" |
|
29 |
|
30 class CAknVolumePopup; |
|
31 class MVtUiComponentManager; |
|
32 class MVtUiComponentStateObserver; |
|
33 class CFbsBitmap; |
|
34 |
|
35 /** |
|
36 * TVtUiBaseComponentState |
|
37 * |
|
38 * Base componentstate definition. |
|
39 * |
|
40 * @since S60 v3.2 |
|
41 */ |
|
42 class TVtUiBaseComponentState : public TVtUiComponentState |
|
43 { |
|
44 |
|
45 public: |
|
46 /** |
|
47 * Constructor |
|
48 * @param aComponent Reference to component. |
|
49 */ |
|
50 TVtUiBaseComponentState( MVtUiComponent& aComponent, |
|
51 TVtUiBlockListBitField aBitField ); |
|
52 }; |
|
53 |
|
54 /** |
|
55 * CVtUiPopupBase |
|
56 * |
|
57 * Base class for vide telephone popups |
|
58 * |
|
59 * @since S60 v3.2 |
|
60 */ |
|
61 class CVtUiPopupBase : public CBase, public MVtUiComponent, |
|
62 public MVtUiResourceChangeObserver, public MCoeControlObserver, |
|
63 public MVtUiKeyEventObserver |
|
64 { |
|
65 |
|
66 public: |
|
67 |
|
68 /** |
|
69 * Destructor |
|
70 */ |
|
71 ~CVtUiPopupBase(); |
|
72 |
|
73 public: // from MVtUiComponent |
|
74 |
|
75 /** |
|
76 * @see MVtUiComponent::ComponentId |
|
77 */ |
|
78 TComponentId ComponentId() const; |
|
79 |
|
80 /** |
|
81 * @see MVtUiComponent::ComponentAsControl |
|
82 */ |
|
83 CCoeControl* ComponentAsControl(); |
|
84 |
|
85 /** |
|
86 * @see MVtUiComponent::DoActivateL |
|
87 */ |
|
88 virtual void DoActivateL(); |
|
89 |
|
90 /** |
|
91 * @see MVtUiComponent::DoDeactivateL |
|
92 */ |
|
93 virtual void DoDeactivateL(); |
|
94 |
|
95 public: // from MVtUiComponentManager |
|
96 |
|
97 /** |
|
98 * @see MVtUiComponentManager::HandleResourceChangeL |
|
99 */ |
|
100 void HandleResourceChangeL( TInt aType ); |
|
101 |
|
102 public: // from MCoeControlObserver |
|
103 |
|
104 /** |
|
105 * @see MCoeControlObserver::HandleControlEventL |
|
106 */ |
|
107 virtual void HandleControlEventL( |
|
108 CCoeControl* aControl,TCoeEvent aEventType ) = 0; |
|
109 |
|
110 public: // from MVtUiKeyEventObserver |
|
111 |
|
112 /** |
|
113 * @see CCoeControl::MVtUiKeyEventObserver |
|
114 */ |
|
115 TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aCode ); |
|
116 |
|
117 public: // new functions |
|
118 |
|
119 /** |
|
120 * Set popup to be pemanently visible i.e. tapping outside |
|
121 * the control doesn't close the control. |
|
122 * @param aPermanent If Etrue popup will be visible all the time, |
|
123 * otherwise popup is closed and next time will obey timeout. |
|
124 */ |
|
125 void SetPermanenVisibility( TBool aPermanent ); |
|
126 |
|
127 /** |
|
128 * Set new component observer |
|
129 * @param iCompStateObserver New observer |
|
130 */ |
|
131 void SetObserver( MVtUiComponentStateObserver& aCompStateObserver ); |
|
132 |
|
133 /** |
|
134 * Gets slider control value. |
|
135 * @return value within slider control's value range |
|
136 */ |
|
137 TInt Value() const; |
|
138 |
|
139 /** |
|
140 * update popup itself |
|
141 */ |
|
142 virtual void UpdatePopupL(); |
|
143 |
|
144 protected: // new functions |
|
145 |
|
146 /** |
|
147 * Set new value to slider control. |
|
148 * @param aValue value within slider control's value range. |
|
149 */ |
|
150 void SetValue( TInt aValue ); |
|
151 |
|
152 /** |
|
153 * Scales the given value to slider control's value range |
|
154 * and sets it to the slider control |
|
155 * @param aValue value within popup control's value range. |
|
156 */ |
|
157 void ScaleAndSetValue( TInt aValue ); |
|
158 |
|
159 /** |
|
160 * Gets value from the slider control and scales it |
|
161 * @return value within popup control's value range |
|
162 */ |
|
163 TInt ScaledValue() const; |
|
164 |
|
165 /** |
|
166 * Gets value from the slider control and scales it |
|
167 * @param aValue value in popup control's value range. |
|
168 * @return value within slider control's value range |
|
169 */ |
|
170 TInt SliderValueWithScaling( TInt aValue ) const; |
|
171 |
|
172 /** |
|
173 * Set new end point values popup control |
|
174 * These values are not same as slider's range |
|
175 */ |
|
176 void SetMinAndMaxValues( TInt aMax, TInt aMin ); |
|
177 |
|
178 /* |
|
179 * Set adjust range of the slider |
|
180 */ |
|
181 void SetAdjustRange( TInt aMinimumValue, TInt aMaximumValue, |
|
182 TInt aStepCount ); |
|
183 |
|
184 /** |
|
185 * Set value type for vertical slider control |
|
186 */ |
|
187 void SetValueType( TInt aValueType ); |
|
188 |
|
189 /** |
|
190 * Shows popup. |
|
191 */ |
|
192 void ShowPopupL(); |
|
193 |
|
194 /** |
|
195 * Opens popup. |
|
196 */ |
|
197 void OpenPopupL(); |
|
198 |
|
199 /** |
|
200 * Closes popup |
|
201 */ |
|
202 void ClosePopup(); |
|
203 |
|
204 /** |
|
205 * Set time out time in seconds |
|
206 */ |
|
207 void SetTimeOut( TInt aTime ); |
|
208 |
|
209 /** |
|
210 * Checks whether popup is visible |
|
211 */ |
|
212 TBool IsPopUpVisible(); |
|
213 |
|
214 protected: |
|
215 |
|
216 /** |
|
217 * Constructor |
|
218 */ |
|
219 CVtUiPopupBase( MVtUiComponentManager& aComponentManager, |
|
220 TVtUiBlockListBitField aBitField, TComponentId aComponentId ); |
|
221 |
|
222 /** |
|
223 * 2nd constructor |
|
224 */ |
|
225 void BaseConstructL(); |
|
226 |
|
227 private: |
|
228 |
|
229 /** |
|
230 * Position of the popup |
|
231 */ |
|
232 TPoint PopupPosition() const; |
|
233 |
|
234 /** |
|
235 * Sets popup controls's value |
|
236 */ |
|
237 void SetPopupValue( TInt aValue ); |
|
238 |
|
239 protected: // Set in child constructor |
|
240 |
|
241 // Reference to component manager |
|
242 MVtUiComponentManager& iComponentManager; |
|
243 |
|
244 // Component state |
|
245 TVtUiBaseComponentState iComponentState; |
|
246 |
|
247 // Component id |
|
248 TComponentId iComponentId; |
|
249 |
|
250 private: |
|
251 |
|
252 // class for slider handling |
|
253 CAknVolumePopup* iPopup; |
|
254 |
|
255 // Interface for component state observing |
|
256 MVtUiComponentStateObserver* iCompStateObserver; |
|
257 |
|
258 // Maximum value |
|
259 TInt iMax; |
|
260 |
|
261 // Minimum value |
|
262 TInt iMin; |
|
263 |
|
264 // Number of steps |
|
265 TInt iStepCount; |
|
266 |
|
267 // Time out for showing popup |
|
268 TInt iTimeOutTime; |
|
269 |
|
270 // Scaling constant |
|
271 TInt iScalingConstant; |
|
272 |
|
273 }; |
|
274 |
|
275 #endif // CVTUIPEFSLIDERBASE_H |