javauis/lcdui_akn/lcdui/inc/CMIDForm.h
branchRCL_3
changeset 66 2455ef1f5bbc
child 71 d5e927d5853b
equal deleted inserted replaced
65:ae942d28ec0e 66:2455ef1f5bbc
       
     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);
       
   396     static TBool IsTextFieldItem(CMIDControlItem& aControlItem);
       
   397     static TBool IsChoiceGroup(CMIDControlItem& aControlItem);
       
   398     static TBool IsPopupChoiceGroup(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     TInt FormRowIndex(CMIDFormRow* aRow);
       
   408     CMIDFormRow* FormRow(TInt aIndex);
       
   409 #endif // RD_JAVA_S60_RELEASE_9_2
       
   410 
       
   411 private:
       
   412     TInt NumNewLinesBefore(CMIDControlItem& aControlItem);
       
   413     TInt NumNewLinesAfter(CMIDControlItem& aControlItem);
       
   414     void SizeItemsInFormRowsL();
       
   415     void DeleteRows();
       
   416 
       
   417     TInt HeightOfAllItems();
       
   418     void UpdateHeightOfAllItems();
       
   419 
       
   420     void Draw(const TRect& aRect) const;
       
   421 
       
   422     void LayoutFormL();
       
   423     TBool LayoutPending() const;
       
   424     void  LayoutAndDrawL();
       
   425     TInt  TrappedLayoutAndDraw(TBool aOnlyIfPending = EFalse);
       
   426     /**
       
   427      * Draws the "No data" string in the middle of the form container.
       
   428      * This is drawn when the form has no items.
       
   429      *
       
   430      * @note The text is aligned horizontaly not considering the scroll bar width
       
   431      */
       
   432     void  DrawNoDataStringL() const;
       
   433 
       
   434 private: //AssignItemsToRowsL() and its helpers
       
   435     void AssignItemsToRowsL();
       
   436 
       
   437     TBool SkipNullItem(TInt aIndex);
       
   438     void CreateNewRowAndSetAsCurrentL();
       
   439     void VerifyRowAlignmentL(TInt aIndex);
       
   440     void InsertNewlinesL(TInt aNumNewlines, CMIDControlItem*  aControlItem);
       
   441     void CreateAndAddLabelContainerItemL(CMIDStringItem& aStringItem, CEikLabel& aLabel,
       
   442                                          TBool aIsStringItemContent);
       
   443     void InsertContainerItemsL(CMIDStringItem& aStringItem, CMIDItemLabel& aTextControl,
       
   444                                TBool aIsStringItemContent);
       
   445     void AddUnconstrainedStringItemL(TInt& aIndex);
       
   446     void AddDefaultItemL(TInt& aIndex);
       
   447     TBool OkToMoveToNextRow(const TSize& aItemSize) const;
       
   448 
       
   449 public:
       
   450     /**
       
   451      *  Updates Physics model
       
   452      */
       
   453     void UpdatePhysics();
       
   454 private:
       
   455     /**
       
   456      * Specialized pointer event handling for physics.
       
   457      */
       
   458     void HandlePhysicsPointerEventL(const TPointerEvent& aPointerEvent);
       
   459     /**
       
   460      * Forwards pointer event to Items
       
   461      */
       
   462     void ForwardPointerEventToItemL(const TPointerEvent& aPointerEvent);
       
   463     /**
       
   464      * Handles highlight transisition.
       
   465      * Called by HighlightTimerCallBack function
       
   466      */
       
   467     void HandleHighlightTimer();
       
   468 
       
   469     void SetHighlightBackgroundRects();
       
   470     void UpdateHighlightBackgroundPosition();
       
   471 public:
       
   472 
       
   473     static TInt HighlightTimerCallback(TAny* aPtr);
       
   474 
       
   475     /*
       
   476      * Scrolls the Form content according to physics model.
       
   477      * Called by FormPhysics.
       
   478      */
       
   479     void HandlePhysicsScroll(TInt aScroll, TBool aDrawNow, TUint aFlags);
       
   480     /*
       
   481      * Called by FormPhysics when physics emulation ends
       
   482      */
       
   483     void PhysicsScrollingEnd();
       
   484     /*
       
   485      * Returns true if kinetic scrolling is enabled
       
   486      */
       
   487     TBool PhysicsEnabled();
       
   488     /*
       
   489      * Returns true if kinetic scrolling (flick or panning) is ongoing.
       
   490      */
       
   491     TBool PhysicsScrolling();
       
   492     /*
       
   493      * Returns the latest scroll delta
       
   494      */
       
   495     TInt ScrollDelta();
       
   496 
       
   497     void SetPhysicsScrollingDisabled(TBool aDisabled);
       
   498 
       
   499     /**
       
   500      * Function does feedback when focus is changed.
       
   501      */
       
   502     void DoFeedbackOnFocusChange(CMIDControlItem& aControlItem);
       
   503 
       
   504 private:
       
   505 #ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
       
   506     /**
       
   507      * Function for feedback on kinetic scrolling .
       
   508      */
       
   509     void UpdateTactileFeedbackDensity();
       
   510     void DoScrollingFeedback();
       
   511 #endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
       
   512 
       
   513 private: //data
       
   514     CMIDDisplayable& iDisplayable;
       
   515     MMIDEnv* iEnv;
       
   516     CTimeOutTimer* iLayoutTimer; // we use this Timer do defer laying out in some situations (this is for performance reasons).
       
   517     TTime iLayoutRequestTime;
       
   518     RArray<MMIDItem*> iItems;
       
   519     TInt iScroll; // the scroll position (in pixels)
       
   520     TInt iFocused; // index of the item that has the focus (KErrNotFound if we are not focused)
       
   521     MMIDItem::TLayout iInitialAlignment; // ELeft for left to right layout, otherwise ERight
       
   522     RArray<CMIDFormRow*> iRows;
       
   523     TInt iInnerWidth;
       
   524     TInt iInnerHeight;
       
   525     TBool iHasScrolled;
       
   526 
       
   527     CEikScrollBarFrame* iSBFrame;
       
   528 
       
   529     CMIDFormRow* iCurrentRow; //only a reference
       
   530     MMIDItem::TLayout iCurrentAlignment; //The alignment of the current row
       
   531 
       
   532     HBufC* iNoDataText; /** Text to be displayed if form is empty */
       
   533 
       
   534     /** The same skinned background used by AVKON forms and listboxes */
       
   535     CAknsListBoxBackgroundControlContext* iBackgroundControlContext;
       
   536 
       
   537     /** The total height of the form, this is the sum of the rows height */
       
   538     TInt iTotalFormHeight;
       
   539 
       
   540     TAknLayoutRect iMidpFormRect; // Layout of Rect of midp_form_pane (scroll bar included)
       
   541     TAknLayoutRect iFormRect; // Layout of Rect of form2_midp_field_pane (scroll bar excluded)
       
   542     TInt iFormHeight; // The height of the form
       
   543 
       
   544     CMIDPopupNoteController* iPopupController;
       
   545 #ifdef RD_SCALABLE_UI_V2
       
   546     // Indicates if changing the focused item with pointer drag is currently possible.
       
   547     // EButton1Down must happen outside the focused item in order this to be possible.
       
   548     TBool iCanDragFocus;
       
   549 
       
   550     // true if focus has changed between TPointerEvent::EButton1Down and TPointerEvent::EButton1Up events
       
   551     TBool iFocusChangingWithPen;
       
   552 
       
   553     // True, if form has been scrolled between TPointerEvent::EButton1Down and TPointerEvent::EButton1Up events
       
   554     TBool iScrollOnPointerDown;
       
   555 
       
   556     TInt iLastFadeMessage;
       
   557 
       
   558     TInt iIndexPointedControl; // index of pointed Control
       
   559     TPointerEvent iLastValidPointerEvent;
       
   560     TPoint iLastValidPointedItemPosition;
       
   561 #endif
       
   562 
       
   563     // Needed by kinetic scrolling
       
   564     CMIDControlItem*    iPointedControl;
       
   565     CMIDFormPhysics*    iPhysics;
       
   566     TTime               iStartTime;
       
   567     CPeriodic*          iHighlightTimer;
       
   568     TPointerEvent       iLastPointerDownEvent;
       
   569     TPoint              iStartPosition;
       
   570     TPoint              iLastDragPosition;
       
   571     TBool               iFlickOngoing;
       
   572     TBool               iPanningOngoing;
       
   573     TBool               iUpEventSent;
       
   574     TInt                iScrollDelta;
       
   575     TBool               iPreventPhysicsScrolling;
       
   576     TBool               iFlickStoppedOnDownEvent;
       
   577     TBool               iFeedbackExecutedInPointerDown;
       
   578 
       
   579     // The background control context for when the item is highlighted
       
   580     CAknsFrameBackgroundControlContext* iHighlightedBackgroundCc;
       
   581 
       
   582     /**
       
   583      * The startup trace should be done only once.
       
   584      */
       
   585     mutable TBool iStartUpTraceDone;
       
   586 
       
   587 #ifdef RD_JAVA_ADVANCED_TACTILE_FEEDBACK
       
   588     /**
       
   589      * Kinetic scrolling tactile feedback
       
   590      */
       
   591     TInt iLastTactileFeedbackPos;
       
   592     TInt iTactileFeedbackDensity;
       
   593     TInt iLastPointerEventType;
       
   594 #endif //RD_JAVA_ADVANCED_TACTILE_FEEDBACK
       
   595 };
       
   596 
       
   597 inline void CMIDForm::Dispose()
       
   598 {
       
   599     delete this;
       
   600 }
       
   601 
       
   602 
       
   603 inline TRect CMIDForm::FormRect()
       
   604 {
       
   605     return iFormRect.Rect();
       
   606 }
       
   607 
       
   608 inline TInt CMIDForm::Width()
       
   609 {
       
   610     return iInnerWidth; // form2_midp_field_pane.Width
       
   611 }
       
   612 
       
   613 inline TInt CMIDForm::Height()
       
   614 {
       
   615     return iFormHeight; // midp_form_pane.Height
       
   616 }
       
   617 
       
   618 inline MMIDItem::TLayout CMIDForm::InitialAlignment()
       
   619 {
       
   620     return iInitialAlignment;
       
   621 }
       
   622 
       
   623 inline CMIDDisplayable& CMIDForm::CurrentDisplayable()
       
   624 {
       
   625     return iDisplayable;
       
   626 }
       
   627 
       
   628 inline CAknsFrameBackgroundControlContext* CMIDForm::GetHighlightBackgroundCc() const
       
   629 {
       
   630     return iHighlightedBackgroundCc;
       
   631 }
       
   632 
       
   633 #ifdef RD_SCALABLE_UI_V2
       
   634 inline TBool CMIDForm::IsScrolledOnPointerDown() const
       
   635 {
       
   636     return iScrollOnPointerDown;
       
   637 }
       
   638 #endif //RD_SCALABLE_UI_V2
       
   639 
       
   640 #endif // CMIDFORM_H