]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathBox.h
simplify GuiToc / TocWidget interaction. Much can still be simplified...
[lyx.git] / src / mathed / InsetMathBox.h
1 // -*- C++ -*-
2 /**
3  * \file InsetMathBox.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author André Pönitz
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef MATH_BOXINSET_H
13 #define MATH_BOXINSET_H
14
15 #include "InsetMathNest.h"
16
17 #include <string>
18
19
20 namespace lyx {
21
22 /// Support for \\mbox
23 class InsetMathBox : public InsetMathNest {
24 public:
25         ///
26         explicit InsetMathBox(docstring const & name);
27         ///
28         mode_type currentMode() const { return TEXT_MODE; }
29         ///
30         void metrics(MetricsInfo & mi, Dimension & dim) const;
31         ///
32         void draw(PainterInfo & pi, int x, int y) const;
33         ///
34         void write(WriteStream & os) const;
35         ///
36         void normalize(NormalStream & ns) const;
37         ///
38         void infoize(odocstream & os) const;
39
40 private:
41         Inset * clone() const { return new InsetMathBox(*this); }
42         ///
43         docstring name_;
44 };
45
46
47 /// Non-AMS-style frame
48 class InsetMathFBox : public InsetMathNest {
49 public:
50         ///
51         InsetMathFBox();
52         ///
53         mode_type currentMode() const { return TEXT_MODE; }
54         ///
55         void metrics(MetricsInfo & mi, Dimension & dim) const;
56         ///
57         void draw(PainterInfo & pi, int x, int y) const;
58         ///
59         void write(WriteStream & os) const;
60         /// write normalized content
61         void normalize(NormalStream & ns) const;
62         ///
63         void infoize(odocstream & os) const;
64 private:
65         ///
66         Inset * clone() const { return new InsetMathFBox(*this); }
67 };
68
69
70 /// Extra nesting
71 class InsetMathFrameBox : public InsetMathNest {
72 public:
73         ///
74         InsetMathFrameBox();
75         ///
76         void metrics(MetricsInfo & mi, Dimension & dim) const;
77         ///
78         void draw(PainterInfo & pi, int x, int y) const;
79         ///
80         void write(WriteStream & os) const;
81         /// write normalized content
82         void normalize(NormalStream & ns) const;
83         ///
84         mode_type currentMode() const { return TEXT_MODE; }
85 private:
86         Inset * clone() const { return new InsetMathFrameBox(*this); }
87         /// width of '[' in current font
88         mutable int w_;
89 };
90
91
92 /// Extra nesting: \\makebox.
93 // consolidate with InsetMathFrameBox?
94 class InsetMathMakebox : public InsetMathNest {
95 public:
96         ///
97         InsetMathMakebox();
98         ///
99         void metrics(MetricsInfo & mi, Dimension & dim) const;
100         ///
101         void draw(PainterInfo & pi, int x, int y) const;
102         ///
103         void write(WriteStream & os) const;
104         /// write normalized content
105         void normalize(NormalStream & ns) const;
106         ///
107         mode_type currentMode() const { return TEXT_MODE; }
108         ///
109         void infoize(odocstream & os) const;
110 private:
111         Inset * clone() const { return new InsetMathMakebox(*this); }
112         /// width of '[' in current font
113         mutable int w_;
114 };
115
116
117
118 /// AMS-style frame
119 class InsetMathBoxed : public InsetMathNest {
120 public:
121         ///
122         InsetMathBoxed();
123         ///
124         void validate(LaTeXFeatures & features) const;
125         ///
126         void metrics(MetricsInfo & mi, Dimension & dim) const;
127         ///
128         void draw(PainterInfo & pi, int x, int y) const;
129         ///
130         void write(WriteStream & os) const;
131         /// write normalized content
132         void normalize(NormalStream & ns) const;
133         ///
134         void infoize(odocstream & os) const;
135 private:
136         Inset * clone() const { return new InsetMathBoxed(*this); }
137 };
138
139
140 } // namespace lyx
141
142 #endif // MATH_MBOX