]> git.lyx.org Git - lyx.git/blob - src/mathed/math_nestinset.h
- fix nasty bug due to missing InsetFormula copy c'tor
[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(int na = 0, string const & nm = string());
20
21         ///
22         void metrics(MathStyles 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(MathArray & array, MathMacro const & macro) const;
27
28         /// The left key
29         bool idxLeft(int & idx, int & pos) const;
30         /// The right key
31         bool idxRight(int & idx, int & pos) const;
32
33         /// Move one physical cell up
34         bool idxNext(int & idx, int & pos) const;
35         /// Move one physical cell down
36         bool idxPrev(int & idx, int & pos) const;
37
38         /// Target pos when we enter the inset from the left by pressing "Right"
39         bool idxFirst(int & idx, int & pos) const;
40         /// Target pos when we enter the inset from the right by pressing "Left"
41         bool idxLast(int & idx, int & pos) const;
42
43         /// Where should we go if we press home?
44         bool idxHome(int & idx, int & pos) const;
45         /// Where should we go if we press end?
46         bool idxEnd(int & idx, int & pos) const;
47
48         ///
49         int nargs() const;
50
51         ///
52         MathArray & cell(int);
53         ///
54         MathArray const & cell(int) const;
55         ///
56         MathXArray & xcell(int);
57         ///
58         MathXArray const & xcell(int) const;
59                         
60         ///
61         bool isActive() const { return nargs() > 0; }
62         ///
63         void push_back(MathInset *);
64         ///
65         void push_back(unsigned char ch, MathTextCodes fcode);
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