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(MathStyles st) const
33 size_ = smallerStyleFrac(st);
34 xcell(0).metrics(size_);
35 xcell(1).metrics(size_);
36 ascent_ = xcell(0).height() + 4 + 5;
37 descent_ = xcell(1).height() + 4 - 5;
38 width_ = std::max(xcell(0).width(), xcell(1).width()) + 2 * dw() + 4;
42 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(std::ostream & os, bool fragile) const
57 cell(0).write(os, fragile);
59 cell(1).write(os, fragile);
64 void MathBinomInset::writeNormal(std::ostream & os) const
67 cell(0).writeNormal(os);
69 cell(1).writeNormal(os);