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);
24 //row->addLayout(layout_);
26 //top->addLayout(row);
31 void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
33 QPushButton * p = new QPushButton(this);
34 p->setFixedSize(35, 35);
36 QToolTip::add(p, tooltip.c_str());
37 layout_->addWidget(p, crow_, ccol_);
42 button_map_[p] = name;
43 connect(p, SIGNAL(clicked()), this, SLOT(clicked()));
47 void IconPalette::clicked()
49 string name = button_map_[(QPushButton*)(sender())];
50 emit button_clicked(name);