5 #include "math_macrotemplate.h"
6 #include "math_mathmlstream.h"
14 MathMacroTemplate::MathMacroTemplate()
15 : MathNestInset(1), numargs_(0), name_()
19 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
20 : MathNestInset(1), numargs_(numargs), name_(nm)
23 lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
28 MathInset * MathMacroTemplate::clone() const
30 //lyxerr << "cloning MacroTemplate!\n";
31 return new MathMacroTemplate(*this);
35 int MathMacroTemplate::numargs() const
41 void MathMacroTemplate::numargs(int numargs)
47 string const & MathMacroTemplate::name() const
53 void MathMacroTemplate::metrics(MathMetricsInfo const & mi) const
56 width_ = xcell(0).width() + 4;
57 ascent_ = xcell(0).ascent() + 2;
58 descent_ = xcell(0).descent() + 2;
62 void MathMacroTemplate::draw(Painter & pain, int x, int y) const
64 xcell(0).draw(pain, x + 2, y + 1);
65 pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);
69 void MathMacroTemplate::write(WriteStream & os) const
71 os << "\n\\newcommand{\\" << name_.c_str() << '}';
73 os << '[' << numargs_ << ']';
74 os << '{' << cell(0) << "}\n";