/**
* \file Toolbar.C
- * Read the file COPYING
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation "Toolbar.h"
-#endif
#include "Toolbar.h"
-#include "ToolbarDefaults.h"
+#include "ToolbarBackend.h"
#include "Toolbar_pimpl.h"
#include "debug.h"
#include "LyXAction.h"
using std::endl;
-Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
+Toolbar::Toolbar(LyXView * o, int x, int y)
: last_textclass_(-1)
{
pimpl_ = new Pimpl(o, 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;
- }
+ // extracts the toolbars from the backend
+ ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+ ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
+
+ for (; cit != end; ++cit)
+ pimpl_->add(*cit);
}
}
-void Toolbar::update()
+void Toolbar::update(bool in_math, bool in_table)
{
pimpl_->update();
+
+ // extracts the toolbars from the backend
+ ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
+ ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
+
+ for (; cit != end; ++cit) {
+ if (cit->flags & ToolbarBackend::MATH)
+ pimpl_->displayToolbar(*cit, in_math);
+ else if (cit->flags & ToolbarBackend::TABLE)
+ pimpl_->displayToolbar(*cit, in_table);
+ }
}