]> git.lyx.org Git - lyx.git/blob - src/mathed/math_macroarg.C
remove default constructor
[lyx.git] / src / mathed / math_macroarg.C
1 #include <config.h>
2
3 #ifdef __GNUG__
4 #pragma implementation
5 #endif
6
7 #include "math_macroarg.h"
8 #include "mathed/support.h"
9 #include "Lsstream.h"
10
11
12 MathMacroArgument::MathMacroArgument(int n)
13         : MathParInset(LM_ST_TEXT, "", LM_OT_MACRO_ARG),
14           expnd_mode_(false), number_(n)
15 {}
16
17
18 MathedInset * MathMacroArgument::Clone()
19 {
20         return this;
21 }
22
23
24 void MathMacroArgument::setExpand(bool e)
25 {
26         expnd_mode_ = e;
27 }
28
29
30 bool MathMacroArgument::getExpand() const
31 {
32         return expnd_mode_;
33 }
34
35
36 void MathMacroArgument::draw(Painter & pain, int x, int baseline)
37 {
38         if (expnd_mode_) {
39                 MathParInset::draw(pain, x, baseline);
40         } else {
41                 std::ostringstream ost;
42                 ost << '#' << number_;
43                 drawStr(pain, LM_TC_TEX, size(), x, baseline, ost.str().c_str());
44         }
45 }
46
47 void MathMacroArgument::Metrics()
48 {
49         if (expnd_mode_) {
50                 MathParInset::Metrics();
51         } else {
52                 std::ostringstream ost;
53                 ost << '#' << number_;
54                 width = mathed_string_width(LM_TC_TEX, size(),
55                                             ost.str().c_str());
56                 mathed_string_height(LM_TC_TEX, size(), ost.str().c_str(),
57                                      ascent, descent);
58         }
59 }
60
61
62 void MathMacroArgument::Write(std::ostream & os, bool fragile)
63 {
64         if (expnd_mode_) {
65                 MathParInset::Write(os, fragile);
66         } else {
67                 os << '#' << number_ << ' ';
68         }
69 }