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 "frontends/Painter.h"
21 MathFrameboxInset::MathFrameboxInset()
26 auto_ptr<InsetBase> MathFrameboxInset::clone() const
28 return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
32 void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
34 FontSetChanger dummy(mi.base, "textnormal");
35 w_ = mathed_char_width(mi.base.font, '[');
36 MathNestInset::metrics(mi);
38 dim_ += cell(1).dim();
39 dim_ += cell(2).dim();
45 void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const
47 FontSetChanger dummy(pi.base, "textnormal");
48 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
49 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
52 drawStrBlack(pi, x, y, "[");
54 cell(0).draw(pi, x, y);
56 drawStrBlack(pi, x, y, "]");
59 drawStrBlack(pi, x, y, "[");
61 cell(1).draw(pi, x, y);
63 drawStrBlack(pi, x, y, "]");
66 cell(2).draw(pi, x, y);
70 void MathFrameboxInset::write(WriteStream & os) const
73 os << '[' << cell(0) << ']';
75 os << '[' << cell(1) << ']';
76 os << '{' << cell(2) << '}';
80 void MathFrameboxInset::normalize(NormalStream & os) const
82 os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';