2002-09-24 13:57:09 +00:00
|
|
|
// -*- C++ -*-
|
2002-08-30 16:20:27 +00:00
|
|
|
/**
|
|
|
|
* \file iconpalette.h
|
2002-09-24 13:57:09 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-08-30 16:20:27 +00:00
|
|
|
*
|
|
|
|
* \author John Levon
|
2002-09-24 13:57:09 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-08-30 16:20:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ICONPALETTE_H
|
|
|
|
#define ICONPALETTE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <qwidget.h>
|
2003-10-06 15:43:21 +00:00
|
|
|
|
2003-10-06 19:57:16 +00:00
|
|
|
#include <string>
|
2002-09-24 13:57:09 +00:00
|
|
|
#include <utility>
|
2002-09-08 02:37:57 +00:00
|
|
|
#include <vector>
|
2002-08-30 16:20:27 +00:00
|
|
|
|
|
|
|
class QPixmap;
|
|
|
|
class QPushButton;
|
|
|
|
class QGridLayout;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* For holding an arbitrary set of icons.
|
|
|
|
*/
|
|
|
|
class IconPalette : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2002-09-08 01:14:08 +00:00
|
|
|
IconPalette(QWidget * parent, char const * name = 0);
|
2002-08-30 16:20:27 +00:00
|
|
|
|
|
|
|
/// add a button
|
2003-10-06 15:43:21 +00:00
|
|
|
void add(QPixmap const & pixmap, std::string name, std::string tooltip);
|
2002-08-30 16:20:27 +00:00
|
|
|
signals:
|
2003-10-06 15:43:21 +00:00
|
|
|
void button_clicked(const std::string &);
|
2002-09-07 23:28:05 +00:00
|
|
|
protected:
|
|
|
|
virtual void resizeEvent(QResizeEvent * e);
|
2002-08-30 16:20:27 +00:00
|
|
|
protected slots:
|
|
|
|
virtual void clicked();
|
|
|
|
private:
|
2002-09-08 02:37:57 +00:00
|
|
|
int maxcol_;
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2002-08-30 16:20:27 +00:00
|
|
|
QGridLayout * layout_;
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
typedef std::pair<QPushButton *, std::string> Button;
|
2002-09-24 13:57:09 +00:00
|
|
|
|
2002-09-08 02:37:57 +00:00
|
|
|
std::vector<Button> buttons_;
|
2002-08-30 16:20:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ICONPALETTE_H
|