4 #include "math_fboxinset.h"
5 #include "math_support.h"
6 #include "math_mathmlstream.h"
7 #include "math_streamstr.h"
8 #include "math_parser.h"
9 #include "frontends/Painter.h"
13 MathFboxInset::MathFboxInset(latexkeys const * key)
14 : MathNestInset(1), key_(key)
18 MathInset * MathFboxInset::clone() const
20 return new MathFboxInset(*this);
24 MathInset::mode_type MathFboxInset::currentMode() const
26 if (key_->name == "fbox")
32 void MathFboxInset::metrics(MathMetricsInfo & mi) const
34 if (key_->name == "fbox") {
35 MathFontSetChanger dummy(mi.base, "textnormal");
36 dim_ = cell(0).metrics(mi);
37 metricsMarkers2(5); // 5 pixels margin
39 dim_ = cell(0).metrics(mi);
40 metricsMarkers2(5); // 5 pixels margin
45 void MathFboxInset::draw(MathPainterInfo & pi, int x, int y) const
47 pi.pain.rectangle(x + 1, y - ascent() + 1, width() - 2, height() - 2,
49 if (key_->name == "fbox") {
50 MathFontSetChanger dummy(pi.base, "textnormal");
51 cell(0).draw(pi, x + 5, y);
53 cell(0).draw(pi, x + 5, y);
58 void MathFboxInset::write(WriteStream & os) const
60 os << '\\' << key_->name << '{' << cell(0) << '}';
64 void MathFboxInset::normalize(NormalStream & os) const
66 os << '[' << key_->name << ' ' << cell(0) << ']';