]> git.lyx.org Git - lyx.git/blob - src/FuncStatus.h
FuncStatus documentation from Andre and me
[lyx.git] / src / FuncStatus.h
1 // -*- C++ -*-
2 /**
3  * \file FuncStatus.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jean-Marc Lasgouttes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef FUNC_STATUS_H
13 #define FUNC_STATUS_H
14
15 #include <string>
16
17 /// The status of a function.
18
19 class FuncStatus
20 {
21 private:
22
23         enum StatusCodes {
24                 /// Command can be executed
25                 OK = 0,
26                 /// It is unknown wether the command can be executed or not
27                 UNKNOWN = 1,
28                 /// Command cannot be executed
29                 DISABLED = 2,
30                 /// Command is on (i. e. the menu item has a checkmark
31                 /// and the toolbar icon is pushed).
32                 /// Not all commands use this
33                 ON = 4,
34                 /// Command is off (i. e. the menu item has no checkmark
35                 /// and the toolbar icon is not pushed).
36                 /// Not all commands use this
37                 OFF = 8
38         };
39
40         unsigned int v_;
41
42         std::string message_;
43
44 public:
45         ///
46         FuncStatus();
47         ///
48         void clear();
49         ///
50         void operator|=(FuncStatus const & f);
51         ///
52         void unknown(bool b);
53         ///
54         bool unknown() const;
55
56         ///
57         void enabled(bool b);
58         /// tells whether it can be invoked (otherwise it will be grayed-out).
59         bool enabled() const;
60
61         ///
62         void setOnOff(bool b);
63         /// tells whether the menu item should have a check mark
64         /// (or the toolbar icon should be pushed).
65         bool onoff(bool b) const;
66
67         ///
68         void message(std::string const & m);
69         ///
70         std::string const & message() const;
71 };
72
73 #endif