]> git.lyx.org Git - lyx.git/blob - src/mathed/math_lefteqninset.C
forward search in math insets. ugly. seems to work. don't ask why.
[lyx.git] / src / mathed / math_lefteqninset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_lefteqninset.h"
6 #include "LColor.h"
7 #include "Painter.h"
8 #include "math_cursor.h"
9 #include "math_mathmlstream.h"
10
11
12 MathLefteqnInset::MathLefteqnInset()
13         : MathNestInset(1)
14 {}
15
16
17 MathInset * MathLefteqnInset::clone() const
18 {
19         return new MathLefteqnInset(*this);
20 }
21
22
23 void MathLefteqnInset::metrics(MathMetricsInfo const & mi) const
24 {
25         MathNestInset::metrics(mi);
26         ascent_  = xcell(0).ascent() + 2;
27         descent_ = xcell(0).descent() + 2;
28         width_   = 4;
29 }
30
31
32 void MathLefteqnInset::draw(Painter & pain, int x, int y) const
33 {
34         xcell(0).draw(pain, x + 2, y);
35         if (mathcursor && mathcursor->isInside(this)) {
36                 pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
37                         LColor::mathframe);
38         }
39 }
40
41
42 void MathLefteqnInset::write(WriteStream & os) const
43 {
44         os << "\\lefteqn{" << cell(0) << '}';
45 }
46
47
48 void MathLefteqnInset::normalize(NormalStream & os) const
49 {
50         os << "[lefteqn " << cell(0) << ']';
51 }