]> git.lyx.org Git - features.git/blob - src/frontends/qt/IconPalette.h
Show suggestions containing the input in the command buffer
[features.git] / src / frontends / qt / IconPalette.h
1 // -*- C++ -*-
2 /**
3  * \file IconPalette.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Edwin Leuven
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef ICONPALETTE_H
13 #define ICONPALETTE_H
14
15 #include <QWidget>
16 #include <QMenu>
17
18 class QGridLayout;
19
20 namespace lyx {
21 namespace frontend {
22
23 /**
24   * tear-off widget
25   */
26 class TearOff : public QWidget {
27         Q_OBJECT
28 public:
29         TearOff(QWidget * parent);
30 #if QT_VERSION < 0x060000
31         void enterEvent(QEvent *) override;
32 #else
33         void enterEvent(QEnterEvent *) override;
34 #endif
35         void leaveEvent(QEvent *) override;
36         void mouseReleaseEvent (QMouseEvent *) override;
37 Q_SIGNALS:
38         void tearOff();
39 protected:
40         void paintEvent(QPaintEvent *) override;
41 private:
42         bool highlighted_;
43 };
44
45
46 /**
47  * For holding an arbitrary set of icons.
48  */
49 class IconPalette : public QWidget {
50         Q_OBJECT
51 public:
52         IconPalette(QWidget * parent);
53         void addButton(QAction *);
54
55 Q_SIGNALS:
56         void triggered(QAction *);
57         void visible(bool);
58
59 protected:
60         void showEvent(QShowEvent * event) override;
61         void hideEvent(QHideEvent * event) override;
62         void paintEvent(QPaintEvent * event) override;
63
64 private Q_SLOTS:
65         void tearOff();
66         virtual void clicked(QAction *);
67
68 private:
69         QGridLayout * layout_;
70         QList<QAction *> actions_;
71         bool tornoff_;
72         TearOff * tearoffwidget_;
73 };
74
75
76 /**
77  * Popup menu for a toolbutton.
78  * We need this to keep track whether
79  * it is necessary to enable/disable
80  * the toolbutton
81  */
82 class ButtonMenu : public QMenu {
83         Q_OBJECT
84 public:
85         ButtonMenu(const QString & title, QWidget * parent);
86         void add(QAction *);
87
88 public Q_SLOTS:
89         void updateParent();
90
91 private:
92         QList<QAction *> actions_;
93 };
94
95
96 } // namespace frontend
97 } // namespace lyx
98
99 #endif // ICONPALETTE_H