]> git.lyx.org Git - lyx.git/blob - src/mathed/math_nestinset.h
use stream-like syntax for LaTeX output
[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 conatin nested items.
11 */
12
13
14 class LaTeXFeatures;
15
16 class MathNestInset : public MathDimInset {
17 public: 
18         ///
19         explicit MathNestInset(idx_type ncells);
20
21         ///
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; }
29
30         /// The left key
31         bool idxLeft(idx_type & idx, pos_type & pos) const;
32         /// The right key
33         bool idxRight(idx_type & idx, pos_type & pos) const;
34
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;
39
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;
44
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;
49
50         ///
51         idx_type nargs() const;
52
53         ///
54         MathArray & cell(idx_type);
55         ///
56         MathArray const & cell(idx_type) const;
57         ///
58         MathXArray & xcell(idx_type);
59         ///
60         MathXArray const & xcell(idx_type) const;
61                         
62         ///
63         bool isActive() const { return nargs() > 0; }
64         ///
65         void push_back(MathAtom const &);
66         ///
67         void dump() const;
68
69         ///
70         void validate(LaTeXFeatures & features) const;
71
72 protected:
73         ///
74         typedef std::vector<MathXArray> cells_type;
75         /// The nested contents of the inset are contained here.
76         cells_type cells_;
77 };
78
79 #endif