~zsombi/ubuntu-ui-toolkit/32-listitemactions-attached

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/plugin/uclistitemactions.h

  • Committer: Zsombor Egri
  • Date: 2014-11-06 08:40:31 UTC
  • Revision ID: zsombor.egri@canonical.com-20141106084031-jxrgrneuqrdfen45
ListItemActions attached properties added

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
class QQmlComponent;
24
24
class UCAction;
 
25
class UCListItemActionsAttached;
25
26
class UCListItemActionsPrivate;
26
27
class UCListItemActions : public QObject
27
28
{
30
31
    Q_PROPERTY(QQmlListProperty<UCAction> actions READ actions CONSTANT)
31
32
    Q_PROPERTY(QQmlListProperty<QObject> data READ data)
32
33
    Q_CLASSINFO("DefaultProperty", "data")
 
34
    Q_ENUMS(Status)
33
35
public:
 
36
    enum Status {
 
37
        Disconnected,
 
38
        Leading,
 
39
        Trailing
 
40
    };
34
41
    explicit UCListItemActions(QObject *parent = 0);
35
42
    ~UCListItemActions();
36
43
 
 
44
    static UCListItemActionsAttached *qmlAttachedProperties(QObject *owner);
 
45
 
37
46
    QQmlComponent *delegate() const;
38
47
    void setDelegate(QQmlComponent *delegate);
39
48
    QQmlListProperty<UCAction> actions();
46
55
    Q_DECLARE_PRIVATE(UCListItemActions)
47
56
};
48
57
 
 
58
class UCListItemActionsAttached : public QObject
 
59
{
 
60
    Q_OBJECT
 
61
    Q_PROPERTY(UCListItemActions *container READ container NOTIFY containerChanged)
 
62
    Q_PROPERTY(UCListItem *listItem READ listItem NOTIFY listItemChanged)
 
63
    Q_PROPERTY(int listItemIndex READ listItemIndex NOTIFY listItemIndexChanged)
 
64
    Q_PROPERTY(qreal offset READ offset NOTIFY offsetChanged)
 
65
    Q_PROPERTY(UCListItemActions::Status status READ status NOTIFY statusChanged)
 
66
    Q_PROPERTY(bool dragging READ dragging NOTIFY draggingChanged)
 
67
    Q_PROPERTY(qreal overshoot READ overshoot NOTIFY overshootChanged)
 
68
public:
 
69
    UCListItemActionsAttached(QObject *parent = 0);
 
70
    ~UCListItemActionsAttached();
 
71
    void setList(UCListItemActions *list);
 
72
 
 
73
    UCListItemActions *container() const
 
74
    {
 
75
        return m_container.data();
 
76
    }
 
77
    UCListItem *listItem();
 
78
    int listItemIndex();
 
79
    bool dragging();
 
80
    qreal offset();
 
81
    UCListItemActions::Status status();
 
82
    qreal overshoot();
 
83
 
 
84
 
 
85
public Q_SLOTS:
 
86
    void snapToPosition(qreal position);
 
87
 
 
88
Q_SIGNALS:
 
89
    void containerChanged();
 
90
    void listItemChanged();
 
91
    void listItemIndexChanged();
 
92
    void offsetChanged();
 
93
    void statusChanged();
 
94
    void draggingChanged();
 
95
    void overshootChanged();
 
96
 
 
97
private:
 
98
    QPointer<UCListItemActions> m_container;
 
99
    friend class UCListItemAction;
 
100
};
 
101
 
 
102
QML_DECLARE_TYPEINFO(UCListItemActions, QML_HAS_ATTACHED_PROPERTIES)
 
103
 
49
104
#endif // UCLISTITEMACTIONS_H