]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/iconpalette.h
* qt_helpers.h:
[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 John Levon
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 <QLayout>
17 #include <QRect>
18 #include <QWidgetItem>
19
20 #include <string>
21 #include <utility>
22 #include <vector>
23
24 class QPushButton;
25
26 namespace lyx {
27 namespace frontend {
28
29 class FlowLayout : public QLayout
30 {
31 public:
32         FlowLayout(QWidget *parent);
33         ~FlowLayout();
34
35         void addItem(QLayoutItem *item);
36         Qt::Orientations expandingDirections() const;
37         bool hasHeightForWidth() const;
38         int heightForWidth(int) const;
39         QSize minimumSize() const;
40         void setGeometry(const QRect &rect);
41         QSize sizeHint() const;
42         QLayoutItem * takeAt(int index);
43         QLayoutItem * itemAt(int index) const;
44         int count() const;
45
46 private:
47         int doLayout(const QRect &rect, bool testOnly) const;
48         QList<QLayoutItem *> itemList;
49 };
50
51
52 /**
53  * For holding an arbitrary set of icons.
54  */
55 class IconPalette : public QWidget {
56         Q_OBJECT
57 public:
58         IconPalette(QWidget * parent, char const ** entries);
59
60 Q_SIGNALS:
61         void button_clicked(const std::string &);
62
63 protected Q_SLOTS:
64         virtual void clicked();
65
66 private:
67         typedef std::pair<QPushButton *, std::string> Button;
68         std::vector<Button> buttons_;
69 };
70
71
72 } // namespace frontend
73 } // namespace lyx
74
75 #endif // ICONPALETTE_H