]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
layout as string
[lyx.git] / src / frontends / Toolbar.C
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor
5  *
6  *           Copyright 1995 Matthias Ettrich
7  *           Copyright 1995-2001 The LyX Team.
8  *
9  *           This file is Copyright 1996-1998
10  *           Lars Gullik Bjønnes
11  *
12  * ====================================================== */
13
14 //  Added pseudo-action handling, asierra 180296
15
16 #include <config.h>
17
18 #ifdef __GNUG__
19 #pragma implementation "Toolbar.h"
20 #endif
21
22 #include "Toolbar.h"
23 #include "Toolbar_pimpl.h"
24 #include "debug.h"
25 #include "LyXAction.h"
26
27 using std::endl;
28
29 extern LyXAction lyxaction;
30
31
32 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
33 {
34         pimpl_ = new Pimpl(o, x, y);
35
36         pimpl_->reset();
37
38         // extracts the toolbar actions from tbd
39         for (ToolbarDefaults::const_iterator cit = tbd.begin();
40              cit != tbd.end(); ++cit) {
41                 pimpl_->add((*cit));
42                 lyxerr[Debug::GUI] << "tool action: "
43                                        << (*cit) << endl;
44         }
45 }
46
47
48 Toolbar::~Toolbar()
49 {
50         delete pimpl_;
51 }
52
53
54 void Toolbar::set(bool doingmain)
55 {
56         pimpl_->set(doingmain);
57 }
58
59
60 void Toolbar::activate()
61 {
62         pimpl_->activate();
63 }
64
65
66 void Toolbar::deactivate()
67 {
68         pimpl_->deactivate();
69 }
70
71
72 void Toolbar::update()
73 {
74         pimpl_->update();
75 }
76
77
78
79 void Toolbar::setLayout(string const & layout)
80 {
81         pimpl_->setLayout(layout);
82 }
83
84
85 void Toolbar::updateLayoutList(bool force)
86 {
87         pimpl_->updateLayoutList(force);
88 }
89
90                 
91 void Toolbar::openLayoutList()
92 {
93         pimpl_->openLayoutList();
94 }
95
96
97 void Toolbar::clearLayoutList()
98 {
99         pimpl_->clearLayoutList();
100 }
101
102
103 void Toolbar::push(int nth)
104 {
105         pimpl_->push(nth);
106 }
107
108
109 void Toolbar::add(string const & func, bool doclean)
110 {
111         int const tf = lyxaction.LookupFunc(func);
112
113         if (tf == -1) {
114                 lyxerr << "Toolbar::add: no LyX command called`"
115                        << func << "'exists!" << endl; 
116         } else {
117                 pimpl_->add(tf, doclean);
118         }
119 }