4 #include "math_xarrowinset.h"
5 #include "math_support.h"
6 #include "math_parser.h"
7 #include "math_mathmlstream.h"
8 #include "math_streamstr.h"
11 MathXArrowInset::MathXArrowInset(string const & name)
12 : MathFracbaseInset(), name_(name)
16 MathInset * MathXArrowInset::clone() const
18 return new MathXArrowInset(*this);
22 void MathXArrowInset::metrics(MetricsInfo & mi) const
24 ScriptChanger dummy(mi.base);
27 dim_.w = std::max(cell(0).width(), cell(1).width()) + 10;
28 dim_.a = cell(0).height() + 10;
29 dim_.d = cell(1).height();
33 void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
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, width() - 2, 5, name_);
42 void MathXArrowInset::write(WriteStream & os) const
46 os << '[' << cell(1) << ']';
47 os << '{' << cell(0) << '}';
51 void MathXArrowInset::normalize(NormalStream & os) const
53 os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';