2 * \file CommandInset.cpp
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 "CommandInset.h"
15 #include "MathStream.h"
16 #include "DispatchResult.h"
17 #include "FuncRequest.h"
26 CommandInset::CommandInset(docstring const & name)
27 : InsetMathNest(2), name_(name), set_label_(false)
33 Inset * CommandInset::clone() const
35 return new CommandInset(*this);
39 bool CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
43 button_.update(screenLabel(), true);
45 button_.metrics(mi, dim);
53 Inset * CommandInset::editXY(Cursor & cur, int /*x*/, int /*y*/)
60 void CommandInset::draw(PainterInfo & pi, int x, int y) const
62 button_.draw(pi, x, y);
63 setPosCache(pi, x, y);
67 void CommandInset::write(WriteStream & os) const
69 os << '\\' << name_.c_str();
71 os << '[' << cell(1) << ']';
72 os << '{' << cell(0) << '}';
76 docstring const CommandInset::screenLabel() const