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