7 #include "math_binominset.h"
8 #include "math_support.h"
9 #include "support/LOstream.h"
10 #include "math_mathmlstream.h"
16 MathBinomInset::MathBinomInset()
20 MathInset * MathBinomInset::clone() const
22 return new MathBinomInset(*this);
26 int MathBinomInset::dw() const
37 void MathBinomInset::metrics(MathMetricsInfo & mi) const
39 MathScriptChanger(mi.base);
42 ascent_ = xcell(0).height() + 4 + 5;
43 descent_ = xcell(1).height() + 4 - 5;
44 width_ = max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4;
48 void MathBinomInset::draw(MathPainterInfo & pi, int x, int y) const
50 int m = x + width() / 2;
51 MathScriptChanger(pi.base);
52 xcell(0).draw(pi, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
53 xcell(1).draw(pi, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5);
54 mathed_draw_deco(pi, x, y - ascent_, dw(), height(), "(");
55 mathed_draw_deco(pi, x + width() - dw(), y - ascent_, dw(), height(), ")");
59 void MathBinomInset::write(WriteStream & os) const
61 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
65 void MathBinomInset::normalize(NormalStream & os) const
67 os << "[binom " << cell(0) << ' ' << cell(1) << ']';