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"
18 #include "support/std_sstream.h"
23 using std::ostringstream;
26 CommandInset::CommandInset(string const & name)
35 auto_ptr<InsetBase> CommandInset::clone() const
37 return auto_ptr<InsetBase>(new CommandInset(*this));
41 void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
45 button_.update(screenLabel(), true);
47 button_.metrics(mi, dim);
51 void CommandInset::draw(PainterInfo & pi, int x, int y) const
53 button_.draw(pi, x, y);
58 CommandInset::priv_dispatch(FuncRequest const & cmd,
59 idx_type & idx, pos_type & pos)
63 return MathNestInset::priv_dispatch(cmd, idx, pos);
65 return DispatchResult(UNDISPATCHED);
69 void CommandInset::write(WriteStream & os) const
71 os << '\\' << name_.c_str();
73 os << '[' << cell(1) << ']';
74 os << '{' << cell(0) << '}';
78 string const CommandInset::screenLabel() const
84 string const CommandInset::createDialogStr(string const & name) const
87 data << name << " LatexCommand ";
88 WriteStream wsdata(data);
90 wsdata << "\n\\end_inset\n\n";