X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fdispatchresult.h;h=7b53ec1c85d3ba2d28a1174b6ca4761892c39cd5;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=0700dd517a9e3f549ff4e4b68eb26187b174e995;hpb=1d7a7153298510004eef95e030fe6e3f2a242e45;p=lyx.git diff --git a/src/dispatchresult.h b/src/dispatchresult.h index 0700dd517a..7b53ec1c85 100644 --- a/src/dispatchresult.h +++ b/src/dispatchresult.h @@ -13,67 +13,33 @@ #ifndef DISPATCH_RESULT_H #define DISPATCH_RESULT_H -/** Dispatch result codes - DISPATCHED = the inset catched the action - DISPATCHED_NOUPDATE = the inset catched the action and no update - is needed here to redraw the inset - FINISHED = the inset must be unlocked as a result - of the action - FINISHED_RIGHT = FINISHED, but put the cursor to the RIGHT of - the inset. - FINISHED_UP = FINISHED, but put the cursor UP of - the inset. - FINISHED_DOWN = FINISHED, but put the cursor DOWN of - the inset. - UNDISPATCHED = the action was not catched, it should be - dispatched by lower level insets -*/ -enum dispatch_result_t { - UNDISPATCHED = 0, - DISPATCHED, - DISPATCHED_NOUPDATE, - FINISHED, - FINISHED_RIGHT, - FINISHED_UP, - FINISHED_DOWN, - FINISHED_POP -}; +#include "UpdateFlags.h" -/** \c DispatchResult is a wrapper for dispatch_result_t. - * It can be forward-declared and passed as a function argument without - * having to expose insetbase.h. - */ +namespace lyx { + +/// Maybe this can go entirely class DispatchResult { public: - DispatchResult() - : val_(UNDISPATCHED) {} - DispatchResult(dispatch_result_t val) : val_(val) {} - dispatch_result_t val() const { return val_; } + /// + DispatchResult() : dispatched_(false), update_(Update::None) {} + /// + DispatchResult(bool disp, Update::flags f) : dispatched_(disp), update_(f) {} + // + bool dispatched() const { return dispatched_; } + /// + void dispatched(bool disp) { dispatched_ = disp; } + /// + Update::flags update() const { return update_; } + /// + void update(Update::flags f) { update_ = f; } private: - dispatch_result_t val_; + /// was the event fully dispatched? + bool dispatched_; + /// do we need to redraw the screen afterwards? + Update::flags update_; }; -inline -bool operator==(DispatchResult const & lhs, DispatchResult const & rhs) -{ - return lhs.val() == rhs.val(); -} - - -inline -bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs) -{ - return !(lhs == rhs); -} - - -// This operator is temporary, will be removed with the introduction of -// a status field in DispatchResult. -inline -bool operator>=(DispatchResult const & lhs, DispatchResult const & rhs) -{ - return lhs.val() >= rhs.val(); -} +} // namespace lyx #endif // DISPATCH_RESULT_H