]> git.lyx.org Git - lyx.git/blob - src/insets/insetbase.h
iu2: move localDispatch() to InsetBase
[lyx.git] / src / insets / insetbase.h
1 // -*- C++ -*-
2 /**
3  * \file insetbase.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  *
9  * Full author contact details are available in file CREDITS
10  */
11
12 #ifndef INSETBASE_H
13 #define INSETBASE_H
14
15 #include <vector>
16
17 class FuncRequest;
18
19 /** Dispatch result codes
20                 DISPATCHED          = the inset catched the action
21                 DISPATCHED_NOUPDATE = the inset catched the action and no update
22                                 is needed here to redraw the inset
23                 FINISHED            = the inset must be unlocked as a result
24                                 of the action
25                 FINISHED_RIGHT      = FINISHED, but put the cursor to the RIGHT of
26                                 the inset.
27                 FINISHED_UP         = FINISHED, but put the cursor UP of
28                                 the inset.
29                 FINISHED_DOWN       = FINISHED, but put the cursor DOWN of
30                                 the inset.
31                 UNDISPATCHED        = the action was not catched, it should be
32                                 dispatched by lower level insets
33 */
34 enum dispatch_result {
35         UNDISPATCHED = 0,
36         DISPATCHED,
37         DISPATCHED_NOUPDATE,
38         FINISHED,
39         FINISHED_RIGHT,
40         FINISHED_UP,
41         FINISHED_DOWN,
42         DISPATCHED_POP
43 };
44
45
46 /// Common base class to all insets
47 class InsetBase {
48 public:
49         /// type for cell indices
50         typedef size_t                   idx_type;
51         /// type for cursor positions
52         typedef size_t                   pos_type;
53         /// type for row numbers
54         typedef size_t                   row_type;
55         /// type for column numbers
56         typedef size_t                   col_type;
57
58         // the real dispatcher
59         virtual dispatch_result dispatch
60                 (FuncRequest const & cmd, idx_type & idx, pos_type & pos);
61
62         /// small wrapper for the time being
63         virtual dispatch_result localDispatch(FuncRequest const & cmd);
64
65         ///
66         virtual ~InsetBase() {}
67 };
68
69 #endif