]> git.lyx.org Git - lyx.git/blob - src/dispatchresult.h
be994a94cb308fe46d90d7fc0cea08876baaa0fa
[lyx.git] / src / dispatchresult.h
1 // -*- C++ -*-
2 /**
3  * \file dispatchresult.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author none
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef DISPATCH_RESULT_H
14 #define DISPATCH_RESULT_H
15
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
21                         of the action
22         FINISHED_RIGHT      = FINISHED, but put the cursor to the RIGHT of
23                         the inset.
24         FINISHED_UP         = FINISHED, but put the cursor UP of
25                         the inset.
26         FINISHED_DOWN       = FINISHED, but put the cursor DOWN of
27                         the inset.
28         UNDISPATCHED        = the action was not catched, it should be
29                         dispatched by lower level insets
30 */
31 enum dispatch_result_t {
32         UNDISPATCHED = 0,
33         DISPATCHED,
34         DISPATCHED_NOUPDATE,
35         FINISHED,
36         FINISHED_RIGHT,
37         FINISHED_UP,
38         FINISHED_DOWN,
39         DISPATCHED_POP
40 };
41
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.
45  */
46 class DispatchResult {
47         dispatch_result_t val_;
48 public:
49         DispatchResult()
50                 : val_(UNDISPATCHED) {}
51         DispatchResult(dispatch_result_t val) : val_(val) {}
52         operator dispatch_result_t() const{ return val_; }
53 };
54
55 #endif // DISPATCH_RESULT_H