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"
10 MathXArrowInset::MathXArrowInset(string const & name)
11 : MathFracbaseInset(), name_(name)
15 MathInset * MathXArrowInset::clone() const
17 return new MathXArrowInset(*this);
21 Dimension MathXArrowInset::metrics(MetricsInfo & mi) const
23 ScriptChanger dummy(mi.base);
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();
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, pi.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) << ']';