lyx_mirror/src/frontends/Toolbar.C
John Levon c43fc67eff toolbar cleanup. JMarc, Lars, please see the fIXME. I haven't introduced the problem
but we are leaking icons on every vector resize ...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4751 a592a061-630c-0410-9148-cb99ea01b6c8
2002-07-22 20:52:40 +00:00

84 lines
1.3 KiB
C

/**
* \file Toolbar.C
* Copyright 1995-2002 the LyX Team
* Read the file COPYING
*
* \author Lars Gullik Bjønnes <larsbj@lyx.org>
*/
#include <config.h>
#ifdef __GNUG__
#pragma implementation "Toolbar.h"
#endif
#include "Toolbar.h"
#include "ToolbarDefaults.h"
#include "Toolbar_pimpl.h"
#include "debug.h"
#include "LyXAction.h"
using std::endl;
extern LyXAction lyxaction;
Toolbar::Toolbar(LyXView * o, Dialogs & d,
int x, int y, ToolbarDefaults const &tbd)
: last_textclass_(-1)
{
pimpl_ = new Pimpl(o, d, x, y);
// extracts the toolbar actions from tbd
for (ToolbarDefaults::const_iterator cit = tbd.begin();
cit != tbd.end(); ++cit) {
pimpl_->add((*cit));
lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
}
}
Toolbar::~Toolbar()
{
delete pimpl_;
}
void Toolbar::update()
{
pimpl_->update();
}
void Toolbar::setLayout(string const & layout)
{
pimpl_->setLayout(layout);
}
bool Toolbar::updateLayoutList(int textclass)
{
// update the layout display
if (last_textclass_ != textclass) {
pimpl_->updateLayoutList(true);
last_textclass_ = textclass;
return true;
} else {
pimpl_->updateLayoutList(false);
return false;
}
}
void Toolbar::openLayoutList()
{
pimpl_->openLayoutList();
}
void Toolbar::clearLayoutList()
{
pimpl_->clearLayoutList();
}