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 catched the action
18 DISPATCHED_NOUPDATE = the inset catched the action and no update
19 is needed here to redraw the inset
20 FINISHED = the inset must be unlocked as a result
22 FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of
24 FINISHED_UP = FINISHED, but put the cursor UP of
26 FINISHED_DOWN = FINISHED, but put the cursor DOWN of
28 UNDISPATCHED = the action was not catched, it should be
29 dispatched by lower level insets
31 enum dispatch_result_t {
42 /** \c DispatchResult is a wrapper for dispatch_result_t.
43 * It can be forward-declared and passed as a function argument without
44 * having to expose insetbase.h.
46 class DispatchResult {
49 : val_(UNDISPATCHED) {}
50 DispatchResult(dispatch_result_t val) : val_(val) {}
51 dispatch_result_t val() const { return val_; }
53 dispatch_result_t val_;
58 bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
60 return lhs.val() == rhs.val();
65 bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs)
71 // This operator is temporary, will be removed with the introduction of
72 // a status field in DispatchResult.
74 bool operator>=(DispatchResult const & lhs, DispatchResult const & rhs)
76 return lhs.val() >= rhs.val();
79 #endif // DISPATCH_RESULT_H