5 #include "math_undersetinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
10 MathUndersetInset::MathUndersetInset()
14 MathInset * MathUndersetInset::clone() const
16 return new MathUndersetInset(*this);
20 void MathUndersetInset::metrics(MathMetricsInfo const & mi) const
22 MathMetricsInfo m = 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;
32 void MathUndersetInset::draw(Painter & pain, int x, int y) const
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);
41 void MathUndersetInset::write(WriteStream & os) const
43 os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
47 void MathUndersetInset::normalize(NormalStream & os) const
49 os << "[underset " << cell(0) << ' ' << cell(1) << ']';