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