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_data.h"
15 #include "math_mathmlstream.h"
16 #include "math_support.h"
18 #include "frontends/Painter.h"
23 MathFrameboxInset::MathFrameboxInset()
28 auto_ptr<InsetBase> MathFrameboxInset::doClone() const
30 return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
34 void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
36 FontSetChanger dummy(mi.base, "textnormal");
37 w_ = mathed_char_width(mi.base.font, '[');
38 MathNestInset::metrics(mi);
47 void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const
49 FontSetChanger dummy(pi.base, "textnormal");
50 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
51 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
54 drawStrBlack(pi, x, y, "[");
56 cell(0).draw(pi, x, y);
58 drawStrBlack(pi, x, y, "]");
61 drawStrBlack(pi, x, y, "[");
63 cell(1).draw(pi, x, y);
65 drawStrBlack(pi, x, y, "]");
68 cell(2).draw(pi, x, y);
69 drawMarkers(pi, x, y);
73 void MathFrameboxInset::write(WriteStream & os) const
76 os << '[' << cell(0) << ']';
78 os << '[' << cell(1) << ']';
79 os << '{' << cell(2) << '}';
83 void MathFrameboxInset::normalize(NormalStream & os) const
85 os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';