diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-08-02 16:09:15 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-08-02 16:13:21 +0300 |
commit | d60a7a87445c140a42b6470ef2c54c411d8e4bf3 (patch) | |
tree | 5c6c61b07c5fe2f03d99d2262967315f9c9e4963 /source/blender/windowmanager/WM_api.h | |
parent | 8edb2222ae0c954771a9cddc2d8c02a7a4d68eae (diff) |
WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.
The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.
NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D12104
Diffstat (limited to 'source/blender/windowmanager/WM_api.h')
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index c0d408be2e0..136c639caea 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -34,6 +34,7 @@ #include "BLI_sys_types.h" #include "DNA_windowmanager_types.h" #include "WM_keymap.h" +#include "WM_types.h" #ifdef __cplusplus extern "C" { @@ -705,13 +706,13 @@ void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx, i void WM_drag_free(struct wmDrag *drag); void WM_drag_data_free(int dragtype, void *poin); void WM_drag_free_list(struct ListBase *lb); - struct wmDropBox *WM_dropbox_add( ListBase *lb, const char *idname, - bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event, const char **), + bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event), void (*copy)(struct wmDrag *, struct wmDropBox *), - void (*cancel)(struct Main *, struct wmDrag *, struct wmDropBox *)); + void (*cancel)(struct Main *, struct wmDrag *, struct wmDropBox *), + WMDropboxTooltipFunc tooltip); ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid); /* ID drag and drop */ |