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-01-27 00:06:45 +0300
committerJulian Eisel <julian@blender.org>2021-01-27 00:17:17 +0300
commitd096d9c4d686471b9de2a993b76f5bd9fef9cb78 (patch)
treef61623f7e2b75d5c59553ab9ed2d4004399701dd /source/blender/editors/interface/interface_region_search.c
parent656f6ae6436ae10cae4820a5c957041a20d56995 (diff)
UI: Tooltip for data-block selector menus, showing full name and library info
Long data-block names are clipped to fit into data-block selector menus. For linked data-blocks, there's also a hint indicating the source library, which takes further space and may get clipped too. So this commit adds a tooltip to the menu items, which displays the full, unclipped data-block name and the unclipped library name. Plus, the library path is shown too, which is also useful info. Adds helper functions for search menu item tooltips, so these are easier to add to other search menus in future. Part of T84188.
Diffstat (limited to 'source/blender/editors/interface/interface_region_search.c')
-rw-r--r--source/blender/editors/interface/interface_region_search.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c
index 816162e9aa2..7f51eb90fe8 100644
--- a/source/blender/editors/interface/interface_region_search.c
+++ b/source/blender/editors/interface/interface_region_search.c
@@ -347,9 +347,20 @@ static struct ARegion *wm_searchbox_tooltip_init(struct bContext *C,
}
uiButSearch *search_but = (uiButSearch *)but;
- if (search_but->item_tooltip_fn) {
- return search_but->item_tooltip_fn(C, region, search_but->arg, search_but->item_active);
+ if (!search_but->item_tooltip_fn) {
+ continue;
}
+
+ ARegion *searchbox_region = UI_region_searchbox_region_get(region);
+ uiSearchboxData *data = searchbox_region->regiondata;
+
+ BLI_assert(data->items.pointers[data->active] == search_but->item_active);
+
+ rcti rect;
+ ui_searchbox_butrect(&rect, data, data->active);
+
+ return search_but->item_tooltip_fn(
+ C, region, &rect, search_but->arg, search_but->item_active);
}
}
return NULL;