diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-11 02:06:03 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-02-11 02:07:09 +0300 |
commit | 4f1e3875884506c017e03469658e9e7dadeeb500 (patch) | |
tree | ea3f5325a349ba3c749b7b5df6d0023329b070f4 /source/blender/editors/include/UI_interface.h | |
parent | d18993d4e457b195b2ebfc910dbaf14a023e1ec8 (diff) |
UI: add optional tip callback to uiBut, and use it for per-item tooltips in UIList.
When defined, uiBut->tip_func is called when button's tip is generated. This allows
for advanced, dynamic generation of tooltips.
For now, only used by UIList, which can now optionaly use a given string property
of each item for its tooltip.
Thanks to Campbell for the reviews!
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 590ab1d694d..b1bb48b58ed 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -348,6 +348,9 @@ typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origs typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); +/* Must return allocated string. */ +typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip); + typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); /* Menu Callbacks */ @@ -678,6 +681,8 @@ void UI_but_func_drawextra_set( void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), void *arg1, void *arg2); +void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN); + bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar, const void *rna_poin_data, const char *rna_prop_id); bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); @@ -907,7 +912,8 @@ void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color); #define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list" void uiTemplateList(uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id, struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr, - const char *active_propname, int rows, int maxrows, int layout_type, int columns); + const char *active_propname, const char *item_dyntip_propname, + int rows, int maxrows, int layout_type, int columns); void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input); void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); |