5 #include "math_stackrelinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
10 MathStackrelInset::MathStackrelInset()
14 MathInset * MathStackrelInset::clone() const
16 return new MathStackrelInset(*this);
20 void MathStackrelInset::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() + xcell(0).height() + 4;
28 descent_ = xcell(1).descent();
32 void MathStackrelInset::draw(Painter & pain, int x, int y) const
34 int m = x + width() / 2;
35 xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).height() - 4);
36 xcell(1).draw(pain, m - xcell(1).width() / 2, y);
40 void MathStackrelInset::write(WriteStream & os) const
42 os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
46 void MathStackrelInset::normalize(NormalStream & os) const
48 os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';