* qt_helpers.cpp:
[lyx.git] / src / FuncStatus.h
blobaf2801389e8e2ca4cbf3b8b3644cf3b7cc9eec49
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.
7 * \author Jean-Marc Lasgouttes
9 * Full author contact details are available in file CREDITS.
12 #ifndef FUNC_STATUS_H
13 #define FUNC_STATUS_H
15 #include "support/docstring.h"
18 namespace lyx {
20 /// The status of a function.
22 class FuncStatus
24 private:
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
45 unsigned int v_;
47 docstring message_;
49 public:
50 ///
51 FuncStatus();
52 ///
53 void clear();
54 ///
55 void operator|=(FuncStatus const & f);
56 ///
57 void unknown(bool b);
58 ///
59 bool unknown() const;
61 ///
62 void setEnabled(bool b);
63 /// tells whether it can be invoked (otherwise it will be grayed-out).
64 bool enabled() const;
66 ///
67 void setOnOff(bool b);
68 /// tells whether the menu item should have a check mark
69 /// (or the toolbar icon should be pushed).
70 bool onoff(bool b) const;
72 ///
73 void message(docstring const & m);
74 ///
75 docstring const & message() const;
79 } // namespace lyx
81 #endif