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::clone() 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 void CommandInset::draw(PainterInfo & pi, int x, int y) const
52 button_.draw(pi, x, y);
53 setPosCache(pi, x, y);
57 void CommandInset::write(WriteStream & os) const
59 os << '\\' << name_.c_str();
61 os << '[' << cell(1) << ']';
62 os << '{' << cell(0) << '}';
66 string const CommandInset::screenLabel() const
72 string const CommandInset::createDialogStr(string const & name) const
75 os << name << " LatexCommand ";
78 ws << "\n\\end_inset\n\n";