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