#include <QAction>
#include <QPixmap>
-
namespace lyx {
using std::string;
}
case ToolbarItem::ICONPALETTE: {
QToolButton * tb = new QToolButton(this);
- tb->setCheckable(true);
tb->setToolTip(qt_(to_ascii(item.label_)));
tb->setStatusTip(qt_(to_ascii(item.label_)));
tb->setText(qt_(to_ascii(item.label_)));
connect(this, SIGNAL(iconSizeChanged(const QSize &)),
tb, SLOT(setIconSize(const QSize &)));
-
IconPalette * panel = new IconPalette(tb);
+ panel->setWindowTitle(qt_(to_ascii(item.label_)));
connect(this, SIGNAL(updated()), panel, SLOT(updateParent()));
- ToolbarInfo const & tbinfo = toolbarbackend.getToolbar(item.name_);
- ToolbarInfo::item_iterator it = tbinfo.items.begin();
- ToolbarInfo::item_iterator const end = tbinfo.items.end();
- for (; it != end; ++it)
+ ToolbarInfo const * tbinfo = toolbarbackend.getDefinedToolbarInfo(item.name_);
+ if (!tbinfo) {
+ lyxerr << "Unknown toolbar " << item.name_ << endl;
+ break;
+ }
+ ToolbarInfo::item_iterator it = tbinfo->items.begin();
+ ToolbarInfo::item_iterator const end = tbinfo->items.end();
+ for (; it != end; ++it)
if (!getStatus(it->func_).unknown()) {
Action * action = new Action(owner_,
getIcon(it->func_),
panel->addButton(action);
ActionVector.push_back(action);
// use the icon of first action for the toolbar button
- if (it == tbinfo.items.begin())
+ if (it == tbinfo->items.begin())
tb->setIcon(QPixmap(getIcon(it->func_).c_str()));
}
+ tb->setCheckable(true);
connect(tb, SIGNAL(clicked(bool)), panel, SLOT(setVisible(bool)));
connect(panel, SIGNAL(visible(bool)), tb, SLOT(setChecked(bool)));
addWidget(tb);
tb, SLOT(setIconSize(const QSize &)));
ButtonMenu * m = new ButtonMenu(qt_(to_ascii(item.label_)), tb);
+ m->setWindowTitle(qt_(to_ascii(item.label_)));
+ m->setTearOffEnabled(true);
connect(this, SIGNAL(updated()), m, SLOT(updateParent()));
- ToolbarInfo const & tbinfo = toolbarbackend.getToolbar(item.name_);
- ToolbarInfo::item_iterator it = tbinfo.items.begin();
- ToolbarInfo::item_iterator const end = tbinfo.items.end();
+ ToolbarInfo const * tbinfo = toolbarbackend.getDefinedToolbarInfo(item.name_);
+ if (!tbinfo) {
+ lyxerr << "Unknown toolbar " << item.name_ << endl;
+ break;
+ }
+ ToolbarInfo::item_iterator it = tbinfo->items.begin();
+ ToolbarInfo::item_iterator const end = tbinfo->items.end();
for (; it != end; ++it)
if (!getStatus(it->func_).unknown()) {
Action * action = new Action(owner_,
}
+bool QLToolbar::isVisible() const
+{
+ return QToolBar::isVisible();
+}
+
+
void QLToolbar::saveInfo(ToolbarSection::ToolbarInfo & tbinfo)
{
// if tbinfo.state == auto *do not* set on/off
else
tbinfo.state = ToolbarSection::ToolbarInfo::OFF;
}
- //
+ //
// no need to save it here.
Qt::ToolBarArea loc = owner_.toolBarArea(this);
tbinfo.location = ToolbarSection::ToolbarInfo::LEFT;
else
tbinfo.location = ToolbarSection::ToolbarInfo::NOTSET;
-
- // save toolbar position. They are not used to restore toolbar position
+
+ // save toolbar position. They are not used to restore toolbar position
// now because move(x,y) does not work for toolbar.
tbinfo.posx = pos().x();
tbinfo.posy = pos().y();