~faenil/ubuntu-ui-toolkit/scrollbar_moreHoverFixesAndTests

« back to all changes in this revision

Viewing changes to src/Ubuntu/UbuntuToolkit/actionlist_p.h

  • Committer: Andrea Bernabei
  • Date: 2016-08-26 20:55:00 UTC
  • mfrom: (1903.1.180 staging)
  • Revision ID: andrea.bernabei@canonical.com-20160826205500-gkskpm0ovooji0c5
merge staging

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
#ifndef ACTIONLIST_H
 
18
#define ACTIONLIST_H
 
19
 
 
20
#include <QObject>
 
21
#include <QtQml/QQmlListProperty>
 
22
#include "ubuntutoolkitglobal.h"
 
23
 
 
24
UT_NAMESPACE_BEGIN
 
25
 
 
26
class UCAction;
 
27
class UBUNTUTOOLKIT_EXPORT ActionList : public QObject
 
28
{
 
29
    Q_OBJECT
 
30
    Q_PROPERTY(QQmlListProperty<UT_PREPEND_NAMESPACE(UCAction)> actions READ actions)
 
31
    Q_CLASSINFO("DefaultProperty", "actions")
 
32
public:
 
33
    explicit ActionList(QObject *parent = 0);
 
34
 
 
35
    QQmlListProperty<UCAction> actions();
 
36
 
 
37
    const QList<UCAction*> &list() const;
 
38
 
 
39
public Q_SLOTS:
 
40
    void addAction(UT_PREPEND_NAMESPACE(UCAction) *action);
 
41
    void removeAction(UT_PREPEND_NAMESPACE(UCAction) *action);
 
42
 
 
43
Q_SIGNALS:
 
44
    void added(UCAction *action);
 
45
    void removed(UCAction *action);
 
46
 
 
47
protected:
 
48
    QList<UCAction*> m_actions;
 
49
 
 
50
    static void append(QQmlListProperty<UCAction> *list, UCAction *action);
 
51
    static void clear(QQmlListProperty<UCAction> *list);
 
52
    static UCAction* at(QQmlListProperty<UCAction> *list, int index);
 
53
    static int count(QQmlListProperty<UCAction> *list);
 
54
};
 
55
 
 
56
UT_NAMESPACE_END
 
57
 
 
58
#endif // ACTIONLIST_H