]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/Action.h
Fix trailing whitespace in cpp files.
[lyx.git] / src / frontends / qt4 / Action.h
1 // -*- C++ -*-
2 /**
3  * \file Action.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef ACTION_H
13 #define ACTION_H
14
15 #include <QAction>
16 #include <memory>
17
18 class QIcon;
19
20 namespace lyx {
21
22 class FuncRequest;
23
24 namespace frontend {
25
26 /**
27  * Action - Qt interface with LyX' FuncRequest.
28  *
29  * Action can be used in LyX menubar and/or toolbars.
30  */
31 class Action : public QAction
32 {
33         Q_OBJECT
34
35 public:
36         // Makes a copy of func
37         Action(FuncRequest func, QIcon const & icon, QString const & text,
38                QString const & tooltip, QObject * parent);
39
40         // Takes shared ownership of func.
41         // Use for perf-sensitive code such as populating menus.
42         Action(std::shared_ptr<FuncRequest const> func,
43                QIcon const & icon, QString const & text,
44                QString const & tooltip, QObject * parent);
45
46         void update();
47
48 Q_SIGNALS:
49         /// the current action is triggered
50         void triggered(QAction *);
51
52 private Q_SLOTS:
53         void action();
54
55 private:
56         void init(QIcon const & icon, QString const & text, QString const & tooltip);
57         std::shared_ptr<FuncRequest const> func_;
58 };
59
60
61 } // namespace frontend
62 } // namespace lyx
63
64 #endif // ACTION_H