]> git.lyx.org Git - features.git/blob - src/mathed/math_sizeinset.C
389b233597ce63cd4124e7b270c72fef3b8f48c0
[features.git] / src / mathed / math_sizeinset.C
1 #ifdef __GNUG__
2 #pragma implementation
3 #endif
4
5 #include "math_sizeinset.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
8
9
10 MathSizeInset::MathSizeInset(latexkeys const * l)
11         : MathNestInset(1), key_(l)
12 {}
13
14
15 MathInset * MathSizeInset::clone() const
16 {
17         return new MathSizeInset(*this);
18 }
19
20
21 void MathSizeInset::draw(Painter & pain, int x, int y) const
22 {
23         xo(x);
24         yo(y);
25         xcell(0).draw(pain, x, y);
26 }
27
28
29 void MathSizeInset::metrics(MathMetricsInfo const & st) const
30 {
31         size_ = st;
32         size_.size = MathStyles(key_->id);
33         xcell(0).metrics(size_);
34         ascent_   = xcell(0).ascent_;
35         descent_  = xcell(0).descent_;
36         width_    = xcell(0).width_;
37 }
38
39
40 void MathSizeInset::write(MathWriteInfo & os) const
41 {
42         os << "{\\" << key_->name << ' ' << cell(0) << '}';
43 }
44
45
46 void MathSizeInset::writeNormal(std::ostream & os) const
47 {
48         os << "[" << key_->name << " ";
49         cell(0).writeNormal(os);
50         os << "]";
51 }