]> git.lyx.org Git - lyx.git/blob - src/DispatchResult.h
Cmake build: Don't use temporary doc-files as source for installation
[lyx.git] / src / DispatchResult.h
1 // -*- C++ -*-
2 /**
3  * \file DispatchResult.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Peter Kümmel
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef DISPATCH_RESULT_H
14 #define DISPATCH_RESULT_H
15
16 #include "update_flags.h"
17
18 #include "support/docstring.h"
19
20 namespace lyx {
21
22
23 class DispatchResult
24 {
25 public:
26         ///
27         DispatchResult() :
28                         dispatched_(false),
29                         error_(false),
30                         update_(Update::None),
31                         need_buf_update_(false),
32                         need_msg_update_(true),
33                         need_changes_update_(false)
34         {}
35         ///
36         DispatchResult(bool dispatched, Update::flags f) :
37                         dispatched_(dispatched),
38                         error_(false),
39                         update_(f),
40                         need_buf_update_(false),
41                         need_msg_update_(true),
42                         need_changes_update_(false)
43         {}
44         ///
45         bool dispatched() const { return dispatched_; }
46         ///
47         void dispatched(bool disp) { dispatched_ = disp; }
48         ///
49         bool error() const { return error_; }
50         ///
51         void setError(bool e) { error_ = e; }
52         ///
53         docstring message() { return message_; }
54         ///
55         void setMessage(docstring const & m) { message_ = m; }
56         ///
57         void setMessage(std::string const & m) { message_ = from_utf8(m); }
58         ///
59         Update::flags screenUpdate() const { return update_; }
60         ///
61         void screenUpdate(Update::flags f) { update_ = f; }
62
63         /// Does the buffer need updating?
64         bool needBufferUpdate() const { return need_buf_update_; }
65         /// Force the buffer to be updated
66         void forceBufferUpdate() { need_buf_update_ = true; }
67         /// Clear the flag indicating we need an update
68         void clearBufferUpdate() { need_buf_update_ = false; }
69
70         /// Do we need to display a message in the status bar?
71         bool needMessageUpdate() const { return need_msg_update_; }
72         /// Force the message to be displayed
73         void forceMessageUpdate() { need_msg_update_ = true; }
74         /// Clear the flag indicating we need to display the message
75         void clearMessageUpdate() { need_msg_update_ = false; }
76
77         /// Do we need to update the change tracking presence flag?
78         bool needChangesUpdate() { return need_changes_update_; }
79         /// Force the change tracking presence flag to be updated
80         void forceChangesUpdate() { need_changes_update_ = true; }
81         /// Clear the flag indicating that we need to update the change tracking
82         /// presence flag
83         void clearChangesUpdate() { need_changes_update_ = false; }
84
85 private:
86         /// was the event fully dispatched?
87         bool dispatched_;
88         /// was there an error?
89         bool error_;
90         /// do we need to redraw the screen afterwards?
91         Update::flags update_;
92         ///
93         docstring message_;
94         ///
95         bool need_buf_update_;
96         ///
97         bool need_msg_update_;
98         ///
99         bool need_changes_update_;
100 };
101
102
103 } // namespace lyx
104
105 #endif // DISPATCH_RESULT_H