]> git.lyx.org Git - lyx.git/blob - src/FuncStatus.h
Avoid full metrics computation with Update:FitCursor
[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 "support/docstring.h"
16
17
18 namespace lyx {
19
20 /// The status of a function.
21
22 class FuncStatus
23 {
24 private:
25
26         enum StatusCodes {
27                 /// Command can be executed
28                 OK = 0,
29                 /// This command does not exist, possibly because it is not
30                 /// compiled in (e.g. LFUN_THESAURUS) or the user mistyped
31                 /// it in the minibuffer. UNKNOWN commands have no menu entry.
32                 UNKNOWN = 1,
33                 /// Command cannot be executed
34                 DISABLED = 2,
35                 /// Command is on (i. e. the menu item has a checkmark
36                 /// and the toolbar icon is pushed).
37                 /// Not all commands use this
38                 ON = 4,
39                 /// Command is off (i. e. the menu item has no checkmark
40                 /// and the toolbar icon is not pushed).
41                 /// Not all commands use this
42                 OFF = 8
43         };
44
45         unsigned int v_;
46
47         docstring message_;
48
49 public:
50         ///
51         FuncStatus();
52         ///
53         void clear();
54         ///
55         void setUnknown(bool b);
56         ///
57         bool unknown() const;
58
59         ///
60         void setEnabled(bool b);
61         /// tells whether it can be invoked (otherwise it will be grayed-out).
62         bool enabled() const;
63
64         ///
65         void setOnOff(bool b);
66         /// tells whether the menu item should have a check mark
67         /// (or the toolbar icon should be pushed).
68         bool onOff(bool b) const;
69
70         ///
71         void message(docstring const & m);
72         ///
73         docstring const & message() const;
74 };
75
76
77 } // namespace lyx
78
79 #endif