7 #include "math_binominset.h"
8 #include "math_support.h"
9 #include "support/LOstream.h"
10 #include "math_mathmlstream.h"
13 MathBinomInset::MathBinomInset()
17 MathInset * MathBinomInset::clone() const
19 return new MathBinomInset(*this);
23 int MathBinomInset::dw() const
34 void MathBinomInset::metrics(MathMetricsInfo const & st) const
36 MathMetricsInfo mi = st;
40 ascent_ = xcell(0).height() + 4 + 5;
41 descent_ = xcell(1).height() + 4 - 5;
42 width_ = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4;
46 void MathBinomInset::draw(Painter & pain, int x, int y) const
48 int m = x + width() / 2;
49 xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
50 xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5);
51 mathed_draw_deco(pain, x, y - ascent_, dw(), height(), "(");
52 mathed_draw_deco(pain, x + width() - dw(), y - ascent_, dw(), height(), ")");
56 void MathBinomInset::write(WriteStream & os) const
58 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
62 void MathBinomInset::normalize(NormalStream & os) const
64 os << "[binom " << cell(0) << ' ' << cell(1) << ']';