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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-10-25 16:07:00 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-10-25 17:57:26 +0300
commite8027ec2a0cac4b0e92d51a64ccc40fd3f190a20 (patch)
treebe3299dd91f1c764847189485502f0919854f352 /source/blender/windowmanager/WM_types.h
parent2a7b9f2d45c345ee910a430e7035fd3d406de8f7 (diff)
UI Drag Drop: allow customizable drawing
No functional changes. This commit adds 3 callbacks for `wmDropBox` which allow custom drawing without affecting the internal dropbox API. Differential Revision: https://developer.blender.org/D12948
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r--source/blender/windowmanager/WM_types.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index f4595869baf..bbfc9d53e44 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -1020,7 +1020,7 @@ typedef struct wmDragAssetListItem {
typedef char *(*WMDropboxTooltipFunc)(struct bContext *,
struct wmDrag *,
- const struct wmEvent *event,
+ const int xy[2],
struct wmDropBox *drop);
typedef struct wmDrag {
@@ -1038,8 +1038,11 @@ typedef struct wmDrag {
float scale;
int sx, sy;
- /** If filled, draws operator tooltip/operator name. */
- char tooltip[200];
+ /** Informs which dropbox is activated with the drag item.
+ * When this value changes, the #draw_activate and #draw_deactivate dropbox callbacks are
+ * triggered.
+ */
+ struct wmDropBox *active_dropbox;
unsigned int flags;
/** List of wmDragIDs, all are guaranteed to have the same ID type. */
@@ -1067,6 +1070,18 @@ typedef struct wmDropBox {
*/
void (*cancel)(struct Main *, struct wmDrag *, struct wmDropBox *);
+ /** Override the default drawing function. */
+ void (*draw)(struct bContext *, struct wmWindow *, struct wmDrag *, const int *);
+
+ /** Called when pool returns true the first time. */
+ void (*draw_activate)(struct wmDropBox *, struct wmDrag *drag);
+
+ /** Called when pool returns false the first time or when the drag event ends. */
+ void (*draw_deactivate)(struct wmDropBox *, struct wmDrag *drag);
+
+ /** Custom data for drawing. */
+ void *draw_data;
+
/** Custom tooltip shown during dragging. */
WMDropboxTooltipFunc tooltip;