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-07 15:59:43 +0300
committerJulian Eisel <julian@blender.org>2021-10-07 16:30:59 +0300
commitc0a5b13b5ed3d1477afdbae48653acf87c6a0d08 (patch)
tree151f46d224e05acbef29318d269d7e7e940da270 /source/blender/editors/include/UI_tree_view.hh
parent13a28d9e6f12dcba3f97deb20efb0b0761e93db4 (diff)
Asset Browser: Rework layout & behavior of catalog tree-view
This reworks how tree rows are constructed in the layout and how they behave in return. * To open or collapse a row, the triangle/chevron icon has to be clicked now. The previous behavior of allowing to do it on the entire row, but only if the item was active already, was just too unusual and felt weird. * Reduce margin between chevron icon and the row label. * Indent child items without chevron some more, otherwise they feel like a row on the same level as their parent, just without chevron. * Fix renaming button taking entire row width. Respect indentation now. * Fix double-clicking to rename toggling collapsed state on each click. Some hacks/special-handling was needed so tree-rows always highlight while the mouse is hovering them, even if the mouse is actually hovering another button inside the row.
Diffstat (limited to 'source/blender/editors/include/UI_tree_view.hh')
-rw-r--r--source/blender/editors/include/UI_tree_view.hh17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/editors/include/UI_tree_view.hh b/source/blender/editors/include/UI_tree_view.hh
index 7693a833210..272439a2ae9 100644
--- a/source/blender/editors/include/UI_tree_view.hh
+++ b/source/blender/editors/include/UI_tree_view.hh
@@ -138,6 +138,8 @@ class TreeViewLayoutBuilder {
private:
/* Created through #TreeViewBuilder. */
TreeViewLayoutBuilder(uiBlock &block);
+
+ static void polish_layout(const uiBlock &block);
};
/** \} */
@@ -282,8 +284,7 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
void begin_renaming();
void end_renaming();
- const AbstractTreeView &get_tree_view() const;
- AbstractTreeView &get_tree_view();
+ AbstractTreeView &get_tree_view() const;
int count_parents() const;
void deactivate();
/**
@@ -310,6 +311,8 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
void ensure_parents_uncollapsed();
bool matches_including_parents(const AbstractTreeViewItem &other) const;
+ uiButTreeRow *tree_row_button();
+
protected:
/**
* Activates this item, deactivates other items, calls the #AbstractTreeViewItem::on_activate()
@@ -323,11 +326,16 @@ class AbstractTreeViewItem : public TreeViewItemContainer {
static void rename_button_fn(bContext *, void *, char *);
static AbstractTreeViewItem *find_tree_item_from_rename_button(const uiBut &but);
static void tree_row_click_fn(struct bContext *, void *, void *);
+ static void collapse_chevron_click_fn(bContext *, void *but_arg1, void *);
+ static bool is_collapse_chevron_but(const uiBut *but);
/** See #AbstractTreeView::change_state_delayed() */
void change_state_delayed();
+
void add_treerow_button(uiBlock &block);
- void add_rename_button(uiBlock &block);
+ void add_indent(uiLayout &row) const;
+ void add_collapse_chevron(uiBlock &block) const;
+ void add_rename_button(uiLayout &row);
};
/** \} */
@@ -359,9 +367,6 @@ class BasicTreeViewItem : public AbstractTreeViewItem {
*/
ActivateFn activate_fn_;
- uiBut *button();
- BIFIconID get_draw_icon() const;
-
private:
static void tree_row_click_fn(struct bContext *C, void *arg1, void *arg2);