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:
authorJeroen Bakker <jeroen@blender.org>2021-08-02 16:09:15 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-02 16:13:21 +0300
commitd60a7a87445c140a42b6470ef2c54c411d8e4bf3 (patch)
tree5c6c61b07c5fe2f03d99d2262967315f9c9e4963 /source/blender/windowmanager/WM_types.h
parent8edb2222ae0c954771a9cddc2d8c02a7a4d68eae (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_types.h')
-rw-r--r--source/blender/windowmanager/WM_types.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 4ead0b2699c..4d6cb941347 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -114,6 +114,7 @@ struct bContext;
struct wmEvent;
struct wmOperator;
struct wmWindowManager;
+struct wmDrag;
#include "BLI_compiler_attrs.h"
#include "DNA_listBase.h"
@@ -934,6 +935,10 @@ typedef struct wmDragAsset {
int import_type; /* eFileAssetImportType */
} wmDragAsset;
+typedef char *(*WMDropboxTooltipFunc)(struct bContext *,
+ struct wmDrag *,
+ const struct wmEvent *event);
+
typedef struct wmDrag {
struct wmDrag *next, *prev;
@@ -949,8 +954,8 @@ typedef struct wmDrag {
float scale;
int sx, sy;
- /** If set, draws operator name. */
- char opname[200];
+ /** If filled, draws operator tooltip/operator name. */
+ char tooltip[200];
unsigned int flags;
/** List of wmDragIDs, all are guaranteed to have the same ID type. */
@@ -964,8 +969,8 @@ typedef struct wmDrag {
typedef struct wmDropBox {
struct wmDropBox *next, *prev;
- /** Test if the dropbox is active, then can print optype name. */
- bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *, const char **);
+ /** Test if the dropbox is active. */
+ bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *);
/** Before exec, this copies drag info to #wmDrop properties. */
void (*copy)(struct wmDrag *, struct wmDropBox *);
@@ -976,6 +981,9 @@ typedef struct wmDropBox {
*/
void (*cancel)(struct Main *, struct wmDrag *, struct wmDropBox *);
+ /** Custom tooltip shown during dragging. */
+ WMDropboxTooltipFunc tooltip;
+
/**
* If poll succeeds, operator is called.
* Not saved in file, so can be pointer.