]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathFBox.cpp
2164ea7433b93ff32680775953190299618311e9
[lyx.git] / src / mathed / InsetMathFBox.cpp
1 /**
2  * \file InsetMathFBox.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathFBox.h"
14
15 #include "MathData.h"
16 #include "MathStream.h"
17 #include "MetricsInfo.h"
18
19 #include "frontends/Painter.h"
20
21 #include <ostream>
22
23
24 namespace lyx {
25
26 InsetMathFBox::InsetMathFBox()
27         : InsetMathNest(1)
28 {}
29
30
31 Inset * InsetMathFBox::clone() const
32 {
33         return new InsetMathFBox(*this);
34 }
35
36
37 InsetMath::mode_type InsetMathFBox::currentMode() const
38 {
39         return TEXT_MODE;
40 }
41
42
43 void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
44 {
45         FontSetChanger dummy(mi.base, "textnormal");
46         cell(0).metrics(mi, dim);
47         metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
48         // Cache the inset dimension. 
49         setDimCache(mi, dim);
50 }
51
52
53 void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
54 {
55         Dimension const dim = dimension(*pi.base.bv);
56         pi.pain.rectangle(x + 1, y - dim.ascent() + 1,
57                 dim.width() - 2, dim.height() - 2, Color_foreground);
58         FontSetChanger dummy(pi.base, "textnormal");
59         cell(0).draw(pi, x + 3, y);
60         setPosCache(pi, x, y);
61 }
62
63
64 void InsetMathFBox::write(WriteStream & os) const
65 {
66         os << "\\fbox{" << cell(0) << '}';
67 }
68
69
70 void InsetMathFBox::normalize(NormalStream & os) const
71 {
72         os << "[fbox " << cell(0) << ']';
73 }
74
75
76 void InsetMathFBox::infoize(odocstream & os) const
77 {
78         os << "FBox: ";
79 }
80
81
82 } // namespace lyx