author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:23:59 +0300 | |
branch | RCL_3 |
changeset 83 | 26b2b12093af |
parent 71 | d5e927d5853b |
permissions | -rw-r--r-- |
66 | 1 |
/* |
2 |
* Copyright (c) 2003-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: Implements the Form LCDUI component. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef CMIDFORM_H |
|
20 |
#define CMIDFORM_H |
|
21 |
||
22 |
// CCoeControl inheritance in class declaration |
|
23 |
#include <coecntrl.h> |
|
24 |
// MEikScrollBarObserver interface in class declaration |
|
25 |
#include <eiksbobs.h> //MEikScrollBarObserver |
|
26 |
#include <lcdui.h> |
|
27 |
// using Timer to do defer laying out (iLayoutTimer member) |
|
28 |
#include <TimeOutTimer.h> |
|
29 |
||
30 |
#ifdef RD_TACTILE_FEEDBACK |
|
31 |
#include <touchfeedback.h> |
|
32 |
#endif |
|
33 |
||
34 |
||
35 |
// Layout of Rect of midp_form_pane |
|
36 |
#include <AknUtils.h> |
|
37 |
||
38 |
class CEikScrollBarFrame; |
|
39 |
class CEikLabel; |
|
40 |
||
41 |
class CMIDItem; |
|
42 |
class CMIDItemLabel; |
|
43 |
class CMIDControlItem; |
|
44 |
class CMIDDisplayable; |
|
45 |
class CMIDSpacer; |
|
46 |
class CMIDStringItem; |
|
47 |
class CMIDCommandList; |
|
48 |
class CMIDFormRow; |
|
49 |
class CAknsListBoxBackgroundControlContext; |
|
50 |
class CAknsFrameBackgroundControlContext; |
|
51 |
class CMIDCommand; |
|
52 |
class CMIDPopupNoteController; |
|
53 |
class CMIDFormPhysics; |
|
54 |
||
55 |
||
56 |
/** |
|
57 |
* A form class as defined in MMIDForm. Manages items (MMIDItems) using rows, CMIDFormRow. |
|
58 |
* |
|
59 |
* @see CMIDFormRow, CMIDItem, CMIDControlItem and item derived classes. |
|
60 |
*/ |
|
61 |
#ifdef RD_SCALABLE_UI_V2 |
|
62 |
NONSHARABLE_CLASS(CMIDForm) : public CCoeControl, public MCoeControlObserver, |
|
63 |
public MMIDForm, public MTimeOutNotify, public MEikScrollBarObserver |
|
64 |
#else |
|
65 |
NONSHARABLE_CLASS(CMIDForm) : public CCoeControl, public MCoeControlObserver, |
|
66 |
public MMIDForm, public MTimeOutNotify |
|
67 |
#endif //RD_SCALABLE_UI_V2 |
|
68 |
{ |
|
69 |
public: |
|
70 |
enum TDirection |
|
71 |
{ |
|
72 |
EDown=6, |
|
73 |
EUp=1, |
|
74 |
ELeft=2, |
|
75 |
ERight=5, |
|
76 |
ENone=0 |
|
77 |
}; |
|
78 |
||
79 |
enum TCommandType |
|
80 |
{ |
|
81 |
EInsert, |
|
82 |
EDelete, |
|
83 |
EDeleteAll, |
|
84 |
ESet, |
|
85 |
ERefresh |
|
86 |
}; |
|
87 |
||
88 |
struct TFormCommand |
|
89 |
{ |
|
90 |
TCommandType iCommand; |
|
91 |
TInt iIndex; |
|
92 |
MMIDItem* iItem; |
|
93 |
}; |
|
94 |
||
95 |
public: |
|
96 |
||
97 |
static CMIDForm* NewL(MMIDEnv& aEnv,MMIDDisplayable& aDisplayable); |
|
98 |
||
99 |
~CMIDForm(); |
|
100 |
||
101 |
public: |
|
102 |
void RequestLayoutL(TBool aImmediately = EFalse); |
|
103 |
||
104 |
void HandleCurrentL(TBool aCurrent); |
|
105 |
TBool TryDetectLongTapL(const TPointerEvent &aPointerEvent); |
|
106 |
||
107 |
void SetFocusedItemIfNone(CMIDItem* aItem); |
|
108 |
void RemoveFocusIfFocused(CMIDItem* aItem); |
|
109 |
||
110 |
void Traverse(TDirection aDirection); |
|
111 |
void ScrollRelative(TInt aScroll); |
|
112 |
||
113 |
/** Scrolls to the location specified by the parameter. Does not finalize the scroll. */ |
|
114 |
void RawScroll(TInt aScroll); |
|
115 |
||
116 |
TRect GetClientArea(); |
|
117 |
||
118 |
void UpdateItemCommands(CMIDCommandList* aCommandList, CMIDCommand* aMSKCommand); |
|
119 |
||
120 |
void RefreshItemL(TInt aIndex); |
|
121 |
void RefreshItemL(MMIDItem* aItem); |
|
122 |
void RemoveDeletedItem(CMIDControlItem& aItem); |
|
123 |
||
124 |
inline MMIDItem::TLayout InitialAlignment(); |
|
125 |
TBool RectPartiallyVisible(const TRect& aRect); |
|
126 |
TBool RectFullyVisible(const TRect& aRect); |
|
127 |
||
128 |
//Touch event handling from Items |
|
129 |
void HandleTouchControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
|
130 |
||
131 |
static TInt FormWidth(); |
|
132 |
||
133 |
// FormRect method has 2 implementations: non-static and static |
|
134 |
static TRect StaticFormRect(); |
|
135 |
inline TRect FormRect(); |
|
136 |
||
137 |
inline TInt Width(); |
|
138 |
inline TInt Height(); |
|
139 |
||
140 |
inline CMIDDisplayable& CurrentDisplayable(); |
|
141 |
MMIDItem* CurrentItem() const; |
|
142 |
||
143 |
// Width of navi bar position only for ( iAlignment == MMIDItem::ERight ) |
|
144 |
TInt GetMidpNaviPos(); |
|
145 |
||
146 |
/** |
|
147 |
* Checks if the current item on the form is the one passed as a parameter. |
|
148 |
* This method is needed because CCoeControl::IsFocused() cannot be used |
|
149 |
* in case a menu is open. |
|
150 |
* |
|
151 |
* @param aItem Pointer to a form item. |
|
152 |
* @return ETrue, if aItem is the curren item on the form. |
|
153 |
*/ |
|
154 |
TBool IsCurrentItem(CMIDItem* aItem) const; |
|
155 |
||
156 |
/** |
|
157 |
* Handles event when application switches to/from the foreground. |
|
158 |
* |
|
159 |
* @param aForeground ETrue to switch to the foreground. EFalse to switch |
|
160 |
* from the foreground. |
|
161 |
* @note Event is sent to gauge items. |
|
162 |
*/ |
|
163 |
void HandleForegroundL(TBool aForeground); |
|
164 |
||
165 |
/** |
|
166 |
* @return pointer to CMIDPopupNoteController instance |
|
167 |
*/ |
|
168 |
CMIDPopupNoteController* GetPopupNoteController() const; |
|
169 |
||
170 |
CAknsFrameBackgroundControlContext* GetHighlightBackgroundCc() const; |
|
171 |
||
172 |
#ifdef RD_SCALABLE_UI_V2 |
|
173 |
/** |
|
174 |
* Checks if the StringItem which is split across several label container items contains a point |
|
175 |
* @param aStringItem a string item to look for |
|
176 |
* @param sPoint a point to check |
|
177 |
*/ |
|
178 |
TBool StringItemContainsPoint(CMIDStringItem* aStringItem, const TPoint& aPoint) const; |
|
179 |
||
180 |
/** |
|
181 |
* Checks if focus has changed between TPointerEvent::EButton1Down and TPointerEvent::EButton1Up events |
|
182 |
* @return ETrue if form has changed focus for a component with a pen event |
|
183 |
*/ |
|
184 |
TBool IsFocusChangingWithPen() const; |
|
185 |
||
186 |
/** |
|
187 |
* Returns true if the form was scrolled when pointer was pressed down, i.e. |
|
188 |
* pointer down occured on item that was partially visible on screen. |
|
189 |
* |
|
190 |
* @return ETrue, if the form was scrolled when pointer pressed down. |
|
191 |
*/ |
|
192 |
TBool IsScrolledOnPointerDown() const; |
|
193 |
||
194 |
public: // from MEikScrollBarObserver |
|
195 |
void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType); |
|
196 |
#endif //RD_SCALABLE_UI_V2 |
|
197 |
||
198 |
#ifdef RD_TACTILE_FEEDBACK |
|
199 |
private: |
|
200 |
MTouchFeedback* iFeedback; |
|
201 |
#endif |
|
202 |
||
203 |
private: |
|
204 |
CMIDForm(MMIDEnv& aEnv, CMIDDisplayable& aDisplayable); |
|
205 |
void ConstructL(); |
|
206 |
void UpdateMemberVariables(); |
|
207 |
private: // MMIDForm |
|
208 |
void SetAllItemsL(const RArray<MMIDItem*>& aItems); |
|
209 |
void SetItemL(MMIDItem& aItem,TInt aIndex); |
|
210 |
void InsertItemL(MMIDItem& aItem,TInt aIndex); |
|
211 |
void DeleteItemL(TInt aIndex); |
|
212 |
void DeleteAllItemsL(); |
|
213 |
||
214 |
TBool IsItemVisible(TInt aIndex); |
|
215 |
void SetCurrentItemL(TInt aIndex); |
|
216 |
||
217 |
private: // MMIDComponent |
|
218 |
inline void Dispose(); |
|
219 |
||
220 |
private: // MCoeControlObserver |
|
221 |
void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); |
|
222 |
||
223 |
private: // MTimeOutNotify |
|
224 |
void TimerExpired(); |
|
225 |
||
226 |
private: // From CCoeControl |
|
227 |
TInt CountComponentControls() const; |
|
228 |
CCoeControl* ComponentControl(TInt aIndex) const; |
|
229 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
|
230 |
void FocusChanged(TDrawNow aDrawNow); |
|
231 |
void HandleResourceChange(TInt aType); |
|
232 |
void SizeChanged(); |
|
233 |
TCoeInputCapabilities InputCapabilities() const; |
|
234 |
TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
235 |
#ifdef RD_SCALABLE_UI_V2 |
|
236 |
void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
237 |
#endif |
|
238 |
||
239 |
private: // implementation items |
|
240 |
||
241 |
#ifdef RD_SCALABLE_UI_V2 |
|
242 |
/** |
|
243 |
* Handles the pointer drag events in form. |
|
244 |
* |
|
245 |
* @param aPointerEvent The pointer event |
|
246 |
*/ |
|
247 |
void HandleDragEventL(const TPointerEvent& aPointerEvent, TBool aForItem); |
|
248 |
||
249 |
/** |
|
250 |
* Does the actual scrolling in timed scrolling cases (=EButtonRepeatEvent). |
|
251 |
* Calculates the number of pixels to scroll, scrolls the form and moves the focus to another |
|
252 |
* item if needed. |
|
253 |
* |
|
254 |
* @param aDirection The direction of the scroll, EUp or EDown |
|
255 |
*/ |
|
256 |
void TimedScroll(TDirection aDirection); |
|
257 |
||
258 |
/** |
|
259 |
* Checks if the form can be scrolled downwards. |
|
260 |
* |
|
261 |
* @return ETrue if the form can be scrolled downwards, EFalse otherwise |
|
262 |
*/ |
|
263 |
TBool CanScrollDown() const; |
|
264 |
||
265 |
/** |
|
266 |
* Checks if the form can be scrolled upwards. |
|
267 |
* |
|
268 |
* @return ETrue if the form can be scrolled upwards, EFalse otherwise |
|
269 |
*/ |
|
270 |
TBool CanScrollUp() const; |
|
271 |
||
272 |
/** |
|
273 |
* Checks if the currently focused item contains the point given as a |
|
274 |
* parameter. |
|
275 |
* |
|
276 |
* @param aPoint The point |
|
277 |
* @return ETrue if there is a focused item on the form currently and the focused |
|
278 |
* item contains aPoint, EFalse otherwise. |
|
279 |
*/ |
|
280 |
TBool FocusedItemContainsPoint(const TPoint& aPoint) const; |
|
281 |
||
282 |
/** |
|
283 |
* Returns a pointer to the control item that contains the point |
|
284 |
* given as a parameter. Returns NULL if there is no control item |
|
285 |
* at the given point. |
|
286 |
* |
|
287 |
* @param aPoint The point |
|
288 |
* @return A pointer to the control item or NULL |
|
289 |
*/ |
|
290 |
CMIDControlItem* ControlItemAtPoint(const TPoint& aPoint) const; |
|
291 |
||
292 |
/** |
|
293 |
* Returns the index of the row that contains the point given as a parameter. |
|
294 |
* KErrNotFound is returned if none of the rows contains the point. |
|
295 |
* |
|
296 |
* @param aPoint The point |
|
297 |
* @return Index of the row or KErrNotFound if no row is found |
|
298 |
*/ |
|
299 |
TInt RowAtPoint(const TPoint& aPoint) const; |
|
300 |
||
301 |
/** |
|
302 |
* Requests EButtonRepeat event from RWindow. Checks that aPointerEvent.iPosition |
|
303 |
* is out of the form area before the request is made. |
|
304 |
* |
|
305 |
* @param aPointerEvent The pointer event after which the repeat event is requested. |
|
306 |
*/ |
|
307 |
void RequestPointerRepeat(const TPointerEvent& aPointerEvent); |
|
308 |
#endif |
|
309 |
||
310 |
TBool TryMovingFocusHorizontally(TDirection aDirection); |
|
311 |
TBool TryMovingFocusVertically(TDirection aDirection, |
|
312 |
TBool aSelectClosest, TBool aScroll = ETrue); |
|
313 |
CMIDControlItem* SelectClosestFocussableItem(TInt aRowIndex) const; |
|
314 |
TInt IndexOfFirstFocusableItemOnScreen(TDirection aDirection); |
|
315 |
/** Scrolls to the focused item and finalizes the scroll. */ |
|
316 |
void ScrollToFocused(TDirection aDirection = EDown, TBool aReset = ETrue); |
|
317 |
/** |
|
318 |
* Returns how much need to be scrolled to get tapped item fully visible. |
|
319 |
* |
|
320 |
* @return amount of pixels to be scrolled. |
|
321 |
* @return 0, If Item is already fully visible or if either ends of the |
|
322 |
* item are not fully visible (middle part of the item is shown). |
|
323 |
*/ |
|
324 |
TInt ScrollDistanceToTappedItem(CMIDControlItem* aPointedControl); |
|
325 |
/** Scrolls to the specified rect. Does not finalize the scroll. */ |
|
326 |
void RawScrollToRect(const TRect& aRect, TDirection aDirection, TBool aReset = EFalse); |
|
327 |
/** Scrolls to the specified form row. Does not finalize the scroll. */ |
|
328 |
void RawScrollToRow(TInt aIdx, TDirection aDirection); |
|
329 |
/** Scrolls the amount specified by the parameter. Does not finalize the scroll. */ |
|
330 |
void RawScrollRelative(TInt aScroll); |
|
331 |
/** Finalizes any unfinalized raw scroll. Finalizing includes updating scrollbars and requesting drawing. */ |
|
332 |
void RawScrollFinalize(TBool forseAction, TBool aDraw = ETrue); |
|
333 |
||
334 |
TRect GetControlRect(TInt aIdx) const; |
|
335 |
TRect GetUnconstrainedStringItemRect(CMIDStringItem* aStringItem) const; |
|
336 |
||
337 |
TInt FirstRowWithBottomBelowScreen(); |
|
338 |
TInt LastRowWithTopAboveScreen(); |
|
339 |
TInt NextPartiallyVisibleRowWithFocusableItem(TDirection aDirection); |
|
340 |
TInt FirstRowOnScreen(TDirection aDirection); |
|
341 |
TInt NextFocusableHorizontalIdx(TDirection aDirection); |
|
342 |
void ReplaceFocusedItem(); |
|
343 |
void SetFocusedItem(TInt aFocusIdx, TDirection aDirection = ENone, TBool aDoScroll = ETrue); |
|
344 |
void UpdateScrollBar(); |
|
345 |
CMIDItem& Item(TInt aIndex) const; |
|
346 |
CMIDControlItem& ControlItem(TInt aIndex) const; |
|
347 |
static CMIDControlItem& ControlItem(MMIDItem* aMMidItem); |
|
348 |
TInt Index(CCoeControl* aControl) const; |
|
349 |
void HandleItemVisibilityChange(); |
|
350 |
// msk: this method should be obsolete, but it is needed if msk is not enabled |
|
351 |
TBool PostDefaultItemCommandEvent(TInt aIndex); |
|
352 |
void AddItemToFormL(CMIDControlItem& aControlItem); |
|
353 |
void RemoveItemFromForm(CMIDControlItem& aControlItem); |
|
354 |
||
355 |
// msk: this method should be obsolete, but it is needed if msk is not enabled |
|
356 |
TBool DoDefaultCommand(); |
|
357 |
TInt Row(const CMIDControlItem& aItem) const; |
|
358 |
TInt Row(const CMIDControlItem& aItem, CMIDFormRow*& aRowPtr) const; |
|
359 |
TDirection ConvertKeyToDirection(TUint aCode); |
|
360 |
TInt ItemIndex(CMIDControlItem& aItem); |
|
361 |
||
362 |
TInt FirstRowAboveUnconstrainedStringItem(CMIDStringItem& aStringItem) const; |
|
363 |
TInt FirstRowOfUnconstrainedStringItem(CMIDStringItem& aStringItem) const; |
|
364 |
TInt FirstRowBelowUnconstrainedStringItem(CMIDStringItem& aStringItem) const; |
|
365 |
TInt FirstFocusableItemBeforeStartOfUnconstrainedStringItemIdx(CMIDStringItem& aStringItem); |
|
366 |
TInt FirstFocusableItemOnLastLineOfUnconstrainedStringItemIdx(CMIDStringItem& aStringItem); |
|
367 |
||
368 |
TBool ControlBelongsToSameUnconstrainedItem(CMIDControlItem* aCi, |
|
369 |
CMIDStringItem& aStringItem) const; |
|
370 |
||
371 |
||
372 |
void ResetItemsPreferredSizes(); |
|
373 |
void SetItemsFormPointersToVal(CMIDForm* aVal); |
|
374 |
void SetRowExtentsWithRespectToScrolledLocation(); |
|
375 |
void SetRowPositionsWithRespectToScrolledLocation(); |
|
376 |
||
377 |
TBool ItemIsUnconstrained(TInt aIndex) const; |
|
378 |
TBool LayoutMatchesCurrentAlignment(CMIDControlItem& aControlItem, |
|
379 |
MMIDItem::TLayout aCurrentAlignment); |
|
380 |
TBool LayoutDefault(CMIDControlItem& aControlItem); |
|
381 |
TBool LayoutNewLineBefore(CMIDControlItem& aControlItem); |
|
382 |
TBool LayoutNewLineAfter(CMIDControlItem& aControlItem); |
|
383 |
||
384 |
public: |
|
385 |
static TBool LayoutShrink(CMIDControlItem& aControlItem); |
|
386 |
static TBool LayoutExpand(CMIDControlItem& aControlItem); |
|
387 |
static TBool LayoutVerticalShrink(CMIDControlItem& aControlItem); |
|
388 |
static TBool LayoutVerticalExpand(CMIDControlItem& aControlItem); |
|
389 |
static TBool LayoutVerticalCenter(CMIDControlItem& aControlItem); |
|
390 |
static TBool LayoutBottom(CMIDControlItem& aControlItem); |
|
391 |
static TBool IsStringItem(CMIDControlItem& aControlItem); |
|
392 |
static TBool IsStringItemHyperlink(CMIDControlItem& aControlItem); |
|
393 |
static TBool IsStringItemButton(CMIDControlItem& aControlItem); |
|
394 |
static TBool IsCustomItem(CMIDControlItem& aControlItem); |
|
395 |
static TBool IsGaugeItem(CMIDControlItem& aControlItem); |
|
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
71
diff
changeset
|
396 |
static TBool IsInteractiveGaugeItem(CMIDControlItem& aControlItem); |
66 | 397 |
static TBool IsTextFieldItem(CMIDControlItem& aControlItem); |
398 |
static TBool IsChoiceGroup(CMIDControlItem& aControlItem); |
|
399 |
static TBool IsDateField(CMIDControlItem& aControlItem); |
|
400 |
static TBool IsLabelContainerItem(CMIDControlItem& aControlItem); |
|
401 |
static TBool IsSpacerUsedForFormatting(CMIDControlItem& aControlItem); |
|
402 |
static TBool IsImageItem(CMIDControlItem& aControlItem); |
|
403 |
||
404 |
#ifdef RD_JAVA_S60_RELEASE_9_2 |
|
405 |
public: |
|
406 |
void PostPendingUpEventL(); |
|
407 |
#endif // RD_JAVA_S60_RELEASE_9_2 |
|
408 |
||
409 |
private: |
|
410 |
TInt NumNewLinesBefore(CMIDControlItem& aControlItem); |
|
411 |
TInt NumNewLinesAfter(CMIDControlItem& aControlItem); |
|
412 |
void SizeItemsInFormRowsL(); |
|
413 |
void DeleteRows(); |
|
414 |
||
415 |
TInt HeightOfAllItems(); |
|
416 |
void UpdateHeightOfAllItems(); |
|
417 |
||
418 |
void Draw(const TRect& aRect) const; |
|
419 |
||
420 |
void LayoutFormL(); |
|
421 |
TBool LayoutPending() const; |
|
422 |
void LayoutAndDrawL(); |
|
423 |
TInt TrappedLayoutAndDraw(TBool aOnlyIfPending = EFalse); |
|
424 |
/** |
|
425 |
* Draws the "No data" string in the middle of the form container. |
|
426 |
* This is drawn when the form has no items. |
|
427 |
* |
|
428 |
* @note The text is aligned horizontaly not considering the scroll bar width |
|
429 |
*/ |
|
430 |
void DrawNoDataStringL() const; |
|
431 |
||
432 |
private: //AssignItemsToRowsL() and its helpers |
|
433 |
void AssignItemsToRowsL(); |
|
434 |
||
435 |
TBool SkipNullItem(TInt aIndex); |
|
436 |
void CreateNewRowAndSetAsCurrentL(); |
|
437 |
void VerifyRowAlignmentL(TInt aIndex); |
|
438 |
void InsertNewlinesL(TInt aNumNewlines, CMIDControlItem* aControlItem); |
|
439 |
void CreateAndAddLabelContainerItemL(CMIDStringItem& aStringItem, CEikLabel& aLabel, |
|
440 |
TBool aIsStringItemContent); |
|
441 |
void InsertContainerItemsL(CMIDStringItem& aStringItem, CMIDItemLabel& aTextControl, |
|
442 |
TBool aIsStringItemContent); |
|
443 |
void AddUnconstrainedStringItemL(TInt& aIndex); |
|
444 |
void AddDefaultItemL(TInt& aIndex); |
|
445 |
TBool OkToMoveToNextRow(const TSize& aItemSize) const; |
|
446 |
||
447 |
public: |
|
448 |
/** |
|
449 |
* Updates Physics model |
|
450 |
*/ |
|
451 |
void UpdatePhysics(); |
|
452 |
private: |
|
453 |
/** |
|
454 |
* Specialized pointer event handling for physics. |
|
455 |
*/ |
|
456 |
void HandlePhysicsPointerEventL(const TPointerEvent& aPointerEvent); |
|
457 |
/** |
|
458 |
* Forwards pointer event to Items |
|
459 |
*/ |
|
460 |
void ForwardPointerEventToItemL(const TPointerEvent& aPointerEvent); |
|
461 |
/** |
|
462 |
* Handles highlight transisition. |
|
463 |
* Called by HighlightTimerCallBack function |
|
464 |
*/ |
|
465 |
void HandleHighlightTimer(); |
|
466 |
||
467 |
void SetHighlightBackgroundRects(); |
|
468 |
void UpdateHighlightBackgroundPosition(); |
|
469 |
public: |
|
470 |
||
471 |
static TInt HighlightTimerCallback(TAny* aPtr); |
|
472 |
||
473 |
/* |
|
474 |
* Scrolls the Form content according to physics model. |
|
475 |
* Called by FormPhysics. |
|
476 |
*/ |
|
477 |
void HandlePhysicsScroll(TInt aScroll, TBool aDrawNow, TUint aFlags); |
|
478 |
/* |
|
479 |
* Called by FormPhysics when physics emulation ends |
|
480 |
*/ |
|
481 |
void PhysicsScrollingEnd(); |
|
482 |
/* |
|
483 |
* Returns true if kinetic scrolling is enabled |
|
484 |
*/ |
|
485 |
TBool PhysicsEnabled(); |
|
486 |
/* |
|
487 |
* Returns true if kinetic scrolling (flick or panning) is ongoing. |
|
488 |
*/ |
|
489 |
TBool PhysicsScrolling(); |
|
490 |
/* |
|
491 |
* Returns the latest scroll delta |
|
492 |
*/ |
|
493 |
TInt ScrollDelta(); |
|
494 |
||
495 |
void SetPhysicsScrollingDisabled(TBool aDisabled); |
|
496 |
||
497 |
/** |
|
498 |
* Function does feedback when focus is changed. |
|
499 |
*/ |
|
500 |
void DoFeedbackOnFocusChange(CMIDControlItem& aControlItem); |
|
501 |
||
502 |
private: |
|
503 |
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
504 |
/** |
|
505 |
* Function for feedback on kinetic scrolling . |
|
506 |
*/ |
|
507 |
void UpdateTactileFeedbackDensity(); |
|
508 |
void DoScrollingFeedback(); |
|
509 |
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
510 |
||
511 |
private: //data |
|
512 |
CMIDDisplayable& iDisplayable; |
|
513 |
MMIDEnv* iEnv; |
|
514 |
CTimeOutTimer* iLayoutTimer; // we use this Timer do defer laying out in some situations (this is for performance reasons). |
|
515 |
TTime iLayoutRequestTime; |
|
516 |
RArray<MMIDItem*> iItems; |
|
517 |
TInt iScroll; // the scroll position (in pixels) |
|
518 |
TInt iFocused; // index of the item that has the focus (KErrNotFound if we are not focused) |
|
519 |
MMIDItem::TLayout iInitialAlignment; // ELeft for left to right layout, otherwise ERight |
|
520 |
RArray<CMIDFormRow*> iRows; |
|
521 |
TInt iInnerWidth; |
|
522 |
TInt iInnerHeight; |
|
523 |
TBool iHasScrolled; |
|
524 |
||
525 |
CEikScrollBarFrame* iSBFrame; |
|
526 |
||
527 |
CMIDFormRow* iCurrentRow; //only a reference |
|
528 |
MMIDItem::TLayout iCurrentAlignment; //The alignment of the current row |
|
529 |
||
530 |
HBufC* iNoDataText; /** Text to be displayed if form is empty */ |
|
531 |
||
532 |
/** The same skinned background used by AVKON forms and listboxes */ |
|
533 |
CAknsListBoxBackgroundControlContext* iBackgroundControlContext; |
|
534 |
||
535 |
/** The total height of the form, this is the sum of the rows height */ |
|
536 |
TInt iTotalFormHeight; |
|
537 |
||
538 |
TAknLayoutRect iMidpFormRect; // Layout of Rect of midp_form_pane (scroll bar included) |
|
539 |
TAknLayoutRect iFormRect; // Layout of Rect of form2_midp_field_pane (scroll bar excluded) |
|
540 |
TInt iFormHeight; // The height of the form |
|
541 |
||
542 |
CMIDPopupNoteController* iPopupController; |
|
543 |
#ifdef RD_SCALABLE_UI_V2 |
|
544 |
// Indicates if changing the focused item with pointer drag is currently possible. |
|
545 |
// EButton1Down must happen outside the focused item in order this to be possible. |
|
546 |
TBool iCanDragFocus; |
|
547 |
||
548 |
// true if focus has changed between TPointerEvent::EButton1Down and TPointerEvent::EButton1Up events |
|
549 |
TBool iFocusChangingWithPen; |
|
550 |
||
551 |
// True, if form has been scrolled between TPointerEvent::EButton1Down and TPointerEvent::EButton1Up events |
|
552 |
TBool iScrollOnPointerDown; |
|
553 |
||
554 |
TInt iLastFadeMessage; |
|
555 |
||
556 |
TInt iIndexPointedControl; // index of pointed Control |
|
557 |
TPointerEvent iLastValidPointerEvent; |
|
558 |
TPoint iLastValidPointedItemPosition; |
|
559 |
#endif |
|
560 |
||
561 |
// Needed by kinetic scrolling |
|
562 |
CMIDControlItem* iPointedControl; |
|
563 |
CMIDFormPhysics* iPhysics; |
|
564 |
TTime iStartTime; |
|
565 |
CPeriodic* iHighlightTimer; |
|
566 |
TPointerEvent iLastPointerDownEvent; |
|
567 |
TPoint iStartPosition; |
|
568 |
TPoint iLastDragPosition; |
|
569 |
TBool iFlickOngoing; |
|
570 |
TBool iPanningOngoing; |
|
571 |
TBool iUpEventSent; |
|
572 |
TInt iScrollDelta; |
|
573 |
TBool iPreventPhysicsScrolling; |
|
574 |
TBool iFlickStoppedOnDownEvent; |
|
575 |
TBool iFeedbackExecutedInPointerDown; |
|
576 |
||
577 |
// The background control context for when the item is highlighted |
|
578 |
CAknsFrameBackgroundControlContext* iHighlightedBackgroundCc; |
|
579 |
||
580 |
/** |
|
581 |
* The startup trace should be done only once. |
|
582 |
*/ |
|
583 |
mutable TBool iStartUpTraceDone; |
|
584 |
||
585 |
#ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
586 |
/** |
|
587 |
* Kinetic scrolling tactile feedback |
|
588 |
*/ |
|
589 |
TInt iLastTactileFeedbackPos; |
|
590 |
TInt iTactileFeedbackDensity; |
|
591 |
TInt iLastPointerEventType; |
|
592 |
#endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK |
|
71
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
593 |
|
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
594 |
// Storing index to last pointed control |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
595 |
// before Form layout is performed |
d5e927d5853b
Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
596 |
TInt iLastPointedControl; |
83
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
71
diff
changeset
|
597 |
|
26b2b12093af
Revision: v2.2.17
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
71
diff
changeset
|
598 |
TInt iLastGaugeValue; |
66 | 599 |
}; |
600 |
||
601 |
inline void CMIDForm::Dispose() |
|
602 |
{ |
|
603 |
delete this; |
|
604 |
} |
|
605 |
||
606 |
||
607 |
inline TRect CMIDForm::FormRect() |
|
608 |
{ |
|
609 |
return iFormRect.Rect(); |
|
610 |
} |
|
611 |
||
612 |
inline TInt CMIDForm::Width() |
|
613 |
{ |
|
614 |
return iInnerWidth; // form2_midp_field_pane.Width |
|
615 |
} |
|
616 |
||
617 |
inline TInt CMIDForm::Height() |
|
618 |
{ |
|
619 |
return iFormHeight; // midp_form_pane.Height |
|
620 |
} |
|
621 |
||
622 |
inline MMIDItem::TLayout CMIDForm::InitialAlignment() |
|
623 |
{ |
|
624 |
return iInitialAlignment; |
|
625 |
} |
|
626 |
||
627 |
inline CMIDDisplayable& CMIDForm::CurrentDisplayable() |
|
628 |
{ |
|
629 |
return iDisplayable; |
|
630 |
} |
|
631 |
||
632 |
inline CAknsFrameBackgroundControlContext* CMIDForm::GetHighlightBackgroundCc() const |
|
633 |
{ |
|
634 |
return iHighlightedBackgroundCc; |
|
635 |
} |
|
636 |
||
637 |
#ifdef RD_SCALABLE_UI_V2 |
|
638 |
inline TBool CMIDForm::IsScrolledOnPointerDown() const |
|
639 |
{ |
|
640 |
return iScrollOnPointerDown; |
|
641 |
} |
|
642 |
#endif //RD_SCALABLE_UI_V2 |
|
643 |
||
644 |
#endif // CMIDFORM_H |