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