3 * \file dispatchresult.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
13 #ifndef DISPATCH_RESULT_H
14 #define DISPATCH_RESULT_H
16 /** Dispatch result codes
17 NONE = no special action required
18 FINISHED_LEFT = the cursor leaves the inset to the LEFT
19 as consequence of this action
20 FINISHED_RIGHT = FINISHED, but move the cursor RIGHT from
22 FINISHED_UP = FINISHED, but move the cursor UP from
24 FINISHED_DOWN = FINISHED, but move the cursor DOWN from
27 enum dispatch_result_t {
36 /** \c DispatchResult is a wrapper for dispatch_result_t.
37 * It can be forward-declared and passed as a function argument without
38 * having to expose insetbase.h.
40 class DispatchResult {
43 : dispatched_(false), val_(NONE) {}
45 DispatchResult(bool dis)
46 : dispatched_(dis), update_(false), val_(NONE) {}
47 DispatchResult(bool dis, bool update)
48 : dispatched_(dis), update_(update), val_(NONE) {}
49 DispatchResult(bool dis, dispatch_result_t val)
50 : dispatched_(dis), update_(true), val_(val) {}
51 dispatch_result_t val() const { return val_; }
52 void val(dispatch_result_t drt) {
55 bool dispatched() const {
58 void dispatched(bool dis) {
64 void update(bool up) {
70 dispatch_result_t val_;
75 bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
77 return lhs.dispatched() == rhs.dispatched() && lhs.val() == rhs.val();
82 bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs)
87 #endif // DISPATCH_RESULT_H