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 DISPATCHED = the inset caught the action
18 DISPATCHED_NOUPDATE = the inset caught the action and no update
19 is needed to redraw the inset
20 FINISHED = the inset must be unlocked as a result
22 FINISHED_RIGHT = FINISHED, but move the cursor RIGHT from
24 FINISHED_UP = FINISHED, but move the cursor UP from
26 FINISHED_DOWN = FINISHED, but move the cursor DOWN from
28 UNDISPATCHED = the action was not catched, it should be
29 dispatched by lower level insets
31 enum dispatch_result_t {
40 /** \c DispatchResult is a wrapper for dispatch_result_t.
41 * It can be forward-declared and passed as a function argument without
42 * having to expose insetbase.h.
44 class DispatchResult {
47 : dispatched_(false), val_(NONE) {}
49 DispatchResult(bool dis)
50 : dispatched_(dis), update_(false), val_(NONE) {}
51 DispatchResult(bool dis, bool update)
52 : dispatched_(dis), update_(true), val_(NONE) {}
53 DispatchResult(bool dis, dispatch_result_t val)
54 : dispatched_(dis), update_(false), val_(val) {}
55 dispatch_result_t val() const { return val_; }
56 void val(dispatch_result_t drt) {
59 bool dispatched() const {
62 void dispatched(bool dis) {
68 void update(bool up) {
74 dispatch_result_t val_;
79 bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
81 return lhs.dispatched() == rhs.dispatched() && lhs.val() == rhs.val();
86 bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs)
91 #endif // DISPATCH_RESULT_H