5 #include "math_stackrelinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
13 MathStackrelInset::MathStackrelInset()
17 MathInset * MathStackrelInset::clone() const
19 return new MathStackrelInset(*this);
23 void MathStackrelInset::metrics(MathMetricsInfo const & mi) const
25 MathMetricsInfo m = mi;
29 width_ = max(xcell(0).width(), xcell(1).width()) + 4;
30 ascent_ = xcell(1).ascent() + xcell(0).height() + 4;
31 descent_ = xcell(1).descent();
35 void MathStackrelInset::draw(Painter & pain, int x, int y) const
37 int m = x + width() / 2;
38 int yo = y - xcell(1).ascent() - xcell(0).descent() - 1;
39 xcell(0).draw(pain, m - xcell(0).width() / 2, yo);
40 xcell(1).draw(pain, m - xcell(1).width() / 2, y);
44 void MathStackrelInset::write(WriteStream & os) const
46 os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
50 void MathStackrelInset::normalize(NormalStream & os) const
52 os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';