]> git.lyx.org Git - lyx.git/blob - src/mathed/math_lefteqninset.C
some visual support for \lefteqn
[lyx.git] / src / mathed / math_lefteqninset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_lefteqninset.h"
6 #include "support/LOstream.h"
7 #include "LColor.h"
8 #include "Painter.h"
9 #include "math_cursor.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::draw(Painter & pain, int x, int y) const
24 {
25         xcell(0).draw(pain, x + 2, y);
26         if (mathcursor && mathcursor->isInside(this)) {
27                 pain.rectangle(x, y - ascent(), xcell(0).width(), height(),
28                         LColor::mathframe);
29         }
30 }
31
32
33 void MathLefteqnInset::write(std::ostream & os, bool fragile) const
34 {
35         os << "\\lefteqn{";
36         cell(0).write(os, fragile);
37         os << "}";
38 }
39
40
41 void MathLefteqnInset::writeNormal(std::ostream & os) const
42 {
43         os << "[lefteqn ";
44         cell(0).write(os, false);
45         os << "] ";
46 }
47
48
49 void MathLefteqnInset::metrics(MathStyles st) const
50 {
51         MathNestInset::metrics(st);
52         size_    = st;
53         ascent_  = xcell(0).ascent() + 2;
54         descent_ = xcell(0).descent() + 2;
55         width_   = 4;
56 }