1 #ifndef MATH_NESTINSET_H
2 #define MATH_NESTINSET_H
8 #include "math_diminset.h"
10 /** Abstract base class for all math objects that conatin nested items.
16 class MathNestInset : public MathDimInset {
19 explicit MathNestInset(idx_type ncells);
22 void metrics(MathMetricsInfo const & st) const;
23 /// draw the object, sets xo_ and yo_ cached values
24 void draw(Painter &, int x, int y) const;
25 /// appends itself with macro arguments substituted
26 void substitute(MathMacro const & macro);
27 /// identifies NestInsets
28 MathNestInset * asNestInset() { return this; }
31 bool idxLeft(idx_type & idx, pos_type & pos) const;
33 bool idxRight(idx_type & idx, pos_type & pos) const;
35 /// Move one physical cell up
36 bool idxNext(idx_type & idx, pos_type & pos) const;
37 /// Move one physical cell down
38 bool idxPrev(idx_type & idx, pos_type & pos) const;
40 /// Target pos when we enter the inset from the left by pressing "Right"
41 bool idxFirst(idx_type & idx, pos_type & pos) const;
42 /// Target pos when we enter the inset from the right by pressing "Left"
43 bool idxLast(idx_type & idx, pos_type & pos) const;
45 /// Where should we go if we press home?
46 bool idxHome(idx_type & idx, pos_type & pos) const;
47 /// Where should we go if we press end?
48 bool idxEnd(idx_type & idx, pos_type & pos) const;
51 idx_type nargs() const;
54 MathArray & cell(idx_type);
56 MathArray const & cell(idx_type) const;
58 MathXArray & xcell(idx_type);
60 MathXArray const & xcell(idx_type) const;
63 bool isActive() const { return nargs() > 0; }
65 void push_back(MathAtom const &);
70 void validate(LaTeXFeatures & features) const;
74 typedef std::vector<MathXArray> cells_type;
75 /// The nested contents of the inset are contained here.