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