7 #include "math_macrotemplate.h"
12 MathMacroTemplate::MathMacroTemplate() :
13 MathInset(1, "undefined", LM_OT_MACRO), numargs_(0), users_()
17 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs) :
18 MathInset(1, nm, LM_OT_MACRO), numargs_(numargs), users_()
22 MathInset * MathMacroTemplate::clone() const
24 lyxerr << "cloning MacroTemplate!\n";
25 return new MathMacroTemplate(*this);
29 int MathMacroTemplate::numargs() const
35 void MathMacroTemplate::numargs(int numargs)
41 void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
43 os << "\n\\newcommand{\\" << name_ << "}";
46 os << "[" << numargs_ << "]";
49 cell(0).Write(os, fragile);
54 void MathMacroTemplate::Metrics(MathStyles st)
58 width_ = xcell(0).width() + 4;
59 ascent_ = xcell(0).ascent() + 2;
60 descent_ = xcell(0).descent() + 2;
64 void MathMacroTemplate::draw(Painter & pain, int x, int y)
68 xcell(0).draw(pain, x + 2, y + 1);
69 pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);