3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
11 #include "iconpalette.h"
14 #include <qpushbutton.h>
18 IconPalette::IconPalette(QWidget * parent, char const * name)
19 : QWidget(parent, name), crow_(0), ccol_(0)
21 QVBoxLayout * top = new QVBoxLayout(this);
22 QHBoxLayout * row = new QHBoxLayout(top);
23 layout_ = new QGridLayout(row);
29 void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
31 QPushButton * p = new QPushButton(this);
32 p->setFixedSize(40, 40);
34 QToolTip::add(p, tooltip.c_str());
35 layout_->addWidget(p, crow_, ccol_);
40 resize(5 * 40, crow_ * 40);
41 button_map_[p] = name;
42 connect(p, SIGNAL(clicked()), this, SLOT(clicked()));
46 void IconPalette::clicked()
48 string name = button_map_[(QPushButton*)(sender())];
49 emit button_clicked(name);