]> git.lyx.org Git - lyx.git/blob - src/mathed/math_lefteqninset.C
use stream-like syntax for LaTeX output
[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(MathWriteInfo & os) const
34 {
35         os << "\\lefteqn{" << cell(0) << "}";
36 }
37
38
39 void MathLefteqnInset::writeNormal(std::ostream & os) const
40 {
41         os << "[lefteqn ";
42         MathWriteInfo wi(os);
43         cell(0).write(wi);
44         os << "] ";
45 }
46
47
48 void MathLefteqnInset::metrics(MathMetricsInfo const & st) const
49 {
50         MathNestInset::metrics(st);
51         size_    = st;
52         ascent_  = xcell(0).ascent() + 2;
53         descent_ = xcell(0).descent() + 2;
54         width_   = 4;
55 }