3 #include "math_fboxinset.h"
4 #include "math_support.h"
5 #include "math_mathmlstream.h"
6 #include "math_streamstr.h"
7 #include "math_parser.h"
8 #include "frontends/Painter.h"
12 MathFboxInset::MathFboxInset(latexkeys const * key)
13 : MathNestInset(1), key_(key)
17 MathInset * MathFboxInset::clone() const
19 return new MathFboxInset(*this);
23 MathInset::mode_type MathFboxInset::currentMode() const
25 if (key_->name == "fbox")
31 Dimension MathFboxInset::metrics(MetricsInfo & mi) const
33 if (key_->name == "fbox") {
34 FontSetChanger dummy(mi.base, "textnormal");
35 cell(0).metrics(mi, dim_);
37 cell(0).metrics(mi, dim_);
39 metricsMarkers(5); // 5 pixels margin
44 void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
46 pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
47 dim_.width() - 2, dim_.height() - 2, LColor::foreground);
48 if (key_->name == "fbox") {
49 FontSetChanger dummy(pi.base, "textnormal");
50 cell(0).draw(pi, x + 5, y);
52 cell(0).draw(pi, x + 5, y);
57 void MathFboxInset::write(WriteStream & os) const
59 os << '\\' << key_->name << '{' << cell(0) << '}';
63 void MathFboxInset::normalize(NormalStream & os) const
65 os << '[' << key_->name << ' ' << cell(0) << ']';