/** * \file iconpalette.C * 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 */ #include #ifdef __GNUG__ #pragma implementation #endif #include "debug.h" #include "iconpalette.h" #include #include #include #include using std::endl; using std::make_pair; using std::vector; using std::max; int const button_size = 40; IconPalette::IconPalette(QWidget * parent, char const * name) : QWidget(parent, name), maxcol_(-1) { QVBoxLayout * top = new QVBoxLayout(this); QHBoxLayout * row = new QHBoxLayout(top); layout_ = new QGridLayout(row); row->addStretch(0); top->addStretch(0); } void IconPalette::add(QPixmap const & pixmap, string name, string tooltip) { QPushButton * p = new QPushButton(this); p->setFixedSize(button_size, button_size); p->setPixmap(pixmap); QToolTip::add(p, tooltip.c_str()); connect(p, SIGNAL(clicked()), this, SLOT(clicked())); buttons_.push_back(make_pair(p, name)); } void IconPalette::clicked() { vector