]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/iconpalette.h
* Painter.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
17 #include <string>
18 #include <utility>
19 #include <vector>
20
21
22 class QPixmap;
23 class QPushButton;
24 class QGridLayout;
25 class QResizeEvent;
26
27 namespace lyx {
28
29 /**
30  * For holding an arbitrary set of icons.
31  */
32 class IconPalette : public QWidget {
33         Q_OBJECT
34 public:
35         IconPalette(QWidget * parent);
36
37         /// add a button
38         void add(QPixmap const & pixmap, std::string name, std::string tooltip);
39 Q_SIGNALS:
40         void button_clicked(const std::string &);
41 protected:
42         virtual void resizeEvent(QResizeEvent * e);
43 protected Q_SLOTS:
44         virtual void clicked();
45 private:
46         int maxcol_;
47
48         QGridLayout * layout_;
49
50         typedef std::pair<QPushButton *, std::string> Button;
51
52         std::vector<Button> buttons_;
53 };
54
55
56 } // namespace lyx
57
58 #endif // ICONPALETTE_H