]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/IconPalette.h
cosmetics
[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 public Q_SLOTS:
52         void updateParent();
53
54 Q_SIGNALS:
55         void triggered(QAction *);
56         void visible(bool);
57
58 protected:
59         void showEvent(QShowEvent * event);
60         void hideEvent(QHideEvent * event);
61         void paintEvent(QPaintEvent * event);
62
63 private Q_SLOTS:
64         void tearOff();
65         virtual void clicked(QAction *);
66
67 private:
68         QGridLayout * layout_;
69         QList<QAction *> actions_;
70         bool tornoff_;
71         TearOff * tearoffwidget_; 
72 };
73
74
75 /**
76  * Popup menu for a toolbutton.
77  * We need this to keep track whether
78  * it is necessary to enable/disable
79  * the toolbutton
80  */
81 class ButtonMenu : public QMenu {
82         Q_OBJECT
83 public:
84         ButtonMenu(const QString & title, QWidget * parent);
85         void add(QAction *);
86
87 public Q_SLOTS:
88         void updateParent();
89
90 private:
91         QList<QAction *> actions_;
92 };
93
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // ICONPALETTE_H