2 * \file math_frameboxinset.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_frameboxinset.h"
14 #include "math_support.h"
15 #include "math_mathmlstream.h"
16 #include "math_streamstr.h"
17 #include "frontends/Painter.h"
22 MathFrameboxInset::MathFrameboxInset()
27 auto_ptr<InsetBase> MathFrameboxInset::clone() const
29 return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
33 void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
35 FontSetChanger dummy(mi.base, "textnormal");
36 w_ = mathed_char_width(mi.base.font, '[');
37 MathNestInset::metrics(mi);
39 dim_ += cell(1).dim();
40 dim_ += cell(2).dim();
46 void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const
48 FontSetChanger dummy(pi.base, "textnormal");
49 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
50 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
53 drawStrBlack(pi, x, y, "[");
55 cell(0).draw(pi, x, y);
57 drawStrBlack(pi, x, y, "]");
60 drawStrBlack(pi, x, y, "[");
62 cell(1).draw(pi, x, y);
64 drawStrBlack(pi, x, y, "]");
67 cell(2).draw(pi, x, y);
71 void MathFrameboxInset::write(WriteStream & os) const
74 os << '[' << cell(0) << ']';
76 os << '[' << cell(1) << ']';
77 os << '{' << cell(2) << '}';
81 void MathFrameboxInset::normalize(NormalStream & os) const
83 os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';