5 #include "math_binominset.h"
7 #include "support/LOstream.h"
10 MathBinomInset::MathBinomInset()
14 MathInset * MathBinomInset::clone() const
16 return new MathBinomInset(*this);
20 int MathBinomInset::dw() const
31 void MathBinomInset::metrics(MathMetricsInfo const & st) const
33 MathMetricsInfo mi = st;
37 ascent_ = xcell(0).height() + 4 + 5;
38 descent_ = xcell(1).height() + 4 - 5;
39 width_ = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4;
43 void MathBinomInset::draw(Painter & pain, int x, int y) const
47 int m = x + width() / 2;
48 xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
49 xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5);
50 mathed_draw_deco(pain, x, y - ascent_, dw(), height(), "(");
51 mathed_draw_deco(pain, x + width() - dw(), y - ascent_, dw(), height(), ")");
55 void MathBinomInset::write(MathWriteInfo & os) const
57 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
61 void MathBinomInset::writeNormal(std::ostream & os) const
64 cell(0).writeNormal(os);
66 cell(1).writeNormal(os);