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_mathmlstream.h"
15 #include "funcrequest.h"
16 #include "support/std_sstream.h"
21 CommandInset::CommandInset(string const & name)
30 auto_ptr<InsetBase> CommandInset::clone() const
32 return auto_ptr<InsetBase>(new CommandInset(*this));
36 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
40 button_.update(screenLabel(), true);
42 button_.metrics(mi, dim);
46 void CommandInset::draw(PainterInfo & pi, int x, int y) const
48 button_.draw(pi, x, y);
52 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
56 return MathNestInset::dispatch(cmd, idx, pos);
62 void CommandInset::write(WriteStream & os) const
64 os << '\\' << name_.c_str();
66 os << '[' << cell(1) << ']';
67 os << '{' << cell(0) << '}';
71 string const CommandInset::screenLabel() const
77 string const CommandInset::createDialogStr(string const & name) const
80 data << name << " LatexCommand ";
81 WriteStream wsdata(data);
83 wsdata << "\n\\end_inset\n\n";
84 return STRCONV(data.str());