diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-30 18:27:54 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-30 18:46:59 +0300 |
commit | 17a67bf778b87d0d24adfac3bd89bc8d3300c741 (patch) | |
tree | 8eded550236046978c8fa93c498a50b0e6ccad08 /source/blender/editors/interface/interface_intern.h | |
parent | ca12d70af0ff4397ed1ce9b5d7d1adadb06e569c (diff) |
UI: custom free function improvements
This changes `UI_but_func_tooltip_set` so that it allows passing a custom free function, which has two benefits:
* The caller can pass `null` to indicate that the value should not be freed.
* Arbitrary c++ data can be passed to the callback (before the struct had to be trivially destructible).
I added `uiFreeArgFunc` and used it in other places where appropriate.
Differential Revision: https://developer.blender.org/D11738
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 97b9bb66f07..b9a44b5bce9 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -221,7 +221,8 @@ struct uiBut { const char *tip; uiButToolTipFunc tip_func; - void *tip_argN; + void *tip_arg; + uiFreeArgFunc tip_arg_free; /** info on why button is disabled, displayed in tooltip */ const char *disabled_info; @@ -316,7 +317,7 @@ typedef struct uiButSearch { void *item_active; void *arg; - uiButSearchArgFreeFn arg_free_fn; + uiFreeArgFunc arg_free_fn; uiButSearchContextMenuFn item_context_menu_fn; uiButSearchTooltipFn item_tooltip_fn; @@ -704,7 +705,7 @@ struct uiPopupBlockCreate { uiBlockCreateFunc create_func; uiBlockHandleCreateFunc handle_create_func; void *arg; - void (*arg_free)(void *arg); + uiFreeArgFunc arg_free; int event_xy[2]; @@ -828,7 +829,7 @@ uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg, - void (*arg_free)(void *arg)); + uiFreeArgFunc arg_free); uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C, struct ARegion *butregion, uiBut *but, |