X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fdispatchresult.h;h=d5133fd5a1f3c5aa75068aff026ff6e0d4e59c30;hb=fd2124c83dfcfeaf33b64d1d33c8ceb8d9f5f9b9;hp=be994a94cb308fe46d90d7fc0cea08876baaa0fa;hpb=b0eb70e869128e30ab7e4538aa32a244fd4cea57;p=lyx.git diff --git a/src/dispatchresult.h b/src/dispatchresult.h index be994a94cb..d5133fd5a1 100644 --- a/src/dispatchresult.h +++ b/src/dispatchresult.h @@ -13,43 +13,26 @@ #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, - DISPATCHED_POP -}; - -/** \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. - */ +/// Maybe this can go entirely class DispatchResult { - dispatch_result_t val_; public: - DispatchResult() - : val_(UNDISPATCHED) {} - DispatchResult(dispatch_result_t val) : val_(val) {} - operator dispatch_result_t() const{ return val_; } + /// + DispatchResult() : dispatched_(false), update_(false) {} + /// + DispatchResult(bool disp, bool upd) : dispatched_(disp), update_(upd) {} + // + bool dispatched() const { return dispatched_; } + /// + void dispatched(bool disp) { dispatched_ = disp; } + /// + bool update() const { return update_; } + /// + void update(bool up) { update_ = up; } +private: + /// was the event fully dispatched? + bool dispatched_; + /// do we need to redraw the screen afterwards? + bool update_; }; #endif // DISPATCH_RESULT_H