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