1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
/**
* $Id:
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The Original Code is Copyright (C) 2007 Blender Foundation.
* All rights reserved.
*
*
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef DNA_WINDOWMANAGER_TYPES_H
#define DNA_WINDOWMANAGER_TYPES_H
#include "DNA_listBase.h"
#include "DNA_vec_types.h"
#include "DNA_ID.h"
/* defined here: */
struct wmWindowManager;
struct wmWindow;
struct wmEvent;
struct wmOperatorType;
struct wmOperator;
/* forwards */
struct bContext;
struct wmLocal;
struct bScreen;
struct uiBlock;
struct wmSubWindow;
struct StructRNA;
struct PointerRNA;
/* windowmanager is saved, tag WMAN */
typedef struct wmWindowManager {
ID id;
struct wmWindow *windrawable, *winactive; /* separate active from drawable */
ListBase windows;
int initialized; /* set on file read */
int pad;
ListBase operators; /* operator registry */
ListBase queue; /* refresh/redraw wmNotifier structs */
ListBase reports; /* information and error reports */
/* custom keymaps */
ListBase windowkeymap;
ListBase screenkeymap;
ListBase uikeymap;
ListBase timekeymap;
} wmWindowManager;
/* the savable part, rest of data is local in ghostwinlay */
typedef struct wmWindow {
struct wmWindow *next, *prev;
void *ghostwin; /* dont want to include ghost.h stuff */
int winid, pad; /* winid also in screens, is for retrieving this window after read */
struct bScreen *screen; /* active screen */
char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */
short posx, posy, sizex, sizey; /* window coords */
short windowstate; /* borderless, full */
short monitor; /* multiscreen... no idea how to store yet */
short active; /* set to 1 if an active window, for quick rejects */
short cursor; /* current mouse cursor type */
struct wmEvent *eventstate; /* storage for event system */
struct wmSubWindow *curswin; /* internal for wm_subwindow.c only */
ListBase queue; /* all events (ghost level events were handled) */
ListBase handlers; /* window+screen handlers, overriding all queues */
ListBase modalops; /* wmOperator, operators running modal */
ListBase subwindows; /* opengl stuff for sub windows, see notes in wm_subwindow.c */
ListBase gesture; /* gesture stuff */
} wmWindow;
#
#
typedef struct wmOperatorType {
struct wmOperatorType *next, *prev;
char *name; /* text for ui, undo */
char *idname; /* unique identifier */
/* 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 *);
/* panel for redo and repeat */
void *(*uiBlock)(struct wmOperator *);
/* rna for properties */
struct StructRNA *rna;
short flag;
} wmOperatorType;
#define OP_MAX_TYPENAME 64
/* partial copy of the event, for matching by eventhandler */
typedef struct wmKeymapItem {
struct wmKeymapItem *next, *prev;
char idname[64]; /* used to retrieve operator type pointer */
short type; /* event code itself */
short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */
short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
short keymodifier; /* rawkey modifier */
short pad;
} wmKeymapItem;
/* this one is the operator itself, stored in files for macros etc */
/* operator + operatortype should be able to redo entirely, but for different contextes */
typedef struct wmOperator {
struct wmOperator *next, *prev;
wmOperatorType *type;
char idname[64]; /* used to retrieve type pointer */
/* custom storage, dna pointer */
void *customdata;
/* or IDproperty list */
IDProperty *properties;
/* runtime */
struct PointerRNA *rna;
ListBase *modallist;
} wmOperator;
/* operator type exec(), invoke() modal(), return values */
#define OPERATOR_RUNNING_MODAL 1
#define OPERATOR_CANCELLED 2
#define OPERATOR_FINISHED 4
/* add this flag if the event should pass through */
#define OPERATOR_PASS_THROUGH 8
#endif /* DNA_WINDOWMANAGER_TYPES_H */
|