]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/iconpalette.h
hopefully fix tex2lyx linking.
[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         /// get required number of rows.
40         int numRows();
41         /// get number of Buttons
42         int numButtons();
43
44 Q_SIGNALS:
45         void button_clicked(const std::string &);
46 protected:
47         virtual void resizeEvent(QResizeEvent * e);
48 protected Q_SLOTS:
49         virtual void clicked();
50 private:
51         int maxcol_;
52
53         int maxrow_;
54
55         QGridLayout * layout_;
56
57         typedef std::pair<QPushButton *, std::string> Button;
58
59         std::vector<Button> buttons_;
60 };
61
62
63 } // namespace lyx
64
65 #endif // ICONPALETTE_H