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