]> git.lyx.org Git - lyx.git/blob - src/mathed/math_braceinset.C
don't #include too much stuff in .h
[lyx.git] / src / mathed / math_braceinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_braceinset.h"
8 #include "math_parser.h"
9 #include "support.h"
10 #include "math_mathmlstream.h"
11
12
13 MathBraceInset::MathBraceInset()
14         : MathNestInset(1)
15 {}
16
17
18 MathInset * MathBraceInset::clone() const
19 {   
20         return new MathBraceInset(*this);
21 }
22
23
24 void MathBraceInset::write(MathWriteInfo & os) const
25 {
26         os << '{' << cell(0) << '}';
27 }
28
29
30 void MathBraceInset::writeNormal(NormalStream & os) const
31 {
32         os << "[block ";
33         cell(0).writeNormal(os);
34         os << "]";
35 }
36
37
38 void MathBraceInset::metrics(MathMetricsInfo const & mi) const
39 {
40         xcell(0).metrics(mi);
41         int a, d;
42         mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_);
43         ascent_  = std::max(xcell(0).ascent(), a);
44         descent_ = std::max(xcell(0).descent(), a);
45         width_   = xcell(0).width() + 2 * wid_;
46 }
47
48
49 void MathBraceInset::draw(Painter & pain, int x, int y) const
50
51         drawChar(pain, LM_TC_TEX, mi_, x, y, '{');
52         xcell(0).draw(pain, x + wid_, y);
53         drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}');
54 }