7 #include "math_binominset.h"
8 #include "math_support.h"
9 #include "support/LOstream.h"
10 #include "math_mathmlstream.h"
16 MathBinomInset::MathBinomInset(bool choose)
21 MathInset * MathBinomInset::clone() const
23 return new MathBinomInset(*this);
27 int MathBinomInset::dw() const
38 void MathBinomInset::metrics(MathMetricsInfo & mi) const
40 MathScriptChanger dummy(mi.base);
43 dim_.a = cell(0).height() + 4 + 5;
44 dim_.d = cell(1).height() + 4 - 5;
45 dim_.w = max(cell(0).width(), cell(1).width()) + 2 * dw() + 4;
49 void MathBinomInset::draw(MathPainterInfo & pi, int x, int y) const
51 int m = x + width() / 2;
52 MathScriptChanger dummy(pi.base);
53 cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 3 - 5);
54 cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 3 - 5);
55 mathed_draw_deco(pi, x, y - ascent(), dw(), height(), "(");
56 mathed_draw_deco(pi, x + width() - dw(), y - ascent(), dw(), height(), ")");
60 void MathBinomInset::write(WriteStream & os) const
63 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
65 os << "\\binom{" << cell(0) << "}{" << cell(1) << '}';
69 void MathBinomInset::normalize(NormalStream & os) const
71 os << "[binom " << cell(0) << ' ' << cell(1) << ']';