7 #include "math_fboxinset.h"
8 #include "math_support.h"
9 #include "math_mathmlstream.h"
10 #include "math_streamstr.h"
11 #include "math_parser.h"
12 #include "frontends/Painter.h"
16 MathFboxInset::MathFboxInset(latexkeys const * key)
17 : MathNestInset(1), key_(key)
21 MathInset * MathFboxInset::clone() const
23 return new MathFboxInset(*this);
27 MathInset::mode_type MathFboxInset::currentMode() const
29 if (key_->name == "fbox")
35 void MathFboxInset::metrics(MathMetricsInfo & mi) const
37 if (key_->name == "fbox") {
38 MathFontSetChanger dummy(mi.base, "textnormal");
39 dim_ = cell(0).metrics(mi);
40 metricsMarkers2(5); // 5 pixels margin
42 dim_ = cell(0).metrics(mi);
43 metricsMarkers2(5); // 5 pixels margin
48 void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
50 pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
52 if (key_->name == "fbox") {
53 MathFontSetChanger dummy(pi.base, "textnormal");
54 cell(0).draw(pi, x + 5, y);
56 cell(0).draw(pi, x + 5, y);
61 void MathFboxInset::write(WriteStream & os) const
63 os << '\\' << key_->name << '{' << cell(0) << '}';
67 void MathFboxInset::normalize(NormalStream & os) const
69 os << '[' << key_->name << ' ' << cell(0) << ']';