]> git.lyx.org Git - lyx.git/blob - src/FuncStatus.cpp
Avoid full metrics computation with Update:FitCursor
[lyx.git] / src / FuncStatus.cpp
1 /**
2  * \file FuncStatus.cpp
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
16 namespace lyx {
17
18 FuncStatus::FuncStatus()
19         : v_(OK)
20 {}
21
22
23 void FuncStatus::clear()
24 {
25         v_ = OK;
26         message_.erase();
27 }
28
29
30 void FuncStatus::setUnknown(bool b)
31 {
32         if (b)
33                 v_ |= UNKNOWN;
34         else
35                 v_ &= ~UNKNOWN;
36 }
37
38
39
40 bool FuncStatus::unknown() const
41 {
42         return (v_ & UNKNOWN);
43 }
44
45
46 void FuncStatus::setEnabled(bool b)
47 {
48         if (b)
49                 v_ &= ~DISABLED;
50         else
51                 v_ |= DISABLED;
52 }
53
54
55 bool FuncStatus::enabled() const
56 {
57         return !(v_ & DISABLED);
58 }
59
60
61 void FuncStatus::setOnOff(bool b)
62 {
63         v_ |= (b ? ON : OFF);
64 }
65
66
67 bool FuncStatus::onOff(bool b) const
68 {
69         if (b)
70                 return (v_ & ON);
71         else
72                 return (v_ & OFF);
73 }
74
75
76 void FuncStatus::message(docstring const & m)
77 {
78         message_ = m;
79 }
80
81
82 docstring const & FuncStatus::message() const
83 {
84         return message_;
85 }
86
87
88 } // namespace lyx