]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
include sys/time.h
[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
14 #include "Toolbar.h"
15 #include "ToolbarDefaults.h"
16 #include "Toolbar_pimpl.h"
17 #include "debug.h"
18 #include "LyXAction.h"
19
20 using std::endl;
21
22 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
23         : last_textclass_(-1)
24 {
25         pimpl_ = new Pimpl(o, x, y);
26
27         // extracts the toolbar actions from tbd
28         for (ToolbarDefaults::const_iterator cit = tbd.begin();
29              cit != tbd.end(); ++cit) {
30                 pimpl_->add((*cit));
31                 lyxerr[Debug::GUI] << "tool action: " << (*cit) << endl;
32         }
33 }
34
35
36 Toolbar::~Toolbar()
37 {
38         delete pimpl_;
39 }
40
41
42 void Toolbar::update()
43 {
44         pimpl_->update();
45 }
46
47
48
49 void Toolbar::setLayout(string const & layout)
50 {
51         pimpl_->setLayout(layout);
52 }
53
54
55 bool Toolbar::updateLayoutList(int textclass)
56 {
57         // update the layout display
58         if (last_textclass_ != textclass) {
59                 pimpl_->updateLayoutList(true);
60                 last_textclass_ = textclass;
61                 return true;
62         } else {
63                 pimpl_->updateLayoutList(false);
64                 return false;
65         }
66 }
67
68
69 void Toolbar::openLayoutList()
70 {
71         pimpl_->openLayoutList();
72 }
73
74
75 void Toolbar::clearLayoutList()
76 {
77         pimpl_->clearLayoutList();
78 }