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 /// add space for markers
26 void metricsMarkers(int frame = 1) const;
27 /// add space for markers
28 void metricsMarkers2(int frame = 1) 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 /// get cursor position
40 void getPos(idx_type idx, pos_type pos, int & x, int & y) const;
42 /// order of movement through the cells when pressing the left key
43 bool idxLeft(idx_type & idx, pos_type & pos) const;
44 /// order of movement through the cells when pressing the right key
45 bool idxRight(idx_type & idx, pos_type & pos) const;
47 /// move one physical cell up
48 bool idxNext(idx_type & idx, pos_type & pos) const;
49 /// move one physical cell down
50 bool idxPrev(idx_type & idx, pos_type & pos) const;
52 /// target pos when we enter the inset from the left by pressing "Right"
53 bool idxFirst(idx_type & idx, pos_type & pos) const;
54 /// target pos when we enter the inset from the right by pressing "Left"
55 bool idxLast(idx_type & idx, pos_type & pos) const;
57 /// where should we go if we press home?
58 bool idxHome(idx_type & idx, pos_type & pos) const;
59 /// where should we go if we press end?
60 bool idxEnd(idx_type & idx, pos_type & pos) const;
62 /// number of cells currently governed by us
63 idx_type nargs() const;
64 /// access to the lock
66 /// access to the lock
68 /// get notification when the cursor leaves this inset
69 void notifyCursorLeaves();
71 /// direct access to the cell
72 MathArray & cell(idx_type);
73 /// direct access to the cell
74 MathArray const & cell(idx_type) const;
75 /// direct access to the cell including the drawing cache
76 MathXArray & xcell(idx_type);
77 /// direct access to the cell including the drawing cache
78 MathXArray const & xcell(idx_type) const;
80 /// can we move into this cell (see macroarg.h)
81 bool isActive() const;
82 /// request "external features"
83 void validate(LaTeXFeatures & features) const;
85 /// match in all cells
86 bool match(MathInset *) const;
87 /// replace in all cells
88 void replace(ReplaceData &);
89 /// do we contain a given pattern?
90 bool contains(MathArray const &);
91 /// glue everything to a single cell
92 MathArray glue() const;
96 /// is the cursor currently somewhere within this inset?
97 virtual bool editing() const;
100 /// we store the cells in a vector
101 typedef std::vector<MathXArray> cells_type;
104 /// if the inset is locked, it can't be entered with the cursor