Lomiri Action API
lomiri-menu-item.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_MENUITEM
18 #define LOMIRI_ACTION_MENUITEM
19 
20 namespace lomiri {
21 namespace action {
22  class MenuItem;
23  class Action;
24 }
25 }
26 
27 #include <QObject>
28 #include <QVariant>
29 #include <QScopedPointer>
30 
31 // Make private for now.
33 class Q_DECL_HIDDEN lomiri::action::MenuItem : public QObject
34 {
35  Q_OBJECT
36  Q_DISABLE_COPY(MenuItem)
37 
38  Q_PROPERTY(lomiri::action::Action *action
39  READ action
40  WRITE setAction
41  NOTIFY actionChanged)
42 
43  Q_PROPERTY(QString text
44  READ text
45  WRITE setText
46  NOTIFY textChanged)
47 
48  Q_PROPERTY(QString iconName
49  READ iconName
50  WRITE setIconName
51  NOTIFY iconNameChanged)
52 
53  Q_PROPERTY(QVariant target
54  READ target
55  WRITE setTarget
56  NOTIFY targetChanged)
57 
58  Q_PROPERTY(bool visible
59  READ visible
60  WRITE setVisible
61  NOTIFY visibleChanged)
62 
63  Q_PROPERTY(bool enabled
64  READ enabled
65  WRITE setEnabled
66  NOTIFY enabledChanged)
67 
68 public:
69 
70  explicit MenuItem(QObject *parent =0);
71  virtual ~MenuItem();
72 
73  Action *action() const;
74  void setAction(Action *value);
75 
76  QString text() const;
77  void setText(const QString &value);
78 
79  QString iconName() const;
80  void setIconName(const QString &value);
81 
82  QVariant target() const;
83  void setTarget(const QVariant &value);
84 
85  bool visible() const;
86  void setVisible(bool value);
87 
88  bool enabled() const;
89  void setEnabled(bool value);
90 
91 signals:
92  void actionChanged();
93  void textChanged(const QString &value);
94  void iconNameChanged(const QString &value);
95  void targetChanged(const QVariant &value);
96  void visibleChanged(bool value);
97  void enabledChanged(bool value);
98 
99 private:
100  class Private;
101  QScopedPointer<Private> d;
102 };
103 
104 #endif
lomiri::action::Action
The main action class.
Definition: lomiri-action.h:30