2 * \file command_inset.C
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 "command_inset.h"
14 #include "math_data.h"
15 #include "math_mathmlstream.h"
16 #include "dispatchresult.h"
17 #include "funcrequest.h"
23 using std::ostringstream;
26 CommandInset::CommandInset(string const & name)
27 : MathNestInset(2), name_(name), set_label_(false)
33 auto_ptr<InsetBase> CommandInset::doClone() const
35 return auto_ptr<InsetBase>(new CommandInset(*this));
39 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
43 button_.update(screenLabel(), true);
45 button_.metrics(mi, dim);
50 InsetBase * CommandInset::editXY(LCursor & cur, int /*x*/, int /*y*/)
57 void CommandInset::draw(PainterInfo & pi, int x, int y) const
59 button_.draw(pi, x, y);
60 setPosCache(pi, x, y);
64 void CommandInset::write(WriteStream & os) const
66 os << '\\' << name_.c_str();
68 os << '[' << cell(1) << ']';
69 os << '{' << cell(0) << '}';
73 string const CommandInset::screenLabel() const
79 string const CommandInset::createDialogStr(string const & name) const
82 os << name << " LatexCommand ";
85 ws << "\n\\end_inset\n\n";