]> git.lyx.org Git - lyx.git/blob - src/FuncStatus.C
Fix bug 2195: Slowness in rendering inside insets, especially on the Mac
[lyx.git] / src / FuncStatus.C
1 /**
2  * \file FuncStatus.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jean-Marc Lasgouttes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "FuncStatus.h"
14
15 using std::string;
16
17 FuncStatus::FuncStatus() : v_(OK)
18 {
19 }
20
21
22 void FuncStatus::clear()
23 {
24         v_ = OK;
25         message_.erase();
26 }
27
28
29 void FuncStatus::operator|=(FuncStatus const & f)
30 {
31         v_ |= f.v_;
32         if (!f.message_.empty())
33                 message_ = f.message_;
34 }
35
36
37 void FuncStatus::unknown(bool b)
38 {
39         if (b)
40                 v_ |= UNKNOWN;
41         else
42                 v_ &= !UNKNOWN;
43 }
44
45
46
47 bool FuncStatus::unknown() const
48 {
49         return (v_ & UNKNOWN);
50 }
51
52
53 void FuncStatus::enabled(bool b)
54 {
55         if (b)
56                 v_ &= !DISABLED;
57         else
58                 v_ |= DISABLED;
59 }
60
61
62 bool FuncStatus::enabled() const
63 {
64         return !(v_ & DISABLED);
65 }
66
67
68 void FuncStatus::setOnOff(bool b)
69 {
70         v_ |= (b ? ON : OFF);
71 }
72
73
74 bool FuncStatus::onoff(bool b) const
75 {
76         if (b)
77                 return (v_ & ON);
78         else
79                 return (v_ & OFF);
80 }
81
82
83 void FuncStatus::message(string const & m)
84 {
85         message_ = m;
86 }
87
88
89 string const & FuncStatus::message() const
90 {
91         return message_;
92 }