diff options
author | Julian Eisel <julian@blender.org> | 2021-10-08 20:56:24 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-08 21:08:22 +0300 |
commit | 17c928e9752372b698a1ed27e243181873aa411e (patch) | |
tree | 7a1b088c4c83af65a603b79433b003f3cf344300 /source/blender/editors/include/UI_interface.h | |
parent | 7bd0de924080571f4c8308dc651b83539d6d22b8 (diff) |
UI: Add context menu support for tree-view items
Tree-view items can now easily define their own context menu. This works
by overriding the `ui::AbstractTreeViewItem::build_context_menu()`
function. See the documentation:
https://wiki.blender.org/wiki/Source/Interface/Views#Context_Menus
Consistently with the Outliner and File Browser, the right-clicked item
also gets activated. This makes sure the correct context is set for the
operators and makes it clear to the user which item is operated on.
An operator to rename the active item is also added, which is something
you'd typically want to put in the context menu as well.
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index c536eff771d..ddd5e77cbb6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -2783,7 +2783,12 @@ char *UI_tree_view_item_drop_tooltip(const uiTreeViewItemHandle *item, bool UI_tree_view_item_can_rename(const uiTreeViewItemHandle *item_handle); void UI_tree_view_item_begin_rename(uiTreeViewItemHandle *item_handle); +void UI_tree_view_item_context_menu_build(struct bContext *C, + const uiTreeViewItemHandle *item, + uiLayout *column); + uiTreeViewItemHandle *UI_block_tree_view_find_item_at(const struct ARegion *region, int x, int y); +uiTreeViewItemHandle *UI_block_tree_view_find_active_item(const struct ARegion *region); #ifdef __cplusplus } |