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