2 * \file InsetMathDFrac.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 "InsetMathTFrac.h"
16 #include "MathStream.h"
18 #include "LaTeXFeatures.h"
21 #include "frontends/Painter.h"
32 InsetMathTFrac::InsetMathTFrac()
37 auto_ptr<InsetBase> InsetMathTFrac::doClone() const
39 return auto_ptr<InsetBase>(new InsetMathTFrac(*this));
43 void InsetMathTFrac::metrics(MetricsInfo & mi, Dimension & dim) const
45 StyleChanger dummy(mi.base, LM_ST_SCRIPT);
48 dim_.wid = max(cell(0).width(), cell(1).width()) + 2;
49 dim_.asc = cell(0).height() + 2 + 5;
50 dim_.des = cell(1).height() + 2 - 5;
55 void InsetMathTFrac::draw(PainterInfo & pi, int x, int y) const
57 StyleChanger dummy(pi.base, LM_ST_SCRIPT);
58 int m = x + dim_.wid / 2;
59 cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
60 cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5);
61 pi.pain.line(x + 1, y - 5, x + dim_.wid - 2, y - 5, LColor::math);
62 setPosCache(pi, x, y);
66 docstring InsetMathTFrac::name() const
68 return from_ascii("tfrac");
72 void InsetMathTFrac::mathmlize(MathStream & os) const
74 os << MTag("mtfrac") << cell(0) << cell(1) << ETag("mtfrac");
78 void InsetMathTFrac::validate(LaTeXFeatures & features) const
80 features.require("amsmath");
81 InsetMathNest::validate(features);