synthclone  0.3.0
menuaction.h
Go to the documentation of this file.
1 /*
2  * libsynthclone - a plugin API for `synthclone`
3  * Copyright (C) 2011 Devin Anderson
4  *
5  * This library is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by the
7  * Free Software Foundation; either version 2.1 of the License, or (at your
8  * option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __SYNTHCLONE_MENUACTION_H__
21 #define __SYNTHCLONE_MENUACTION_H__
22 
23 #include <QtCore/QString>
24 
25 #include <synthclone/menuitem.h>
26 
27 namespace synthclone {
28 
33  class MenuAction: public MenuItem {
34 
35  Q_OBJECT
36 
37  public:
38 
46  explicit
47  MenuAction(QObject *parent=0);
48 
59  explicit
60  MenuAction(const QString &text, QObject *parent=0);
61 
75  MenuAction(const QString &text, const QString &description,
76  QObject *parent=0);
77 
82  ~MenuAction();
83 
91  QString
92  getDescription() const;
93 
101  QString
102  getText() const;
103 
112  bool
113  isEnabled() const;
114 
115  public slots:
116 
124  void
125  setDescription(const QString &description);
126 
135  void
136  setEnabled(bool enabled);
137 
145  void
146  setText(const QString &text);
147 
153  void
154  trigger();
155 
156  signals:
157 
165  void
166  descriptionChanged(const QString &description);
167 
175  void
176  enabledChanged(bool enabled);
177 
185  void
186  textChanged(const QString &text);
187 
192  void
193  triggered();
194 
195  private:
196 
197  void
198  initialize(const QString &text, const QString &description);
199 
200  QString description;
201  bool enabled;
202  QString text;
203 
204  };
205 
206 }
207 
208 #endif
void setText(const QString &text)
Sets the action text.
void setEnabled(bool enabled)
Sets a boolean indicating whether or not this action is able to be triggered.
void triggered()
Emitted when this action is triggered.
QString getDescription() const
Gets the action description.
Base class that contains common functionality used by MenuAction and MenuSeparator objects...
Definition: menuitem.h:32
Definition: component.h:26
void setDescription(const QString &description)
Sets the description.
bool isEnabled() const
Gets a boolean indicating whether or not this action is able to be triggered.
MenuAction(QObject *parent=0)
Constructs an new MenuAction object.
void textChanged(const QString &text)
Emitted when the action text is changed.
MenuAction objects are triggerable choices in a menu.
Definition: menuaction.h:33
void trigger()
Triggers the action.
void descriptionChanged(const QString &description)
Emitted when the description is changed.
void enabledChanged(bool enabled)
Emitted when the 'enabled' flag is changed.
~MenuAction()
Destroys the MenuAction object.
QString getText() const
Gets the action text.