1 #ifndef MATH_NESTINSET_H
2 #define MATH_NESTINSET_H
8 #include "math_diminset.h"
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
18 class MathNestInset : public MathDimInset {
20 /// nestinsets have a fixed size to start with
21 explicit MathNestInset(idx_type ncells);
23 /// the size is usuall some sort of convex hull of the cells
24 void metrics(MathMetricsInfo const & mi) const;
25 /// draw background if locked
26 void draw(MathPainterInfo & pi, int x, int y) const;
27 /// draw two angular markers
28 void drawMarkers(MathPainterInfo & pi, int x, int y) const;
29 /// draw four angular markers
30 void drawMarkers2(MathPainterInfo & pi, int x, int y) const;
31 /// appends itself with macro arguments substituted
32 void substitute(MathMacro const & macro);
33 /// identifies NestInsets
34 MathNestInset * asNestInset() { return this; }
36 /// order of movement through the cells when pressing the left key
37 bool idxLeft(idx_type & idx, pos_type & pos) const;
38 /// order of movement through the cells when pressing the right key
39 bool idxRight(idx_type & idx, pos_type & pos) const;
41 /// move one physical cell up
42 bool idxNext(idx_type & idx, pos_type & pos) const;
43 /// move one physical cell down
44 bool idxPrev(idx_type & idx, pos_type & pos) const;
46 /// target pos when we enter the inset from the left by pressing "Right"
47 bool idxFirst(idx_type & idx, pos_type & pos) const;
48 /// target pos when we enter the inset from the right by pressing "Left"
49 bool idxLast(idx_type & idx, pos_type & pos) const;
51 /// where should we go if we press home?
52 bool idxHome(idx_type & idx, pos_type & pos) const;
53 /// where should we go if we press end?
54 bool idxEnd(idx_type & idx, pos_type & pos) const;
56 /// number of cells currently governed by us
57 idx_type nargs() const;
58 /// access to the lock
60 /// access to the lock
62 /// get notification when the cursor leaves this inset
63 void notifyCursorLeaves();
65 /// direct access to the cell
66 MathArray & cell(idx_type);
67 /// direct access to the cell
68 MathArray const & cell(idx_type) const;
69 /// direct access to the cell including the drawing cache
70 MathXArray & xcell(idx_type);
71 /// direct access to the cell including the drawing cache
72 MathXArray const & xcell(idx_type) const;
74 /// can we move into this cell (see macroarg.h)
75 bool isActive() const;
76 /// request "external features"
77 void validate(LaTeXFeatures & features) const;
79 /// match in all cells
80 bool match(MathInset *) const;
81 /// replace in all cells
82 void replace(ReplaceData &);
83 /// do we contain a given pattern?
84 bool contains(MathArray const &);
85 /// glue everything to a single cell
86 MathArray glue() const;
90 /// is the cursor currently somewhere within this inset?
91 virtual bool editing() const;
94 /// we store the cells in a vector
95 typedef std::vector<MathXArray> cells_type;
98 /// if the inset is locked, it can't be entered with the cursor