7 #include "math_binaryopinset.h"
8 #include "MathPainterInfo.h"
9 #include "support/LOstream.h"
10 #include "math_support.h"
11 #include "math_mathmlstream.h"
17 MathBinaryOpInset::MathBinaryOpInset(char op)
18 : MathNestInset(2), op_(op)
22 MathInset * MathBinaryOpInset::clone() const
24 return new MathBinaryOpInset(*this);
28 int MathBinaryOpInset::opwidth() const
30 return mathed_char_width(LM_TC_CONST, mi_, op_);
34 void MathBinaryOpInset::metrics(MathMetricsInfo & mi) const
39 width_ = xcell(0).width() + xcell(1).width() + opwidth();
40 ascent_ = max(xcell(0).ascent(), xcell(1).ascent());
41 descent_ = max(xcell(0).descent(), xcell(1).descent());
45 void MathBinaryOpInset::draw(MathPainterInfo & pain, int x, int y) const
47 xcell(0).draw(pain, x, y);
48 drawChar(pain, LM_TC_CONST, mi_, x + xcell(0).width() , y, op_);
49 xcell(1).draw(pain, x + width() - xcell(1).width(), y);
53 void MathBinaryOpInset::write(WriteStream & os) const
55 os << '{' << cell(0) << op_ << cell(1) << '}';
59 void MathBinaryOpInset::normalize(NormalStream & os) const
61 os << "[binop " << op_ << ' ' << cell(0) << ' ' << cell(1) << ']';