diff options
Diffstat (limited to 'source/blender/windowmanager/WM_types.h')
-rw-r--r-- | source/blender/windowmanager/WM_types.h | 119 |
1 files changed, 106 insertions, 13 deletions
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 891ed8358fb..78125954816 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -31,9 +31,13 @@ struct bContext; struct wmEvent; struct wmWindowManager; +struct uiLayout; +struct wmOperator; -/* exported types for WM */ +#include "RNA_types.h" +#include "DNA_listBase.h" +/* exported types for WM */ #include "wm_cursors.h" #include "wm_event_types.h" @@ -82,6 +86,8 @@ enum { #define KM_NOTHING 0 #define KM_PRESS 1 #define KM_RELEASE 2 +#define KM_CLICK 3 +#define KM_DBL_CLICK 4 /* ************** UI Handler ***************** */ @@ -135,6 +141,7 @@ typedef struct wmNotifier { #define NC_SPACE (15<<24) #define NC_GEOM (16<<24) #define NC_NODE (17<<24) +#define NC_ID (18<<24) /* data type, 256 entries is enough, it can overlap */ #define NOTE_DATA 0x00FF0000 @@ -166,6 +173,7 @@ typedef struct wmNotifier { #define ND_KEYINGSET (12<<16) #define ND_SCENEDELETE (13<<16) #define ND_LAYER (14<<16) +#define ND_SEQUENCER_SELECT (15<<16) /* NC_OBJECT Object */ #define ND_TRANSFORM (16<<16) @@ -214,7 +222,6 @@ typedef struct wmNotifier { /* NC_NODE Nodes */ #define ND_NODE_SELECT (1<<16) - /* NC_SPACE */ #define ND_SPACE_CONSOLE (1<<16) /* general redraw */ #define ND_SPACE_CONSOLE_REPORT (2<<16) /* update for reports, could specify type */ @@ -238,17 +245,17 @@ typedef struct wmNotifier { #define NOTE_SUBTYPE 0x0000FF00 /* subtype scene mode */ -#define NS_MODE_OBJECT (1<<8) - -#define NS_EDITMODE_MESH (2<<8) -#define NS_EDITMODE_CURVE (3<<8) -#define NS_EDITMODE_SURFACE (4<<8) -#define NS_EDITMODE_TEXT (5<<8) -#define NS_EDITMODE_MBALL (6<<8) -#define NS_EDITMODE_LATTICE (7<<8) +#define NS_MODE_OBJECT (1<<8) + +#define NS_EDITMODE_MESH (2<<8) +#define NS_EDITMODE_CURVE (3<<8) +#define NS_EDITMODE_SURFACE (4<<8) +#define NS_EDITMODE_TEXT (5<<8) +#define NS_EDITMODE_MBALL (6<<8) +#define NS_EDITMODE_LATTICE (7<<8) #define NS_EDITMODE_ARMATURE (8<<8) -#define NS_MODE_POSE (9<<8) -#define NS_MODE_PARTICLE (10<<8) +#define NS_MODE_POSE (9<<8) +#define NS_MODE_PARTICLE (10<<8) /* action classification */ @@ -257,7 +264,7 @@ typedef struct wmNotifier { #define NA_EVALUATED 2 #define NA_ADDED 3 #define NA_REMOVED 4 - +#define NA_RENAME 5 /* ************** Gesture Manager data ************** */ @@ -285,6 +292,44 @@ typedef struct wmGesture { /* customdata for lasso is short array */ } wmGesture; +/* ************** wmEvent ************************ */ + +/* each event should have full modifier state */ +/* event comes from eventmanager and from keymap */ +typedef struct wmEvent { + struct wmEvent *next, *prev; + + short type; /* event code itself (short, is also in keymap) */ + short val; /* press, release, scrollvalue */ + short x, y; /* mouse pointer position, screen coord */ + short mval[2]; /* region mouse position, name convention pre 2.5 :) */ + short unicode; /* future, ghost? */ + char ascii; /* from ghost */ + char pad; + + /* previous state */ + short prevtype; + short prevval; + short prevx, prevy; + double prevclicktime; + + /* modifier states */ + short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */ + short keymodifier; /* rawkey modifier */ + + short pad1; + + /* keymap item, set by handler (weak?) */ + const char *keymap_idname; + + /* custom data */ + short custom; /* custom data type, stylus, 6dof, see wm_event_types.h */ + short customdatafree; + int pad2; + void *customdata; /* ascii, unicode, mouse coords, angles, vectors, dragdrop info */ + +} wmEvent; + /* ************** custom wmEvent data ************** */ typedef struct wmTabletData { int Active; /* 0=EVT_TABLET_NONE, 1=EVT_TABLET_STYLUS, 2=EVT_TABLET_ERASER */ @@ -312,6 +357,54 @@ typedef struct wmTimer { } wmTimer; +typedef struct wmOperatorType { + struct wmOperatorType *next, *prev; + + char *name; /* text for ui, undo */ + char *idname; /* unique identifier */ + char *description; /* tooltips and python docs */ + + /* this callback executes the operator without any interactive input, + * parameters may be provided through operator properties. cannot use + * any interface code or input device state. + * - see defines below for return values */ + int (*exec)(struct bContext *, struct wmOperator *); + + /* for modal temporary operators, initially invoke is called. then + * any further events are handled in modal. if the operation is + * cancelled due to some external reason, cancel is called + * - see defines below for return values */ + int (*invoke)(struct bContext *, struct wmOperator *, struct wmEvent *); + int (*cancel)(struct bContext *, struct wmOperator *); + int (*modal)(struct bContext *, struct wmOperator *, struct wmEvent *); + + /* verify if the operator can be executed in the current context, note + * that the operator might still fail to execute even if this return true */ + int (*poll)(struct bContext *); + + /* optional panel for redo and repeat, autogenerated if not set */ + void (*ui)(struct bContext *, struct wmOperator *); + + /* rna for properties */ + struct StructRNA *srna; + + /* struct wmOperatorTypeMacro */ + ListBase macro; + + short flag; + + /* pointer to modal keymap, do not free! */ + struct wmKeyMap *modalkeymap; + + /* only used for operators defined with python + * use to store pointers to python functions */ + void *pyop_data; + int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot); + + /* RNA integration */ + ExtensionRNA ext; +} wmOperatorType; + /* **************** Paint Cursor ******************* */ typedef void (*wmPaintCursorDraw)(struct bContext *C, int, int, void *customdata); |