]> git.lyx.org Git - lyx.git/blob - src/mathed/math_undersetinset.C
whichFont down to 5.3%
[lyx.git] / src / mathed / math_undersetinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_undersetinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
8
9
10 MathUndersetInset::MathUndersetInset()
11 {}
12
13
14 MathInset * MathUndersetInset::clone() const
15 {   
16         return new MathUndersetInset(*this);
17 }
18
19
20 void MathUndersetInset::metrics(MathMetricsInfo const & mi) const
21 {
22         MathMetricsInfo m = mi;
23         smallerStyleFrac(m);
24         xcell(0).metrics(m);
25         xcell(1).metrics(mi);
26         width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
27         ascent_  = xcell(1).ascent();
28         descent_ = xcell(1).descent() + xcell(0).height() + 4;
29 }
30
31
32 void MathUndersetInset::draw(Painter & pain, int x, int y) const
33 {
34         int m  = x + width() / 2;
35         int yo = y + xcell(1).descent() + xcell(0).ascent() + 1;
36         xcell(0).draw(pain, m - xcell(0).width() / 2, yo);
37         xcell(1).draw(pain, m - xcell(1).width() / 2, y);
38 }
39
40
41 void MathUndersetInset::write(WriteStream & os) const
42 {
43         os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
44 }
45
46
47 void MathUndersetInset::normalize(NormalStream & os) const
48 {
49         os << "[underset " << cell(0) << ' ' << cell(1) << ']';
50 }