src/hbwidgets/itemviews/hbabstractviewitem_p.h
branchGCC_SURGE
changeset 15 f378acbc9cfb
parent 7 923ff622b8b9
child 21 4633027730f5
child 34 ed14f46c0e55
equal deleted inserted replaced
9:730c025d4b77 15:f378acbc9cfb
    30 #include <hbwidget_p.h>
    30 #include <hbwidget_p.h>
    31 #include <hbeffect.h>
    31 #include <hbeffect.h>
    32 #include <hbframebackground.h>
    32 #include <hbframebackground.h>
    33 #include <hbnamespace.h>
    33 #include <hbnamespace.h>
    34 
    34 
       
    35 #include <QObject>
    35 #include <QPersistentModelIndex>
    36 #include <QPersistentModelIndex>
    36 #include <QPointer>
    37 #include <QPointer>
    37 #include <QExplicitlySharedDataPointer>
    38 #include <QExplicitlySharedDataPointer>
    38 #include <QSharedData>
    39 #include <QSharedData>
    39 
    40 
    40 class HbAbstractItemView;
    41 class HbAbstractItemView;
    41 class QGraphicsItem;
    42 class QGraphicsItem;
    42 
    43 class QTimer;
    43 class QGestureEvent;
    44 class QGestureEvent;
    44 
    45 
    45 #define HB_SD(Class) Class##Shared * sd = (Class##Shared *)(d->mSharedData.data())
    46 #define HB_SD(Class) Class##Shared * sd = (Class##Shared *)(d->mSharedData.data())
    46 #define HB_SDD(Class) Q_D(Class); Class##Shared * sd = (Class##Shared *)(d->mSharedData.data())
    47 #define HB_SDD(Class) Q_D(Class); Class##Shared * sd = (Class##Shared *)(d->mSharedData.data())
    47 
    48 
    48 class HbAbstractViewItemShared : public QSharedData
    49 class HbAbstractViewItemShared : public QObject, public QSharedData
    49 {
    50 {
       
    51     Q_OBJECT
       
    52 
    50     public:
    53     public:
    51 
    54 
    52         HbAbstractViewItemShared() :
    55         HbAbstractViewItemShared() :
    53           mPrototype(0),
    56           mPrototype(0),
    54           mItemView(0),
    57           mItemView(0),
    55           mDefaultFrame(),
    58           mDefaultFrame(),
    56           mItemType("viewitem")
    59           mItemType("viewitem"),
    57         {
    60           mPressStateChangeTimer(0),
    58         }
    61           mPressedItem(0)
       
    62         {
       
    63         }
       
    64 
       
    65     public slots:
       
    66 
       
    67         void pressStateChangeTimerTriggered();
       
    68 
       
    69     public:
    59 
    70 
    60         HbAbstractViewItem *mPrototype;
    71         HbAbstractViewItem *mPrototype;
    61         HbAbstractItemView *mItemView;
    72         HbAbstractItemView *mItemView;
    62 
    73 
    63         QList<HbAbstractViewItem *> mCloneItems;
    74         QList<HbAbstractViewItem *> mCloneItems;
    64         HbFrameBackground mDefaultFrame;
    75         HbFrameBackground mDefaultFrame;
    65 
    76 
    66         QString mItemType;
    77         QString mItemType;
    67         static const int ViewItemDeferredDeleteEvent;
    78         static const int ViewItemDeferredDeleteEvent;
       
    79 
       
    80         QTimer *mPressStateChangeTimer;
       
    81         HbAbstractViewItem *mPressedItem;
       
    82         bool mAnimatePress;
    68 };
    83 };
    69 
    84 
    70 class HbAbstractViewItemPrivate : public HbWidgetPrivate
    85 class HbAbstractViewItemPrivate : public HbWidgetPrivate
    71 {
    86 {
    72     Q_DECLARE_PUBLIC( HbAbstractViewItem )
    87     Q_DECLARE_PUBLIC( HbAbstractViewItem )
    73 
    88 
    74     public:
    89     public:
    75 
    90 
    76         HbAbstractViewItemPrivate(HbAbstractViewItem *prototype, HbAbstractViewItemShared *shared = 0) :
    91         explicit HbAbstractViewItemPrivate(HbAbstractViewItem *prototype, HbAbstractViewItemShared *shared = 0) :
    77           HbWidgetPrivate(),
    92           HbWidgetPrivate(),
    78           mFocused(false),
    93           mFocused(false),
    79           mBackgroundItem(0),
    94           mBackgroundItem(0),
    80           mFrame(0),
    95           mFrame(0),
    81           mCheckState(Qt::Unchecked),
    96           mCheckState(Qt::Unchecked),
    82           mSelectionItem(0),
    97           mSelectionItem(0),
    83           mModelItemType(Hb::StandardItem),
    98           mModelItemType(Hb::StandardItem),
    84           mRepolishRequested(false),
    99           mRepolishRequested(false),
    85           mContentChangedSupported(false),
   100           mContentChangedSupported(false),
    86           mItemsChanged(false),
   101           mItemsChanged(false),
    87           mSizeHintPolish(false),
       
    88           mPressed(false),
   102           mPressed(false),
    89           mFocusItem(0),
   103           mFocusItem(0),
    90           mMultiSelectionTouchArea(0),                    
   104           mMultiSelectionTouchArea(0),                    
    91           mSharedData(shared)
   105           mSharedData(shared)
    92         {
   106         {
   106             mSelectionItem(0),
   120             mSelectionItem(0),
   107             mModelItemType(source.mModelItemType),
   121             mModelItemType(source.mModelItemType),
   108             mRepolishRequested(false),
   122             mRepolishRequested(false),
   109             mContentChangedSupported(source.mContentChangedSupported),
   123             mContentChangedSupported(source.mContentChangedSupported),
   110             mItemsChanged(false),
   124             mItemsChanged(false),
   111             mSizeHintPolish(false),
       
   112             mPressed(false),
   125             mPressed(false),
   113             mFocusItem(0),
   126             mFocusItem(0),
   114             mMultiSelectionTouchArea(0),
   127             mMultiSelectionTouchArea(0),
   115             mSharedData(source.mSharedData)
   128             mSharedData(source.mSharedData)
   116         {
   129         {
   127             mModelItemType = source.mModelItemType;
   140             mModelItemType = source.mModelItemType;
   128             mSelectionItem = 0;
   141             mSelectionItem = 0;
   129             mRepolishRequested = false;
   142             mRepolishRequested = false;
   130             mContentChangedSupported = source.mContentChangedSupported;
   143             mContentChangedSupported = source.mContentChangedSupported;
   131             mItemsChanged = false;
   144             mItemsChanged = false;
   132             mSizeHintPolish = false;
       
   133             mPressed = false;
   145             mPressed = false;
   134             mFocusItem = 0;
   146             mFocusItem = 0;
   135             mSharedData = source.mSharedData;
   147             mSharedData = source.mSharedData;
   136             mMultiSelectionTouchArea = 0;
   148             mMultiSelectionTouchArea = 0;
   137 
   149 
   179 
   191 
   180         // whether mContentChanged flag is supported
   192         // whether mContentChanged flag is supported
   181         bool mContentChangedSupported;
   193         bool mContentChangedSupported;
   182         // Status of child item existence changed.
   194         // Status of child item existence changed.
   183         bool mItemsChanged;
   195         bool mItemsChanged;
   184         mutable bool mSizeHintPolish;
       
   185         bool mPressed;
   196         bool mPressed;
   186 
   197 
   187         QGraphicsItem *mFocusItem;
   198         QGraphicsItem *mFocusItem;
   188 
   199 
   189         QGraphicsItem *mMultiSelectionTouchArea;
   200         QGraphicsItem *mMultiSelectionTouchArea;