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