]> git.lyx.org Git - lyx.git/blob - src/frontends/Toolbar.C
Martin's changes to the Note inset.
[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 "ToolbarBackend.h"
16 #include "debug.h"
17 #include "LyXAction.h"
18
19 using std::endl;
20
21 Toolbar::Toolbar()
22         : last_textclass_(-1)
23 {
24 }
25
26
27 Toolbar::~Toolbar()
28 {
29 }
30
31
32 void Toolbar::init() 
33 {
34         // extracts the toolbars from the backend
35         ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
36         ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
37
38         for (; cit != end; ++cit)
39                 add(*cit);
40 }
41
42
43 void Toolbar::update(bool in_math, bool in_table)
44 {
45         update();
46
47         // extracts the toolbars from the backend
48         ToolbarBackend::Toolbars::const_iterator cit = toolbarbackend.begin();
49         ToolbarBackend::Toolbars::const_iterator end = toolbarbackend.end();
50
51         for (; cit != end; ++cit) {
52                 if (cit->flags & ToolbarBackend::MATH)
53                         displayToolbar(*cit, in_math);
54                 else if (cit->flags & ToolbarBackend::TABLE)
55                         displayToolbar(*cit, in_table);
56         }
57 }
58
59
60 bool Toolbar::updateLayoutList(int textclass)
61 {
62         // update the layout display
63         if (last_textclass_ != textclass) {
64                 updateLayoutList();
65                 last_textclass_ = textclass;
66                 return true;
67         } else
68                 return false;
69 }