2006-03-05 17:24:44 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file iconpalette.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ICONPALETTE_H
|
|
|
|
#define ICONPALETTE_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <utility>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
class QPixmap;
|
|
|
|
class QPushButton;
|
2006-05-08 11:44:37 +00:00
|
|
|
class QGridLayout;
|
2006-03-05 17:24:44 +00:00
|
|
|
class QResizeEvent;
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
/**
|
|
|
|
* For holding an arbitrary set of icons.
|
|
|
|
*/
|
|
|
|
class IconPalette : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2006-08-17 08:49:40 +00:00
|
|
|
IconPalette(QWidget * parent);
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
/// add a button
|
|
|
|
void add(QPixmap const & pixmap, std::string name, std::string tooltip);
|
2006-06-30 14:37:33 +00:00
|
|
|
Q_SIGNALS:
|
2006-03-05 17:24:44 +00:00
|
|
|
void button_clicked(const std::string &);
|
|
|
|
protected:
|
|
|
|
virtual void resizeEvent(QResizeEvent * e);
|
2006-06-30 14:37:33 +00:00
|
|
|
protected Q_SLOTS:
|
2006-03-05 17:24:44 +00:00
|
|
|
virtual void clicked();
|
|
|
|
private:
|
|
|
|
int maxcol_;
|
|
|
|
|
2006-05-08 11:44:37 +00:00
|
|
|
QGridLayout * layout_;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
typedef std::pair<QPushButton *, std::string> Button;
|
|
|
|
|
|
|
|
std::vector<Button> buttons_;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
#endif // ICONPALETTE_H
|