]> git.lyx.org Git - lyx.git/blob - src/mathed/math_nestinset.h
further code uglification to make Jean-Marc's compiler happy
[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(unsigned int ncells);
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(MathMacro const & macro); 
27
28         /// The left key
29         bool idxLeft(unsigned int & idx, unsigned int & pos) const;
30         /// The right key
31         bool idxRight(unsigned int & idx, unsigned int & pos) const;
32
33         /// Move one physical cell up
34         bool idxNext(unsigned int & idx, unsigned int & pos) const;
35         /// Move one physical cell down
36         bool idxPrev(unsigned int & idx, unsigned int & pos) const;
37
38         /// Target pos when we enter the inset from the left by pressing "Right"
39         bool idxFirst(unsigned int & idx, unsigned int & pos) const;
40         /// Target pos when we enter the inset from the right by pressing "Left"
41         bool idxLast(unsigned int & idx, unsigned int & pos) const;
42
43         /// Where should we go if we press home?
44         bool idxHome(unsigned int & idx, unsigned int & pos) const;
45         /// Where should we go if we press end?
46         bool idxEnd(unsigned int & idx, unsigned int & pos) const;
47
48         ///
49         unsigned int nargs() const;
50
51         ///
52         MathArray & cell(unsigned int);
53         ///
54         MathArray const & cell(unsigned int) const;
55         ///
56         MathXArray & xcell(unsigned int);
57         ///
58         MathXArray const & xcell(unsigned int) const;
59                         
60         ///
61         bool isActive() const { return nargs() > 0; }
62         ///
63         void push_back(MathInset *);
64         ///
65         void dump() const;
66
67         ///
68         void validate(LaTeXFeatures & features) const;
69
70 protected:
71         ///
72         typedef std::vector<MathXArray> cells_type;
73         /// The nested contents of the inset are contained here.
74         cells_type cells_;
75 };
76
77 #endif