diff options
author | Julian Eisel <julian@blender.org> | 2021-10-06 17:29:10 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-06 17:36:20 +0300 |
commit | 75fbf6f17e69ee9c6487173ae5957cfff5193d1f (patch) | |
tree | e27584eb4440d0280cd65a805c8a546966fb9d83 /source/blender/editors/include | |
parent | 536109b4ec336e86de5a7e22e51804584bca74f5 (diff) |
Asset Browser: Show catalog add & delete icons on mouse hover (only)
Now the icons to add or delete catalogs are only shown when mouse hovering a
catalog item in the tree. This is convenient for quick creation of catalogs,
and doesn't require activating a catalog to edit it first.
Determining if a tree item is hovered isn't trivial actually. The UI tree-view
code has to find the matching tree-row button in the previous layout to do so,
since the new layout isn't calculated yet.
Diffstat (limited to 'source/blender/editors/include')
-rw-r--r-- | source/blender/editors/include/UI_tree_view.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh index 8f8681896fe..7693a833210 100644 --- a/source/blender/editors/include/UI_tree_view.hh +++ b/source/blender/editors/include/UI_tree_view.hh @@ -185,6 +185,7 @@ class AbstractTreeView : public TreeViewItemContainer { const TreeViewItemContainer &old_items); static AbstractTreeViewItem *find_matching_child(const AbstractTreeViewItem &lookup_item, const TreeViewItemContainer &items); + /** * Items may want to do additional work when state changes. But these state changes can only be * reliably detected after the tree has completed reconstruction (see #is_reconstructed()). So @@ -290,6 +291,12 @@ class AbstractTreeViewItem : public TreeViewItemContainer { * can't be sure about the item state. */ bool is_active() const; + /** + * Can be called from the #AbstractTreeViewItem::build_row() implementation, but not earlier. The + * hovered state can't be queried reliably otherwise. + * Note that this does a linear lookup in the old block, so isn't too great performance-wise. + */ + bool is_hovered() const; void toggle_collapsed(); /** * Requires the tree to have completed reconstruction, see #is_reconstructed(). Otherwise we |