2 * \file InsetMathCommand.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathCommand.h"
15 #include "MathStream.h"
16 #include "dispatchresult.h"
17 #include "funcrequest.h"
27 CommandInset::CommandInset(docstring const & name)
28 : InsetMathNest(2), name_(name), set_label_(false)
34 auto_ptr<InsetBase> CommandInset::doClone() const
36 return auto_ptr<InsetBase>(new CommandInset(*this));
40 bool CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
44 button_.update(screenLabel(), true);
46 button_.metrics(mi, dim);
54 InsetBase * CommandInset::editXY(LCursor & cur, int /*x*/, int /*y*/)
61 void CommandInset::draw(PainterInfo & pi, int x, int y) const
63 button_.draw(pi, x, y);
64 setPosCache(pi, x, y);
68 void CommandInset::write(WriteStream & os) const
70 os << '\\' << name_.c_str();
72 os << '[' << cell(1) << ']';
73 os << '{' << cell(0) << '}';
77 docstring const CommandInset::screenLabel() const