4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 * The Original Code is Copyright (C) 2007 Blender Foundation.
21 * All rights reserved.
24 * Contributor(s): Blender Foundation
26 * ***** END GPL LICENSE BLOCK *****
28 #ifndef DNA_WINDOWMANAGER_TYPES_H
29 #define DNA_WINDOWMANAGER_TYPES_H
31 #include "DNA_listBase.h"
32 #include "DNA_vec_types.h"
37 struct wmWindowManager;
41 struct wmOperatorType;
51 /* windowmanager is saved, tag WMAN */
52 typedef struct wmWindowManager {
55 struct wmWindow *windrawable, *winactive; /* separate active from drawable */
58 int initialized; /* set on file read */
61 ListBase operators; /* operator registry */
63 ListBase queue; /* refresh/redraw wmNotifier structs */
66 ListBase windowkeymap;
67 ListBase screenkeymap;
73 /* the savable part, rest of data is local in ghostwinlay */
74 typedef struct wmWindow {
75 struct wmWindow *next, *prev;
77 void *ghostwin; /* dont want to include ghost.h stuff */
81 int winid; /* winid also in screens, is for retrieving this window after read */
83 struct bScreen *screen; /* active screen */
84 char screenname[32]; /* MAX_ID_NAME for matching window with active screen after file read */
86 short posx, posy, sizex, sizey; /* window coords */
87 short windowstate; /* borderless, full */
88 short monitor; /* multiscreen... no idea how to store yet */
89 short active; /* set to 1 if an active window, for quick rejects */
90 short cursor; /* current mouse cursor type */
92 struct wmEvent *eventstate; /* storage for event system */
94 struct wmSubWindow *curswin; /* internal for wm_subwindow.c only */
96 ListBase queue; /* all events (ghost level events were handled) */
97 ListBase handlers; /* window+screen handlers, overriding all queues */
99 ListBase subwindows; /* opengl stuff for sub windows, see notes in wm_subwindow.c */
105 typedef struct wmOperatorType {
106 struct wmOperatorType *next, *prev;
108 char *name; /* text for ui, undo */
109 char *idname; /* unique identifier */
111 /* this callback alters UI, adds handlers, uses cb's below */
112 int (*interactive)(struct bContext *, struct wmOperator *, struct wmEvent *event);
114 void (*init)(struct bContext *, struct wmOperator *);
115 int (*exec)(struct bContext *, struct wmOperator *);
116 void (*exit)(struct bContext *, struct wmOperator *);
118 int (*poll)(struct bContext *);
120 void *(*uiBlock)(struct wmOperator *); /* panel for redo or repeat */
122 char *customname; /* dna name */
123 void *customdata; /* defaults */
129 #define OP_MAX_TYPENAME 64
131 /* partial copy of the event, for matching by eventhandler */
132 typedef struct wmKeymapItem {
133 struct wmKeymapItem *next, *prev;
135 char idname[64]; /* used to retrieve operator type pointer */
137 short type; /* event code itself */
138 short val; /* 0=any, 1=click, 2=release, or wheelvalue, or... */
139 short shift, ctrl, alt, oskey; /* oskey is apple or windowskey, value denotes order of pressed */
140 short keymodifier; /* rawkey modifier */
146 /* this one is the operator itself, stored in files for macros etc */
147 /* operator + operatortype should be able to redo entirely, but for different contextes */
148 typedef struct wmOperator {
149 struct wmOperator *next, *prev;
151 wmOperatorType *type;
152 char idname[64]; /* used to retrieve type pointer */
154 /* default storage (lazy?) */
159 /* custom storage, dna pointer */
160 void *customdata; /* XXX dynamic properties! */
167 #endif /* DNA_WINDOWMANAGER_TYPES_H */