]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
Spaces menu for math dialog
[lyx.git] / src / frontends / Toolbar.C
1 /**
2  * \file Toolbar.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes 
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #include <config.h>
12
13 #ifdef __GNUG__
14 #pragma implementation "Toolbar.h"
15 #endif
16
17 #include "Toolbar.h"
18 #include "ToolbarDefaults.h"
19 #include "Toolbar_pimpl.h"
20 #include "debug.h"
21 #include "LyXAction.h"
22
23 using std::endl;
24
25 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
26         : last_textclass_(-1)
27 {
28         pimpl_ = new Pimpl(o, x, y);
29
30         // extracts the toolbar actions from tbd
31         for (ToolbarDefaults::const_iterator cit = tbd.begin();
32              cit != tbd.end(); ++cit) {
33                 pimpl_->add((*cit));
34                 lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
35         }
36 }
37
38
39 Toolbar::~Toolbar()
40 {
41         delete pimpl_;
42 }
43
44
45 void Toolbar::update()
46 {
47         pimpl_->update();
48 }
49
50
51
52 void Toolbar::setLayout(string const & layout)
53 {
54         pimpl_->setLayout(layout);
55 }
56
57
58 bool Toolbar::updateLayoutList(int textclass)
59 {
60         // update the layout display
61         if (last_textclass_ != textclass) {
62                 pimpl_->updateLayoutList(true);
63                 last_textclass_ = textclass;
64                 return true;
65         } else {
66                 pimpl_->updateLayoutList(false);
67                 return false;
68         }
69 }
70
71
72 void Toolbar::openLayoutList()
73 {
74         pimpl_->openLayoutList();
75 }
76
77
78 void Toolbar::clearLayoutList()
79 {
80         pimpl_->clearLayoutList();
81 }