5 #include "math_binominset.h"
6 #include "math_support.h"
7 #include "support/LOstream.h"
8 #include "math_mathmlstream.h"
11 MathBinomInset::MathBinomInset()
15 MathInset * MathBinomInset::clone() const
17 return new MathBinomInset(*this);
21 int MathBinomInset::dw() const
32 void MathBinomInset::metrics(MathMetricsInfo const & st) const
34 MathMetricsInfo mi = st;
38 ascent_ = xcell(0).height() + 4 + 5;
39 descent_ = xcell(1).height() + 4 - 5;
40 width_ = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4;
44 void MathBinomInset::draw(Painter & pain, int x, int y) const
46 int m = x + width() / 2;
47 xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
48 xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5);
49 mathed_draw_deco(pain, x, y - ascent_, dw(), height(), "(");
50 mathed_draw_deco(pain, x + width() - dw(), y - ascent_, dw(), height(), ")");
54 void MathBinomInset::write(WriteStream & os) const
56 os << '{' << cell(0) << " \\choose " << cell(1) << '}';
60 void MathBinomInset::normalize(NormalStream & os) const
62 os << "[binom " << cell(0) << ' ' << cell(1) << ']';