]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetCollapsable.cpp
Implement tooltips for visible insets.
[features.git] / src / insets / InsetCollapsable.cpp
index fe747bc9e8b840db7e264d4d4a53d3e0edc0372d..7622fb390d860c7c6f40c2f29e3bcb819fcbe7df 100644 (file)
@@ -98,7 +98,23 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs)
 }
 
 
-void  InsetCollapsable::setLayout(BufferParams const & bp)
+docstring InsetCollapsable::toolTip(BufferView const & bv, int x, int y) const
+{
+       Dimension dim = dimensionCollapsed();
+       if (x > xo(bv) + dim.wid || y > yo(bv) + dim.des)
+               return docstring();
+
+       switch (status_) {
+       case Open:
+               return _("Left-click to collapse the inset");
+       case Collapsed:
+               return _("Left-click to open the inset");
+       }
+       return docstring();
+}
+
+
+void InsetCollapsable::setLayout(BufferParams const & bp)
 {
        setLayout(bp.getTextClass().insetlayout(name()));
 }