5 #include "math_macrotemplate.h"
10 MathMacroTemplate::MathMacroTemplate()
11 : MathNestInset(1), numargs_(0)
15 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
16 : MathNestInset(1, nm), numargs_(numargs)
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 void MathMacroTemplate::write(std::ostream & os, bool fragile) const
41 os << "\n\\newcommand{\\" << name_ << "}";
44 os << "[" << numargs_ << "]";
47 cell(0).write(os, fragile);
52 void MathMacroTemplate::metrics(MathStyles st) 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
66 xcell(0).draw(pain, x + 2, y + 1);
67 pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);