src/hbwidgets/itemviews/hbabstractviewitem.h
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    28 #include <hbwidget.h>
    28 #include <hbwidget.h>
    29 #include <hbglobal.h>
    29 #include <hbglobal.h>
    30 #include <hbnamespace.h>
    30 #include <hbnamespace.h>
    31 #include <hbeffect.h>
    31 #include <hbeffect.h>
    32 
    32 
       
    33 #include <QHash>
       
    34 
    33 QT_BEGIN_NAMESPACE
    35 QT_BEGIN_NAMESPACE
    34 class QModelIndex;
    36 class QModelIndex;
    35 QT_END_NAMESPACE
    37 QT_END_NAMESPACE
    36 
    38 
    37 class HbAbstractViewItemPrivate;
    39 class HbAbstractViewItemPrivate;
    43 class HB_WIDGETS_EXPORT HbAbstractViewItem : public HbWidget
    45 class HB_WIDGETS_EXPORT HbAbstractViewItem : public HbWidget
    44 {
    46 {
    45     Q_OBJECT
    47     Q_OBJECT
    46 
    48 
    47     Q_PROPERTY(Hb::ModelItemType modelItemType READ modelItemType)
    49     Q_PROPERTY(Hb::ModelItemType modelItemType READ modelItemType)
       
    50     Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState)
    48 
    51 
    49 public:
    52 public:
       
    53 
       
    54     enum SelectionAreaType
       
    55     {
       
    56         SingleSelection,
       
    57         MultiSelection,
       
    58         ContiguousSelection
       
    59     };
    50 
    60 
    51     enum StateKey
    61     enum StateKey
    52     { 
    62     { 
    53         FocusKey,
    63         FocusKey,
    54         CheckStateKey,
    64         CheckStateKey,
    75     
    85     
    76     bool isFocused() const;
    86     bool isFocused() const;
    77     virtual void receivedFocus();
    87     virtual void receivedFocus();
    78     virtual void lostFocus();
    88     virtual void lostFocus();
    79 
    89 
       
    90     virtual QHash<QString, QVariant> transientState() const;
       
    91     virtual void setTransientState(const QHash<QString, QVariant> &state);
       
    92 
    80     virtual QMap<int,QVariant> state() const;
    93     virtual QMap<int,QVariant> state() const;
    81     virtual void setState(const QMap<int,QVariant> &state);
    94     virtual void setState(const QMap<int,QVariant> &state);
    82     virtual bool selectionAreaContains(const QPointF &scenePosition) const;
    95     virtual bool selectionAreaContains(const QPointF &position, SelectionAreaType selectionAreaType) const;
    83 
    96 
    84     virtual QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
    97     virtual QGraphicsItem *primitive(HbStyle::Primitive primitive) const;
    85 
    98 
    86     void setCheckState(Qt::CheckState state);
    99     void setCheckState(Qt::CheckState state);
    87     Qt::CheckState checkState() const;
   100     Qt::CheckState checkState() const;
    95     Hb::ModelItemType modelItemType() const;
   108     Hb::ModelItemType modelItemType() const;
    96 
   109 
    97 public slots:
   110 public slots:
    98     void updatePrimitives();
   111     void updatePrimitives();
    99 
   112 
       
   113 signals:
       
   114     void pressed(const QPointF &position);
       
   115     void released(const QPointF &position);
       
   116     void activated(const QPointF &position);
       
   117     void longPressed(const QPointF &position);
       
   118 
   100 protected:
   119 protected:
   101 
   120 
   102     HbAbstractViewItem(const HbAbstractViewItem &source);
   121     HbAbstractViewItem(const HbAbstractViewItem &source);
   103     HbAbstractViewItem &operator=(const HbAbstractViewItem &source);
   122     HbAbstractViewItem &operator=(const HbAbstractViewItem &source);
   104 
   123 
   105     HbAbstractViewItem( HbAbstractViewItemPrivate &dd, QGraphicsItem *parent );
   124     HbAbstractViewItem( HbAbstractViewItemPrivate &dd, QGraphicsItem *parent );
   106     void initStyleOption(HbStyleOptionAbstractViewItem *option) const;
   125     void initStyleOption(HbStyleOptionAbstractViewItem *option) const;
   107     virtual void polish(HbStyleParameters& params);
   126     virtual void polish(HbStyleParameters& params);
   108 
   127 
       
   128     virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
   109     virtual bool event(QEvent *e);
   129     virtual bool event(QEvent *e);
   110 
   130 
   111     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
   131     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
   112     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
   132     virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
   113     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
   133     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
   114 
   134 
   115     virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
   135     virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
   116 
   136 
   117     virtual void pressStateChanged(bool value, bool animate);
   137     virtual void pressStateChanged(bool value, bool animate);
   118 
   138 
       
   139     virtual void gestureEvent(QGestureEvent *event);
       
   140 
   119 private:
   141 private:
   120     Q_DECLARE_PRIVATE_D( d_ptr, HbAbstractViewItem )
   142     Q_DECLARE_PRIVATE_D( d_ptr, HbAbstractViewItem )
   121     Q_PRIVATE_SLOT(d_func(), void _q_animationFinished(const HbEffect::EffectStatus &status))
   143     Q_PRIVATE_SLOT(d_func(), void _q_animationFinished(const HbEffect::EffectStatus &status))
   122 };
   144 };
   123 
   145