]> git.lyx.org Git - lyx.git/blob - src/mathed/math_binaryopinset.C
the doxygen patch
[lyx.git] / src / mathed / math_binaryopinset.C
1 #include <config.h>
2
3
4 #include "math_binaryopinset.h"
5 #include "PainterInfo.h"
6 #include "support/LOstream.h"
7 #include "math_support.h"
8 #include "math_mathmlstream.h"
9
10
11 using std::max;
12
13
14 MathBinaryOpInset::MathBinaryOpInset(char op)
15         : MathNestInset(2), op_(op)
16 {}
17
18
19 InsetBase * MathBinaryOpInset::clone() const
20 {
21         return new MathBinaryOpInset(*this);
22 }
23
24
25 int MathBinaryOpInset::opwidth() const
26 {
27         return mathed_char_width(LM_TC_CONST, mi_, op_);
28 }
29
30
31 #warning Andre, have a look here. (Lgb)
32 #if 0
33 // That this is not declared in class MathBinaryOpInset makes
34 // Doxygen give warnings. (Lgb)
35 void MathBinaryOpInset::metrics(MetricsInfo & mi, Dimension & dim) const
36 {
37         mi_ = mi;
38         cell(0).metrics(mi);
39         cell(1).metrics(mi);
40         width_   = cell(0).width() + cell(1).width() + opwidth();
41         ascent_  = max(cell(0).ascent(),  cell(1).ascent());
42         descent_ = max(cell(0).descent(), cell(1).descent());
43 }
44 #endif
45
46 void MathBinaryOpInset::draw(PainterInfo & pain, int x, int y) const
47 {
48         cell(0).draw(pain, x, y);
49         drawChar(pain, LM_TC_CONST, mi_, x + cell(0).width() , y, op_);
50         cell(1).draw(pain, x + width() - cell(1).width(), y);
51 }
52
53
54 void MathBinaryOpInset::write(WriteStream & os) const
55 {
56         os << '{' << cell(0) << op_ << cell(1) << '}';
57 }
58
59
60 void MathBinaryOpInset::normalize(NormalStream & os) const
61 {
62         os << "[binop " << op_ << ' ' << cell(0) << ' ' << cell(1) << ']';
63 }