]> git.lyx.org Git - lyx.git/blob - src/mathed/math_xiter.h
mathed34.diff
[lyx.git] / src / mathed / math_xiter.h
1 // -*- C++ -*-
2 #ifndef MATH_XITER_H
3 #define MATH_XITER_H
4
5 #include "math_iter.h"
6
7 class MathedRowSt;
8 class MathParInset;
9
10 /**
11    A graphic iterator (updates position.) Used for
12    metrics and updating cursor position
13 */
14 class MathedXIter: public MathedIter {
15 public:
16         ///
17         MathedXIter();
18         //
19         MathedXIter(MathParInset *);
20         ///
21         void SetData(MathParInset *);
22         ///
23         MathParInset * getPar() const;
24         ///
25         virtual bool Next();
26         ///
27         bool Prev();
28         ///
29         bool Up();
30         ///
31         bool Down();
32         ///
33         void goNextColumn();
34         ///
35         void GoLast();
36         ///
37         void GoBegin();
38         ///
39         void Adjust();
40         ///
41         void GetPos(int &, int &) const;
42         ///
43         void GetIncPos(int &, int &) const;
44         ///
45         string const GetString() const;
46         ///
47         int GetX() const;
48         ///
49         int GetY() const;
50         ///
51         void subMetrics(int, int);
52         ///
53         void fitCoord(int, int);
54         /// 
55         void getAD(int & a, int & d) const;
56         
57         /// Create a new row and insert #ncols# tabs.
58         void addRow();
59         ///
60         void delRow();
61         
62         ///
63         bool setLabel(string const & label);
64         ///
65         static string error_label;
66         ///
67         string const & getLabel() const;
68         ///
69         bool setNumbered(bool);
70         
71         ///
72         void setTab(int, int);
73         /// Merge the array at current position
74         void Merge(MathedArray *);
75         /// Delete every object from current position to pos2
76         void Clean(int pos2);
77         ///
78         MathedRowSt * adjustVerticalSt();
79         ///
80         virtual void ipush();
81         ///
82         virtual void ipop();
83         ///
84         MathedRowSt * currentRow() {
85                 return crow_;
86         }
87         
88 private:
89         /// This function is not recursive, as MathPar::Metrics is
90         void IMetrics(int, int &, int &, int &);
91         /// Font size (display, text, script, script2) 
92         int size_;
93         /// current position
94         mutable int x_;
95         ///
96         int y_;
97         ///
98         MathParInset * p_;
99         
100         // Limits auxiliary variables
101         /// Position and max width of a script
102         int sx_;
103         ///
104         int sw_;
105         /// true= center, false= left align (default)
106         bool limits_;
107         /// 
108         MathedRowSt * crow_;
109         
110         ///
111         //friend class MathedCursor;
112 };
113 #endif