2 * \file InsetMathDFrac.cpp
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 "InsetMathDFrac.h"
15 #include "MathStream.h"
16 #include "LaTeXFeatures.h"
18 #include "frontends/Painter.h"
29 InsetMathDFrac::InsetMathDFrac()
34 auto_ptr<InsetBase> InsetMathDFrac::doClone() const
36 return auto_ptr<InsetBase>(new InsetMathDFrac(*this));
40 bool InsetMathDFrac::metrics(MetricsInfo & mi, Dimension & dim) const
44 dim.wid = max(cell(0).width(), cell(1).width()) + 2;
45 dim.asc = cell(0).height() + 2 + 5;
46 dim.des = cell(1).height() + 2 - 5;
54 void InsetMathDFrac::draw(PainterInfo & pi, int x, int y) const
56 int m = x + dim_.wid / 2;
57 cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
58 cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5);
59 pi.pain.line(x + 1, y - 5, x + dim_.wid - 2, y - 5, LColor::math);
60 setPosCache(pi, x, y);
64 docstring InsetMathDFrac::name() const
66 return from_ascii("dfrac");
70 void InsetMathDFrac::mathmlize(MathStream & os) const
72 os << MTag("mdfrac") << cell(0) << cell(1) << ETag("mdfrac");
76 void InsetMathDFrac::validate(LaTeXFeatures & features) const
78 features.require("amsmath");
79 InsetMathNest::validate(features);