]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
Move init() back to LyXView
[lyx.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 "Toolbar_pimpl.h"
17 #include "debug.h"
18 #include "LyXAction.h"
19
20 using std::endl;
21
22 extern LyXAction lyxaction;
23
24
25 Toolbar::Toolbar(LyXView * o, int x, int y, ToolbarDefaults const &tbd)
26 {
27         pimpl_ = new Pimpl(o, x, y);
28
29         pimpl_->reset();
30
31         // extracts the toolbar actions from tbd
32         for (ToolbarDefaults::const_iterator cit = tbd.begin();
33              cit != tbd.end(); ++cit) {
34                 pimpl_->add((*cit));
35                 lyxerr[Debug::GUI] << "tool action: "
36                                        << (*cit) << endl;
37         }
38 }
39
40
41 Toolbar::~Toolbar()
42 {
43         delete pimpl_;
44 }
45
46
47 void Toolbar::set(bool doingmain)
48 {
49         pimpl_->set(doingmain);
50 }
51
52
53 void Toolbar::activate()
54 {
55         pimpl_->activate();
56 }
57
58
59 void Toolbar::deactivate()
60 {
61         pimpl_->deactivate();
62 }
63
64
65 void Toolbar::update()
66 {
67         pimpl_->update();
68 }
69
70
71
72 void Toolbar::setLayout(string const & layout)
73 {
74         pimpl_->setLayout(layout);
75 }
76
77
78 void Toolbar::updateLayoutList(bool force)
79 {
80         pimpl_->updateLayoutList(force);
81 }
82
83
84 void Toolbar::openLayoutList()
85 {
86         pimpl_->openLayoutList();
87 }
88
89
90 void Toolbar::clearLayoutList()
91 {
92         pimpl_->clearLayoutList();
93 }
94
95
96 void Toolbar::push(int nth)
97 {
98         pimpl_->push(nth);
99 }
100
101
102 void Toolbar::add(string const & func, bool doclean)
103 {
104         int const tf = lyxaction.LookupFunc(func);
105
106         if (tf == -1) {
107                 lyxerr << "Toolbar::add: no LyX command called`"
108                        << func << "'exists!" << endl;
109         } else {
110                 pimpl_->add(tf, doclean);
111         }
112 }