]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/command_inset.C
introduce namespace lyx::support
[lyx.git] / src / mathed / command_inset.C
index 7c75d36887d4f1e64831f55a87b34b54ca0e6a0b..77570665d6d14f7857d04a1a6ac2ab2fde0e0ce7 100644 (file)
@@ -6,24 +6,41 @@
 
 
 CommandInset::CommandInset(string const & name)
-       : name_(name)
+       : MathNestInset(2),
+         name_(name),
+         set_label_(false)
 {
        lock_ = true;
 }
 
 
-MathInset * CommandInset::clone() const
+InsetBase * CommandInset::clone() const
 {
        return new CommandInset(*this);
 }
 
 
+void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+       if (!set_label_) {
+               set_label_ = true;
+               button_.update(screenLabel(), true);
+       }
+       button_.metrics(mi, dim);
+}
+
+
+void CommandInset::draw(PainterInfo & pi, int x, int y) const
+{
+       button_.draw(pi, x, y);
+}
+
 dispatch_result
 CommandInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
 {
        switch (cmd.action) {
                default:
-                       return ButtonInset::dispatch(cmd, idx, pos);
+                       return MathNestInset::dispatch(cmd, idx, pos);
        }
        return UNDISPATCHED;
 }
@@ -38,9 +55,9 @@ void CommandInset::write(WriteStream & os) const
 }
 
 
-string CommandInset::screenLabel() const
+string const CommandInset::screenLabel() const
 {
-       return name_;
+       return name_;
 }
 
 
@@ -53,5 +70,3 @@ string const CommandInset::createDialogStr(string const & name) const
        wsdata << "\n\\end_inset\n\n";
        return STRCONV(data.str());
 }
-
-