]> git.lyx.org Git - lyx.git/blob - src/mathed/math_stackrelinset.C
some support for matrix operations with maple ('M-x math-extern maple evalm')
[lyx.git] / src / mathed / math_stackrelinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_stackrelinset.h"
6 #include "math_mathmlstream.h"
7 #include "math_support.h"
8
9
10 MathStackrelInset::MathStackrelInset()
11 {}
12
13
14 MathInset * MathStackrelInset::clone() const
15 {   
16         return new MathStackrelInset(*this);
17 }
18
19
20 void MathStackrelInset::metrics(MathMetricsInfo const & mi) const
21 {
22         MathMetricsInfo m = mi;
23         smallerStyleFrac(m);
24         xcell(0).metrics(m);
25         xcell(1).metrics(mi);
26         width_   = std::max(xcell(0).width(), xcell(1).width()) + 4; 
27         ascent_  = xcell(1).ascent() + xcell(0).height() + 4;
28         descent_ = xcell(1).descent();
29 }
30
31
32 void MathStackrelInset::draw(Painter & pain, int x, int y) const
33 {
34         int m = x + width() / 2;
35         xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).height() - 4);
36         xcell(1).draw(pain, m - xcell(1).width() / 2, y);
37 }
38
39
40 void MathStackrelInset::write(WriteStream & os) const
41 {
42         os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
43 }
44
45
46 void MathStackrelInset::normalize(NormalStream & os) const
47 {
48         os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';
49 }