]> git.lyx.org Git - lyx.git/blob - src/mathed/math_xarrowinset.C
small up/down tweaking
[lyx.git] / src / mathed / math_xarrowinset.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_xarrowinset.h"
8 #include "math_support.h"
9 #include "math_parser.h"
10 #include "math_mathmlstream.h"
11 #include "math_streamstr.h"
12
13
14 MathXArrowInset::MathXArrowInset(string const & name)
15         : MathFracbaseInset(), name_(name)
16 {}
17
18
19 MathInset * MathXArrowInset::clone() const
20 {
21         return new MathXArrowInset(*this);
22 }
23
24
25 void MathXArrowInset::metrics(MathMetricsInfo & mi) const
26 {
27         MathScriptChanger dummy(mi.base);
28         cell(0).metrics(mi);
29         cell(1).metrics(mi);
30         dim_.w = std::max(cell(0).width(), cell(1).width()) + 10;
31         dim_.a = cell(0).height() + 10;
32         dim_.d = cell(1).height();
33 }
34
35
36 void MathXArrowInset::draw(MathPainterInfo & pi, int x, int y) const
37 {
38         MathScriptChanger dummy(pi.base);
39         cell(0).draw(pi, x + 5, y - 10);
40         cell(1).draw(pi, x + 5, y + cell(1).height());
41         mathed_draw_deco(pi, x + 1, y - 7, width() - 2, 5, name_);
42 }
43
44
45 void MathXArrowInset::write(WriteStream & os) const
46 {
47         os << '\\' << name_;
48         if (cell(1).size())
49                 os << '[' << cell(1) << ']';
50         os << '{' << cell(0) << '}';
51 }
52
53
54 void MathXArrowInset::normalize(NormalStream & os) const
55 {
56         os << "[xarrow " << name_ << ' ' <<  cell(0) << ' ' << cell(1) << ']';
57 }