]> git.lyx.org Git - lyx.git/blob - src/mathed/math_nestinset.h
remove unneeded member
[lyx.git] / src / mathed / math_nestinset.h
1 #ifndef MATH_NESTINSET_H
2 #define MATH_NESTINSET_H
3
4 #ifdef __GNUG__
5 #pragma interface
6 #endif
7
8 #include "math_diminset.h"
9
10 /** Abstract base class for all math objects that contain nested items.
11     This is basically everything that is not a single character or a
12     single symbol.
13 */
14
15
16 class LaTeXFeatures;
17
18 class MathNestInset : public MathDimInset {
19 public:
20         /// nestinsets have a fixed size to start with
21         explicit MathNestInset(idx_type ncells);
22
23         /// the size is usuall some sort of convex hull of the cells
24         void metrics(MathMetricsInfo const & mi) const;
25         /// add space for markers
26         void metricsMarkers() const;
27         /// add space for markers
28         void metricsMarkers2() const;
29         /// draw background if locked
30         void draw(MathPainterInfo & pi, int x, int y) const;
31         /// draw two angular markers
32         void drawMarkers(MathPainterInfo & pi, int x, int y) const;
33         /// draw four angular markers
34         void drawMarkers2(MathPainterInfo & pi, int x, int y) const;
35         /// appends itself with macro arguments substituted
36         void substitute(MathMacro const & macro);
37         /// identifies NestInsets
38         MathNestInset * asNestInset() { return this; }
39
40         /// order of movement through the cells when pressing the left key
41         bool idxLeft(idx_type & idx, pos_type & pos) const;
42         /// order of movement through the cells when pressing the right key
43         bool idxRight(idx_type & idx, pos_type & pos) const;
44
45         /// move one physical cell up
46         bool idxNext(idx_type & idx, pos_type & pos) const;
47         /// move one physical cell down
48         bool idxPrev(idx_type & idx, pos_type & pos) const;
49
50         /// target pos when we enter the inset from the left by pressing "Right"
51         bool idxFirst(idx_type & idx, pos_type & pos) const;
52         /// target pos when we enter the inset from the right by pressing "Left"
53         bool idxLast(idx_type & idx, pos_type & pos) const;
54
55         /// where should we go if we press home?
56         bool idxHome(idx_type & idx, pos_type & pos) const;
57         /// where should we go if we press end?
58         bool idxEnd(idx_type & idx, pos_type & pos) const;
59
60         /// number of cells currently governed by us
61         idx_type nargs() const;
62         /// access to the lock
63         bool lock() const;
64         /// access to the lock
65         void lock(bool);
66         /// get notification when the cursor leaves this inset
67         void notifyCursorLeaves();
68
69         /// direct access to the cell
70         MathArray & cell(idx_type);
71         /// direct access to the cell
72         MathArray const & cell(idx_type) const;
73         /// direct access to the cell including the drawing cache
74         MathXArray & xcell(idx_type);
75         /// direct access to the cell including the drawing cache
76         MathXArray const & xcell(idx_type) const;
77
78         /// can we move into this cell (see macroarg.h)
79         bool isActive() const;
80         /// request "external features"
81         void validate(LaTeXFeatures & features) const;
82
83         /// match in all cells
84         bool match(MathInset *) const;
85         /// replace in all cells
86         void replace(ReplaceData &);
87         /// do we contain a given pattern?
88         bool contains(MathArray const &);
89         /// glue everything to a single cell
90         MathArray glue() const;
91
92         /// debug helper
93         void dump() const;
94         /// is the cursor currently somewhere within this inset?
95         virtual bool editing() const;
96
97 protected:
98         /// we store the cells in a vector
99         typedef std::vector<MathXArray> cells_type;
100         /// thusly:
101         cells_type cells_;
102         /// if the inset is locked, it can't be entered with the cursor
103         bool lock_;
104 };
105
106 #endif