3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
13 #include "iconpalette.h"
16 #include <qpushbutton.h>
22 IconPalette::IconPalette(QWidget * parent, char const * name)
23 : QWidget(parent, name), crow_(0), ccol_(0)
25 QVBoxLayout * top = new QVBoxLayout(this);
26 QHBoxLayout * row = new QHBoxLayout(top);
27 layout_ = new QGridLayout(row);
33 void IconPalette::add(QPixmap const & pixmap, string name, string tooltip)
35 QPushButton * p = new QPushButton(this);
36 p->setFixedSize(40, 40);
38 QToolTip::add(p, tooltip.c_str());
39 layout_->addWidget(p, crow_, ccol_);
44 resize(5 * 40, crow_ * 40);
45 button_map_[p] = name;
46 connect(p, SIGNAL(clicked()), this, SLOT(clicked()));
50 void IconPalette::clicked()
52 string name = button_map_[(QPushButton*)(sender())];
53 emit button_clicked(name);
57 void IconPalette::resizeEvent(QResizeEvent * e)
59 lyxerr << "resize panel to " << e->size().width() << "," << e->size().height() << endl;