Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-10-04 17:17:59 +0300
committerJulian Eisel <julian@blender.org>2021-10-04 18:03:12 +0300
commit2b6f2072f1eecd43080821bb7b55f5313f890ddb (patch)
tree54ec409e85c4322e5968a7cf3be457c29af897d0 /source/blender/editors/include/UI_tree_view.hh
parent4fd7ce321d7352570a5cbb08d66b1c635d234689 (diff)
UI Tree-View API: Enforce active item to be un-collapsed
Makes sure that the active item of a tree never has collapsed parent items, which can be confusing if it happens. E.g. for the asset catalogs UI, the active catalog decides which assets are visible. Having it hidden while being the main factor deciding which assets are visible is quite confusing. I think it makes sense to have this at the UI Tree-View level, rather than doing it manually in the asset catalog code for example. Seems like something you'd commonly want. We can make it optional in the API if needed. Renamed the `set_active()` function to make clear that it is more than a mere setter.
Diffstat (limited to 'source/blender/editors/include/UI_tree_view.hh')
-rw-r--r--source/blender/editors/include/UI_tree_view.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh
index d36e688dd65..a82aae021f2 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -211,12 +211,16 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
const AbstractTreeView &get_tree_view() const;
int count_parents() const;
- void set_active(bool value = true);
+ /** Activates this item, deactivates other items, calls the #AbstractTreeViewItem::on_activate()
+ * function and ensures this item's parents are not collapsed (so the item is visible). */
+ void activate();
+ void deactivate();
bool is_active() const;
void toggle_collapsed();
bool is_collapsed() const;
void set_collapsed(bool collapsed);
bool is_collapsible() const;
+ void ensure_parents_uncollapsed();
};
/** \} */