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"
14 MathXArrowInset::MathXArrowInset(string const & name)
15 : MathFracbaseInset(), name_(name)
19 MathInset * MathXArrowInset::clone() const
21 return new MathXArrowInset(*this);
25 void MathXArrowInset::metrics(MathMetricsInfo & mi) const
27 MathScriptChanger dummy(mi.base);
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();
36 void MathXArrowInset::draw(MathPainterInfo & pi, int x, int y) const
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_);
45 void MathXArrowInset::write(WriteStream & os) const
49 os << '[' << cell(1) << ']';
50 os << '{' << cell(0) << '}';
54 void MathXArrowInset::normalize(NormalStream & os) const
56 os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';