]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/IconPalette.h
Make the InsetInfo dialog a bit less esoteric.
[lyx.git] / src / frontends / qt4 / 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         void enterEvent(QEvent *);
31         void leaveEvent(QEvent *);
32         void mouseReleaseEvent (QMouseEvent *);
33 Q_SIGNALS:
34         void tearOff();
35 protected:
36         void paintEvent(QPaintEvent *);
37 private:
38         bool highlighted_;
39 };
40
41
42 /**
43  * For holding an arbitrary set of icons.
44  */
45 class IconPalette : public QWidget {
46         Q_OBJECT
47 public:
48         IconPalette(QWidget * parent);
49         void addButton(QAction *);
50
51 Q_SIGNALS:
52         void triggered(QAction *);
53         void visible(bool);
54
55 protected:
56         void showEvent(QShowEvent * event);
57         void hideEvent(QHideEvent * event);
58         void paintEvent(QPaintEvent * event);
59
60 private Q_SLOTS:
61         void tearOff();
62         virtual void clicked(QAction *);
63
64 private:
65         QGridLayout * layout_;
66         QList<QAction *> actions_;
67         bool tornoff_;
68         TearOff * tearoffwidget_;
69 };
70
71
72 /**
73  * Popup menu for a toolbutton.
74  * We need this to keep track whether
75  * it is necessary to enable/disable
76  * the toolbutton
77  */
78 class ButtonMenu : public QMenu {
79         Q_OBJECT
80 public:
81         ButtonMenu(const QString & title, QWidget * parent);
82         void add(QAction *);
83
84 public Q_SLOTS:
85         void updateParent();
86
87 private:
88         QList<QAction *> actions_;
89 };
90
91
92 } // namespace frontend
93 } // namespace lyx
94
95 #endif // ICONPALETTE_H