]> git.lyx.org Git - lyx.git/blob - src/DispatchResult.h
prepare Qt 5.6 builds
[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         {}
34         ///
35         DispatchResult(bool dispatched, Update::flags f) :
36                         dispatched_(dispatched),
37                         error_(false),
38                         update_(f),
39                         need_buf_update_(false),
40                         need_msg_update_(true)
41         {}
42         ///
43         bool dispatched() const { return dispatched_; }
44         ///
45         void dispatched(bool disp) { dispatched_ = disp; }
46         ///
47         bool error() const { return error_; }
48         ///
49         void setError(bool e) { error_ = e; }
50         ///
51         docstring message() { return message_; }
52         ///
53         void setMessage(docstring const & m) { message_ = m; }
54         ///
55         void setMessage(std::string const & m) { message_ = from_utf8(m); }
56         ///
57         Update::flags screenUpdate() const { return update_; }
58         ///
59         void screenUpdate(Update::flags f) { update_ = f; }
60         /// Does the buffer need updating?
61         bool needBufferUpdate() const { return need_buf_update_; }
62         /// Force the buffer to be updated
63         void forceBufferUpdate() { need_buf_update_ = true; }
64         /// Clear the flag indicating we need an update
65         void clearBufferUpdate() { need_buf_update_ = false; }
66         /// Do we need to display a message in the status bar?
67         bool needMessageUpdate() const { return need_msg_update_; }
68         /// Force the message to be displayed
69         void forceMessageUpdate() { need_msg_update_ = true; }
70         /// Clear the flag indicating we need to display the message
71         void clearMessageUpdate() { need_msg_update_ = false; }
72
73 private:
74         /// was the event fully dispatched?
75         bool dispatched_;
76         /// was there an error?
77         bool error_;
78         /// do we need to redraw the screen afterwards?
79         Update::flags update_;
80         ///
81         docstring message_;
82         /// 
83         bool need_buf_update_;
84         ///
85         bool need_msg_update_;
86 };
87
88
89 } // namespace lyx
90
91 #endif // DISPATCH_RESULT_H