5 #include "math_macrotemplate.h"
10 MathMacroTemplate::MathMacroTemplate()
11 : MathNestInset(1), numargs_(0), name_()
15 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
16 : MathNestInset(1), numargs_(numargs), name_(nm)
20 MathInset * MathMacroTemplate::clone() const
22 lyxerr << "cloning MacroTemplate!\n";
23 return new MathMacroTemplate(*this);
27 int MathMacroTemplate::numargs() const
33 void MathMacroTemplate::numargs(int numargs)
39 string const & MathMacroTemplate::name() const
45 void MathMacroTemplate::write(std::ostream & os, bool fragile) const
47 os << "\n\\newcommand{\\" << name_ << "}";
50 os << "[" << numargs_ << "]";
53 cell(0).write(os, fragile);
58 void MathMacroTemplate::metrics(MathStyles st) const
62 width_ = xcell(0).width() + 4;
63 ascent_ = xcell(0).ascent() + 2;
64 descent_ = xcell(0).descent() + 2;
68 void MathMacroTemplate::draw(Painter & pain, int x, int y) const
72 xcell(0).draw(pain, x + 2, y + 1);
73 pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);