2 * \file math_xarrowinset.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "math_xarrowinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
21 MathXArrowInset::MathXArrowInset(string const & name)
22 : MathFracbaseInset(), name_(name)
26 auto_ptr<InsetBase> MathXArrowInset::clone() const
28 return auto_ptr<InsetBase>(new MathXArrowInset(*this));
32 void MathXArrowInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 ScriptChanger dummy(mi.base);
37 dim_.wid = std::max(cell(0).width(), cell(1).width()) + 10;
38 dim_.asc = cell(0).height() + 10;
39 dim_.des = cell(1).height();
44 void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
46 ScriptChanger dummy(pi.base);
47 cell(0).draw(pi, x + 5, y - 10);
48 cell(1).draw(pi, x + 5, y + cell(1).height());
49 mathed_draw_deco(pi, x + 1, y - 7, pi.width - 2, 5, name_);
53 void MathXArrowInset::write(WriteStream & os) const
57 os << '[' << cell(1) << ']';
58 os << '{' << cell(0) << '}';
62 void MathXArrowInset::normalize(NormalStream & os) const
64 os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';