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