/** * \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 #include "iconpalette.h" #include "debug.h" #include "qt_helpers.h" #include #include #include #include #include #include #include #include using std::endl; using std::make_pair; using std::max; using std::string; using std::vector; int const button_size = 40; IconPalette::IconPalette(QWidget * parent) : QWidget(parent), maxcol_(-1) { QVBoxLayout * top = new QVBoxLayout(this); QHBoxLayout * row = new QHBoxLayout(this); layout_ = new QGridLayout(this); top->insertLayout(-1, row); row->insertLayout(-1, layout_); 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->setIcon(QIcon(pixmap)); p->setToolTip(toqstr(tooltip)); connect(p, SIGNAL(clicked()), this, SLOT(clicked())); buttons_.push_back(make_pair(p, name)); } void IconPalette::clicked() { vector