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/include
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/include')
-rw-r--r--source/blender/editors/include/UI_interface.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index dd5c92e5e0f..bc053f60ca3 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -508,6 +508,7 @@ typedef bool (*uiButSearchContextMenuFn)(struct bContext *C,
const struct wmEvent *event);
typedef struct ARegion *(*uiButSearchTooltipFn)(struct bContext *C,
struct ARegion *region,
+ const struct rcti *item_rect,
void *arg,
void *active);
@@ -2485,6 +2486,7 @@ uiBut *UI_region_but_find_rect_over(const struct ARegion *region, const struct r
uiBlock *UI_region_block_find_mouse_over(const struct ARegion *region,
const int xy[2],
bool only_clip);
+struct ARegion *UI_region_searchbox_region_get(const struct ARegion *button_region);
/* uiFontStyle.align */
typedef enum eFontStyle_Align {
@@ -2564,6 +2566,21 @@ struct ARegion *UI_tooltip_create_from_button(struct bContext *C,
struct ARegion *UI_tooltip_create_from_gizmo(struct bContext *C, struct wmGizmo *gz);
void UI_tooltip_free(struct bContext *C, struct bScreen *screen, struct ARegion *region);
+typedef struct {
+ /** A description for the item, e.g. what happens when selecting it. */
+ char description[UI_MAX_DRAW_STR];
+ /* The full name of the item, without prefixes or suffixes (e.g. hint with UI_SEP_CHARP). */
+ const char *name;
+ /** Additional info about the item (e.g. library name of a linked data-block). */
+ char hint[UI_MAX_DRAW_STR];
+} uiSearchItemTooltipData;
+
+struct ARegion *UI_tooltip_create_from_search_item_generic(
+ struct bContext *C,
+ const struct ARegion *searchbox_region,
+ const struct rcti *item_rect,
+ const uiSearchItemTooltipData *item_tooltip_data);
+
/* How long before a tool-tip shows. */
#define UI_TOOLTIP_DELAY 0.5
#define UI_TOOLTIP_DELAY_LABEL 0.2