Lomiri Action API
lomiri-action-context.h
1/* This file is part of lomiri-action-api
2 * Copyright 2013 Canonical Ltd.
3 *
4 * lomiri-action-api is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * lomiri-action-api is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the 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 LOMIRI_ACTION_CONTEXT
18#define LOMIRI_ACTION_CONTEXT
19
20namespace lomiri {
21namespace action {
22 class ActionContext;
23 class Action;
24}
25}
26
27#include <QObject>
28#include <QScopedPointer>
29#include <QSet>
30
31class Q_DECL_EXPORT lomiri::action::ActionContext : public QObject
32{
33 Q_OBJECT
34 Q_DISABLE_COPY(ActionContext)
35
36 Q_PROPERTY(bool active
37 READ active
38 WRITE setActive
39 NOTIFY activeChanged)
40
41public:
42
43 explicit ActionContext(QObject *parent = 0);
44 virtual ~ActionContext();
45
46 Q_INVOKABLE void addAction(lomiri::action::Action *action);
47 Q_INVOKABLE void removeAction(lomiri::action::Action *action);
48
49 bool active() const;
50 void setActive(bool value);
51
52 QSet<Action *> actions() const;
53
54signals:
55 void activeChanged(bool value);
57
58private:
59 class Private;
60 QScopedPointer<Private> d;
61};
62#endif
Definition: lomiri-action-context.h:32
Q_INVOKABLE void addAction(lomiri::action::Action *action)
Definition: lomiri-action-context.cpp:136
ActionContext(QObject *parent=0)
Definition: lomiri-action-context.cpp:109
Q_INVOKABLE void removeAction(lomiri::action::Action *action)
Definition: lomiri-action-context.cpp:160
QSet< Action * > actions() const
Definition: lomiri-action-context.cpp:191
bool active
Definition: lomiri-action-context.h:39
The main action class.
Definition: lomiri-action.h:31