]> git.lyx.org Git - lyx.git/blob - src/mathed/math_undersetinset.C
fix typo that put too many include paths for most people
[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 using std::max;
11
12
13 MathUndersetInset::MathUndersetInset()
14 {}
15
16
17 MathInset * MathUndersetInset::clone() const
18 {
19         return new MathUndersetInset(*this);
20 }
21
22
23 void MathUndersetInset::metrics(MathMetricsInfo const & mi) const
24 {
25         MathMetricsInfo m = mi;
26         smallerStyleFrac(m);
27         xcell(0).metrics(m);
28         xcell(1).metrics(mi);
29         width_   = max(xcell(0).width(), xcell(1).width()) + 4;
30         ascent_  = xcell(1).ascent();
31         descent_ = xcell(1).descent() + xcell(0).height() + 4;
32 }
33
34
35 void MathUndersetInset::draw(Painter & pain, int x, int y) const
36 {
37         int m  = x + width() / 2;
38         int yo = y + xcell(1).descent() + xcell(0).ascent() + 1;
39         xcell(0).draw(pain, m - xcell(0).width() / 2, yo);
40         xcell(1).draw(pain, m - xcell(1).width() / 2, y);
41 }
42
43
44 void MathUndersetInset::write(WriteStream & os) const
45 {
46         os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
47 }
48
49
50 void MathUndersetInset::normalize(NormalStream & os) const
51 {
52         os << "[underset " << cell(0) << ' ' << cell(1) << ']';
53 }