2 * \file math_dfracinset.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_tfracinset.h"
15 #include "math_data.h"
16 #include "math_mathmlstream.h"
18 #include "LaTeXFeatures.h"
21 #include "frontends/Painter.h"
29 MathTfracInset::MathTfracInset()
30 : MathFracInset(false)
34 auto_ptr<InsetBase> MathTfracInset::doClone() const
36 return auto_ptr<InsetBase>(new MathTfracInset(*this));
40 void MathTfracInset::metrics(MetricsInfo & mi, Dimension & dim) const
42 StyleChanger dummy(mi.base, LM_ST_SCRIPT);
45 dim_.wid = max(cell(0).width(), cell(1).width()) + 2;
46 dim_.asc = cell(0).height() + 2 + 5;
47 dim_.des = cell(1).height() + 2 - 5;
52 void MathTfracInset::draw(PainterInfo & pi, int x, int y) const
54 StyleChanger dummy(pi.base, LM_ST_SCRIPT);
55 int m = x + dim_.wid / 2;
56 cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
57 cell(1).draw(pi, m - cell(1).width() / 2, y + cell(1).ascent() + 2 - 5);
58 pi.pain.line(x + 1, y - 5, x + dim_.wid - 2, y - 5, LColor::math);
59 setPosCache(pi, x, y);
63 string MathTfracInset::name() const
69 void MathTfracInset::mathmlize(MathMLStream & os) const
71 os << MTag("mtfrac") << cell(0) << cell(1) << ETag("mtfrac");
75 void MathTfracInset::validate(LaTeXFeatures & features) const
77 features.require("amsmath");
78 MathNestInset::validate(features);