5 #include "math_binominset.h"
6 #include "math_parser.h"
8 #include "support/LOstream.h"
11 MathBinomInset::MathBinomInset()
15 MathInset * MathBinomInset::clone() const
17 return new MathBinomInset(*this);
21 int MathBinomInset::dw() const
32 void MathBinomInset::metrics(MathStyles st) const
34 size_ = smallerStyleFrac(st);
35 xcell(0).metrics(size_);
36 xcell(1).metrics(size_);
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_,
51 dw(), height(), in_word_set("("));
52 mathed_draw_deco(pain, x + width() - dw(), y - ascent_,
53 dw(), height(), in_word_set(")"));
57 void MathBinomInset::write(std::ostream & os, bool fragile) const
60 cell(0).write(os, fragile);
62 cell(1).write(os, fragile);
67 void MathBinomInset::writeNormal(std::ostream & os) const
70 cell(0).writeNormal(os);
72 cell(1).writeNormal(os);