]> git.lyx.org Git - lyx.git/blob - src/mathed/math_metricsinfo.h
remove a few unneeded 'include'
[lyx.git] / src / mathed / math_metricsinfo.h
1 #ifndef MATH_METRICSINFO_H
2 #define MATH_METRICSINFO_H
3
4 #include "lyxfont.h"
5 #include "LString.h"
6
7 class Painter;
8
9
10 /// Standard Math Sizes (Math mode styles)
11 enum MathStyles {
12         ///
13         LM_ST_DISPLAY = 0,
14         ///
15         LM_ST_TEXT,
16         ///
17         LM_ST_SCRIPT,
18         ///
19         LM_ST_SCRIPTSCRIPT
20 };
21
22
23 struct MathMetricsBase {
24         ///
25         MathMetricsBase();
26
27         ///
28         LyXFont font;
29         ///
30         MathStyles style;
31         ///
32         string fontname;
33         /// if this is set...
34         bool restrictwidth;
35         /// ... this is valid
36         int textwidth;
37 };
38
39
40 struct MathMetricsInfo {
41         ///
42         MathMetricsInfo();
43
44         ///
45         MathMetricsBase base;
46         ///
47         bool fullredraw;
48 };
49
50
51 struct MathPainterInfo {
52         ///
53         MathPainterInfo(Painter & pain);
54         ///
55         void draw(int x, int y, char c);
56
57         ///
58         MathMetricsBase base;
59         ///
60         Painter & pain;
61 };
62
63
64 struct TextMetricsInfo {};
65
66
67 // Generic base for temporarily changing things.
68 // The original state gets restored when the Changer is destructed
69 template <class Struct, class Temp = Struct>
70 struct MathChanger {
71         ///
72         MathChanger(Struct & orig) : orig_(orig) {}
73 protected:
74         ///
75         Struct & orig_;
76         ///
77         Temp save_;
78 };
79
80
81
82 struct MathScriptChanger : public MathChanger<MathMetricsBase> {
83         ///
84         MathScriptChanger(MathMetricsBase & orig);
85         ///
86         ~MathScriptChanger();
87 };
88
89
90 struct MathFracChanger : public MathChanger<MathMetricsBase> {
91         ///
92         MathFracChanger(MathMetricsBase & orig);
93         ///
94         ~MathFracChanger();
95 };
96
97
98
99 struct MathFontChanger : public MathChanger<LyXFont> {
100         ///
101         MathFontChanger(LyXFont & orig, char const * font);
102         ///
103         ~MathFontChanger();
104 };
105
106
107 struct MathFontSetChanger : public MathChanger<MathMetricsBase> {
108         ///
109         MathFontSetChanger(MathMetricsBase & mb, char const * font);
110         ///
111         ~MathFontSetChanger();
112 };
113
114
115 struct MathStyleChanger : public MathChanger<MathMetricsBase> {
116         ///
117         MathStyleChanger(MathMetricsBase & mb, MathStyles shape);
118         ///
119         ~MathStyleChanger();
120 };
121
122
123 struct MathShapeChanger : public MathChanger<LyXFont, LyXFont::FONT_SHAPE> {
124         ///
125         MathShapeChanger(LyXFont & font, LyXFont::FONT_SHAPE shape);
126         ///
127         ~MathShapeChanger();
128 };
129
130
131 struct MathWidthChanger : public MathChanger<MathMetricsBase>
132 {
133         ///
134         MathWidthChanger(MathMetricsBase & mb, int width);
135         ///
136         ~MathWidthChanger();
137 };
138
139
140 #endif