]> git.lyx.org Git - lyx.git/blob - src/mathed/math_casesinset.C
make operator<<(*stream, ...) free functions;
[lyx.git] / src / mathed / math_casesinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_casesinset.h"
6 #include "math_parser.h"
7 #include "math_mathmlstream.h"
8 #include "math_support.h"
9 #include "Painter.h"
10
11
12 MathCasesInset::MathCasesInset(row_type n)
13         : MathGridInset(2, n, 'c', "ll")
14 {}
15
16
17 MathInset * MathCasesInset::clone() const
18 {
19         return new MathCasesInset(*this);
20 }
21
22
23 void MathCasesInset::metrics(MathMetricsInfo const & mi) const
24 {
25         MathGridInset::metrics(mi);
26         width_ += 8;
27 }
28
29
30 void MathCasesInset::draw(Painter & pain, int x, int y) const
31
32         mathed_draw_deco(pain, x + 1, y - ascent(), 6, height(), "{");
33         MathGridInset::draw(pain, x + 8, y);
34 }
35
36
37 void MathCasesInset::write(WriteStream & os) const
38 {
39         if (os.fragile())
40                 os << "\\protect";
41         os << "\\begin{cases}";
42         MathGridInset::write(os);
43         if (os.fragile())
44                 os << "\\protect";
45         os << "\\end{cases}\n";
46 }
47
48
49 void MathCasesInset::normalize(NormalStream & os) const
50 {
51         os << "[cases ";
52         MathGridInset::normalize(os);
53         os << "]";
54 }
55
56
57 void MathCasesInset::maplize(MapleStream & os) const
58 {
59         os << "cases(";
60         MathGridInset::maplize(os);
61         os << ")";
62 }