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 angular markers
28 void drawMarkers(MathPainterInfo & pi, int x, int y) const;
29 /// appends itself with macro arguments substituted
30 void substitute(MathMacro const & macro);
31 /// identifies NestInsets
32 MathNestInset * asNestInset() { return this; }
34 /// order of movement through the cells when pressing the left key
35 bool idxLeft(idx_type & idx, pos_type & pos) const;
36 /// order of movement through the cells when pressing the right key
37 bool idxRight(idx_type & idx, pos_type & pos) const;
39 /// move one physical cell up
40 bool idxNext(idx_type & idx, pos_type & pos) const;
41 /// move one physical cell down
42 bool idxPrev(idx_type & idx, pos_type & pos) const;
44 /// target pos when we enter the inset from the left by pressing "Right"
45 bool idxFirst(idx_type & idx, pos_type & pos) const;
46 /// target pos when we enter the inset from the right by pressing "Left"
47 bool idxLast(idx_type & idx, pos_type & pos) const;
49 /// where should we go if we press home?
50 bool idxHome(idx_type & idx, pos_type & pos) const;
51 /// where should we go if we press end?
52 bool idxEnd(idx_type & idx, pos_type & pos) const;
54 /// number of cells currently governed by us
55 idx_type nargs() const;
56 /// access to the lock
58 /// access to the lock
60 /// get notification when the cursor leaves this inset
61 void notifyCursorLeaves();
63 /// direct access to the cell
64 MathArray & cell(idx_type);
65 /// direct access to the cell
66 MathArray const & cell(idx_type) const;
67 /// direct access to the cell including the drawing cache
68 MathXArray & xcell(idx_type);
69 /// direct access to the cell including the drawing cache
70 MathXArray const & xcell(idx_type) const;
72 /// can we move into this cell (see macroarg.h)
73 bool isActive() const;
74 /// request "external features"
75 void validate(LaTeXFeatures & features) const;
77 /// match in all cells
78 bool match(MathInset *) const;
79 /// replace in all cells
80 void replace(ReplaceData &);
81 /// do we contain a given pattern?
82 bool contains(MathArray const &);
83 /// glue everything to a single cell
84 MathArray glue() const;
88 /// is the cursor currently somewhere within this inset?
89 virtual bool editing() const;
92 /// we store the cells in a vector
93 typedef std::vector<MathXArray> cells_type;
96 /// if the inset is locked, it can't be entered with the cursor