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 "funcrequest.h"
17 #include "support/std_sstream.h"
22 using std::ostringstream;
25 CommandInset::CommandInset(string const & name)
34 auto_ptr<InsetBase> CommandInset::clone() const
36 return auto_ptr<InsetBase>(new CommandInset(*this));
40 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
44 button_.update(screenLabel(), true);
46 button_.metrics(mi, dim);
50 void CommandInset::draw(PainterInfo & pi, int x, int y) const
52 button_.draw(pi, x, y);
56 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
60 return MathNestInset::dispatch(cmd, idx, pos);
66 void CommandInset::write(WriteStream & os) const
68 os << '\\' << name_.c_str();
70 os << '[' << cell(1) << ']';
71 os << '{' << cell(0) << '}';
75 string const CommandInset::screenLabel() const
81 string const CommandInset::createDialogStr(string const & name) const
84 data << name << " LatexCommand ";
85 WriteStream wsdata(data);
87 wsdata << "\n\\end_inset\n\n";