|
1 /* |
|
2 * Copyright (c) 2005-2006 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: header file of control group and button group |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef C_CFEPUILAYOUTROOTCTRL_H |
|
19 #define C_CFEPUILAYOUTROOTCTRL_H |
|
20 |
|
21 #include <peninputlayoutctrlgroup.h> |
|
22 #include <gulgcmap.h> |
|
23 class CDragBar; |
|
24 class CCoeControl; |
|
25 class CFepUiCursor; |
|
26 /** |
|
27 * CFepUiLayoutRootCtrl |
|
28 * |
|
29 * Root control of the layout. It's a control group will consists of several controls. |
|
30 * |
|
31 * @lib feplayoutcontrol.lib |
|
32 * @since S60 V4.0 |
|
33 */ |
|
34 NONSHARABLE_CLASS(CFepUiLayoutRootCtrl) : public CControlGroup, |
|
35 public MEventObserver |
|
36 { |
|
37 public: |
|
38 //constructor and destructor |
|
39 /** |
|
40 * Factory function. |
|
41 * |
|
42 * @since S60 V4.0 |
|
43 * @param aUiLayout Ui layout who contains this control.Ownership not transferred |
|
44 * @return An instance of CFepUiLayoutRootCtrl class |
|
45 */ |
|
46 static CFepUiLayoutRootCtrl* NewL(CFepUiLayout* aUiLayout); |
|
47 |
|
48 /** |
|
49 * Destructor |
|
50 * |
|
51 * @since S60 V4.0 |
|
52 */ |
|
53 virtual ~ CFepUiLayoutRootCtrl(); |
|
54 |
|
55 /** |
|
56 * HandleEventL. Handle UI event. |
|
57 * There are only 4 kinds of UI event right now: Initialization, raw event, |
|
58 * pointer and pointer buffer event. |
|
59 * |
|
60 * @since S60 v4.0 |
|
61 * @param aType The event type. See TEventType |
|
62 * @param aEventData The event data. |
|
63 * @return The control which processes the event |
|
64 */ |
|
65 TBool HandleEventL(TEventType aType, const TAny* aEventData); |
|
66 |
|
67 |
|
68 /** |
|
69 * Set the control which has pointer down event |
|
70 * |
|
71 * @since S60 v4.0 |
|
72 * @param aCtrl The control to be set. NULL if pointer up |
|
73 * happens in other control, and this will cause a canceling pointer down operation |
|
74 * in that control which has the pointer down event. |
|
75 */ |
|
76 void SetPointerDownCtrlL(CFepUiBaseCtrl* aCtrl); |
|
77 |
|
78 /** |
|
79 * Register to layout to require updaing control valid region constantly. |
|
80 * |
|
81 * @since S60 v4.0 |
|
82 * @param aCtrl The contrl which want to update region. |
|
83 * @param aRequiredFlag Register or deregister. ETrue if register. |
|
84 */ |
|
85 IMPORT_C void RequireRegionUpdateL(CFepUiBaseCtrl* aCtrl,TBool aRequiredFlag); |
|
86 |
|
87 |
|
88 /** |
|
89 * Draw contents within the rect. |
|
90 * |
|
91 * @since S60 v4.0 |
|
92 * @param aRect The rect to be drawn in. |
|
93 * @param aDrawFrameFlag The flag which tells whether draw content of draw frame only |
|
94 */ |
|
95 void DrawRect(const TRect& aRect,TBool aDrawFrameFlag = EFalse); //internal use only |
|
96 |
|
97 /** |
|
98 * AddControlL |
|
99 |
|
100 |
|
101 /** |
|
102 * RemoveControl |
|
103 * Remove a control from layout. |
|
104 * Remove a control after layout initialization is not supported right now |
|
105 * |
|
106 * @since S60 v4.0 |
|
107 * @param aControl The control to be removed. |
|
108 */ |
|
109 void RemoveControl(CFepUiBaseCtrl* aControl); |
|
110 |
|
111 /** |
|
112 * RemoveControl |
|
113 * Remove a control from layout. |
|
114 * Remove a control after layout initialization is not supported right now |
|
115 * |
|
116 * @since S60 v4.0 |
|
117 * @param aControl The control to be removed. |
|
118 */ |
|
119 void RemoveControl(CCoeControl* aControl); |
|
120 |
|
121 /** |
|
122 * Set layout's rectangle |
|
123 * |
|
124 * @since S60 V4.0 |
|
125 * @param aRect The new control area |
|
126 */ |
|
127 void SetRect(const TRect& aRect); |
|
128 |
|
129 /** |
|
130 * Init layout control |
|
131 * Do layout control initialization. It's called by layout when layout |
|
132 * is initialized. |
|
133 * |
|
134 * @since S60 v4.0 |
|
135 * @return The layout rect. |
|
136 */ |
|
137 TRect InitControl(); |
|
138 |
|
139 /** |
|
140 * Capture or release the pointer |
|
141 * |
|
142 * @since S60 v4.0 |
|
143 * @param aControl The control who wants the operation. |
|
144 * @param aFlag Flag indicates capture or release. ETure if capturing. |
|
145 * @return The control which captures the pointer before. |
|
146 */ |
|
147 CFepUiBaseCtrl* CapturePointer(CFepUiBaseCtrl* aCtrl,TBool aFlag = ETrue); |
|
148 |
|
149 /** |
|
150 * Get the control which captures the pointer |
|
151 * |
|
152 * @since S60 v4.0 |
|
153 * @return The control which captures the pointer. |
|
154 */ |
|
155 inline CFepUiBaseCtrl* CtrlCapPointer(); |
|
156 |
|
157 /* |
|
158 * Get the max editor length which the input context field can hold. |
|
159 * Called by CFepUiLayout |
|
160 * |
|
161 * @since S60 v4.0 |
|
162 * @return The editor length |
|
163 */ |
|
164 TInt GetInputContextFieldMaxLen(); |
|
165 |
|
166 /** |
|
167 * Test whether the position is valid. |
|
168 * This is used to test the target position when draging controls to some place |
|
169 * |
|
170 * @since S60 v4.0 |
|
171 * @param aRect The rect to be checked. |
|
172 * @param aDragbar The dragbar being dragged |
|
173 * @param aVInfo The valid information in vertial dirtection |
|
174 * @param aHInfo The valid information in horizontal dirtection |
|
175 * @return ETue if no confliction. Otherwise, EFalse |
|
176 */ |
|
177 TBool IsValidDestination(const TRect& aRect,CDragBar* aDragBar, |
|
178 TBool& aVInfo,TBool& aHInfo); |
|
179 |
|
180 /** |
|
181 * Draw control frame |
|
182 * |
|
183 * @since S60 V4.0 |
|
184 * @param aFrameRect The rect to be drawn |
|
185 * @param aDrawFlag Draw or erase flag. ETrue if draw |
|
186 * @return The affected rect |
|
187 */ |
|
188 TRect DrawFrame(const TRect& aFrameRect, TBool aDrawFlag = ETrue); |
|
189 |
|
190 /** |
|
191 * Get the region where user can't start the drawing. |
|
192 * |
|
193 * @since S60 V4.0 |
|
194 * @return The region required |
|
195 */ |
|
196 inline const TRegion& NonHwrStartingPtRegion(); |
|
197 |
|
198 //from base class CFepUiBaseCtrl |
|
199 /** |
|
200 * From CFepUiBaseCtrl |
|
201 * Draw control |
|
202 * |
|
203 * @since S60 V4.0 |
|
204 */ |
|
205 virtual void Draw(); |
|
206 |
|
207 /** |
|
208 * From CFepUiBaseCtrl |
|
209 * Update control's valid region when other control hiding or displaying. |
|
210 * This is usually used for HWR window to change it's writing area. |
|
211 * |
|
212 * @since S60 V4.0 |
|
213 * @param aCtrl The control whose displaying status changed |
|
214 * @param bFlag ETrue if control is hiden, otherwise EFalse |
|
215 */ |
|
216 virtual void UpdateValidRegion(CFepUiBaseCtrl* aCtrl,TBool aRemoveFlag); |
|
217 |
|
218 //from base control MPositionObserver |
|
219 /** |
|
220 * From MPositionObserver |
|
221 * Handle position change event |
|
222 * |
|
223 * @since S60 v4.0 |
|
224 * @param aOffset The moving offset |
|
225 * @return The flag whether this observer has processed the event. |
|
226 * ETrue if processed.Otherwise EFalse. |
|
227 */ |
|
228 TBool HandlePositionChange(const TPoint& aOffset); |
|
229 |
|
230 |
|
231 //from base class MEventObserver |
|
232 /** |
|
233 * From MEventObserver |
|
234 * Handle control event |
|
235 * |
|
236 * @since S60 v4.0 |
|
237 * @param aEventType The event type |
|
238 * @param aCtrl The control who sends the event |
|
239 * @param aEventData The event data |
|
240 */ |
|
241 void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData); |
|
242 |
|
243 /** |
|
244 * From CFepUiBaseCtrl |
|
245 * OnActivate. Called when the layout is going to be shown. |
|
246 * |
|
247 * @since S60 v4.0 |
|
248 */ |
|
249 IMPORT_C void OnActivate(); |
|
250 |
|
251 /** |
|
252 * From CFepUiBaseCtrl |
|
253 * OnDeActivate. Called when the layout is going to be hidden |
|
254 * |
|
255 * @since S60 v4.0 |
|
256 */ |
|
257 IMPORT_C void OnDeActivate(); |
|
258 |
|
259 CWindowToBitmapMappingGc* GetRWindowGcL(); |
|
260 |
|
261 /** |
|
262 * Handle system resource change. |
|
263 * |
|
264 * @since S60 V5.0 |
|
265 * @param aType The system resource change type |
|
266 */ |
|
267 void HandleResourceChange(TInt aType); |
|
268 |
|
269 /** |
|
270 * Public for layout |
|
271 * |
|
272 * @since S60 V5.0 |
|
273 */ |
|
274 void GraphicDeviceSizeChanged(); |
|
275 virtual void BringToTopInGroup(CFepUiBaseCtrl* aCtrl); |
|
276 virtual void BringToBackInGroup(CFepUiBaseCtrl* aCtrl); |
|
277 |
|
278 CFepUiCursor* CreateCursor(); |
|
279 protected: |
|
280 /** |
|
281 * 2nd phase constructor |
|
282 * |
|
283 * @since S60 v4.0 |
|
284 */ |
|
285 void ConstructL(); |
|
286 |
|
287 private: |
|
288 /** |
|
289 * Default constructor. |
|
290 * |
|
291 * @since S60 V4.0 |
|
292 * @param aRect The rectangle area for this control |
|
293 * @param aUiLayout Ui layout who contains this control |
|
294 */ |
|
295 CFepUiLayoutRootCtrl(CFepUiLayout* aUiLayout); |
|
296 //from CFepUiBaseCtrl |
|
297 /** |
|
298 * From CFepUiBaseCtrl |
|
299 * Handle pointer down event |
|
300 * |
|
301 * @since S60 V4.0 |
|
302 * @param aPoint The point position relative the layout |
|
303 * @return The control which handles the event. |
|
304 */ |
|
305 CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint); |
|
306 |
|
307 /** |
|
308 * From CFepUiBaseCtrl |
|
309 * Handle pointer move event |
|
310 * |
|
311 * @since S60 V4.0 |
|
312 * @param aPoint The point position relative the layout |
|
313 * @return The control which handles the event. |
|
314 */ |
|
315 CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint); |
|
316 |
|
317 /** |
|
318 * From CFepUiBaseCtrl |
|
319 * Handle pointer up event |
|
320 * |
|
321 * @since S60 V4.0 |
|
322 * @param aPoint The point position relative the layout |
|
323 * @return The control which handles the event. |
|
324 */ |
|
325 CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint); |
|
326 |
|
327 void DoRegionUpdateForCtrls(); |
|
328 |
|
329 void RegisterICFEditor(); |
|
330 |
|
331 void InsertToPopList(CFepUiBaseCtrl* aCtrl); |
|
332 |
|
333 CFepUiCursor* CreateCursorL(); |
|
334 TBool ClipCursorForCtrlNeeded(CFepUiBaseCtrl* aCtrl, |
|
335 const TBool aBringToTopFlag, |
|
336 TInt& aCursorIndex); |
|
337 private: |
|
338 |
|
339 /** |
|
340 * Indicate whether the pointer down event should be canceled. |
|
341 */ |
|
342 TBool iPointerDownCanceled; |
|
343 |
|
344 TBool iShadowShown; |
|
345 /** |
|
346 * Control list for controls which require updating rect constantly |
|
347 */ |
|
348 RPointerArray<CFepUiBaseCtrl> iCtrlRegionAwareList; |
|
349 |
|
350 /** |
|
351 * The control who has captured the pointer. |
|
352 * Not own |
|
353 */ |
|
354 CFepUiBaseCtrl* iPointerCaptureCtrl; |
|
355 |
|
356 /** |
|
357 * Layout position. To keep the position when layout moving |
|
358 */ |
|
359 TPoint iLayoutPos; |
|
360 |
|
361 |
|
362 CFepUiCursor* iCursor; |
|
363 |
|
364 /** |
|
365 * Control list for controls which require to be aware any overlapping change |
|
366 * due to other controls show/hide. |
|
367 */ |
|
368 RPointerArray<CFepUiBaseCtrl> iCtrlOverlappingAwareList; |
|
369 |
|
370 CWindowToBitmapMappingGc* iWindowGc; |
|
371 }; |
|
372 |
|
373 #include "peninputlayoutrootctrl.inl" |
|
374 //end of classd CFepUiLayoutRootCtrl |
|
375 |
|
376 #endif //C_CFEPUILAYOUTROOTCTRL_H |