2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * Contributor(s): Blender Foundation
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file DNA_screen_types.h
30 #ifndef __DNA_SCREEN_TYPES_H__
31 #define __DNA_SCREEN_TYPES_H__
33 #include "DNA_listBase.h"
34 #include "DNA_view2d_types.h"
35 #include "DNA_vec_types.h"
49 typedef struct bScreen {
52 ListBase vertbase; /* screens have vertices/edges to define areas */
55 ListBase regionbase; /* screen level regions (menus), runtime only */
58 struct Scene *newscene; /* temporary when switching */
60 int redraws_flag; /* user-setting for which editors get redrawn during anim playback (used to be time->redraws) */
63 short full; /* temp screen for image render display or fileselect */
64 short temp; /* temp screen in a temp window, don't save (like user prefs) */
65 short winid; /* winid from WM, starts with 1 */
66 short do_draw; /* notifier for drawing edges */
67 short do_refresh; /* notifier for scale screen, changed screen, etc */
68 short do_draw_gesture; /* notifier for gesture draw. */
69 short do_draw_paintcursor; /* notifier for paint cursor draw. */
70 short do_draw_drag; /* notifier for dragging draw. */
71 short swap; /* indicator to survive swap-exchange systems */
73 short mainwin; /* screensize subwindow, for screenedges and global menus */
74 short subwinactive; /* active subwindow */
78 struct wmTimer *animtimer; /* if set, screen has timer handler added in window */
79 void *context; /* context callback */
82 typedef struct ScrVert {
83 struct ScrVert *next, *prev, *newv;
85 /* first one used internally, second one for tools */
89 typedef struct ScrEdge {
90 struct ScrEdge *next, *prev;
92 short border; /* 1 when at edge of screen */
97 typedef struct Panel { /* the part from uiBlock that needs saved in file */
98 struct Panel *next, *prev;
100 struct PanelType *type; /* runtime */
101 struct uiLayout *layout; /* runtime for drawing */
103 char panelname[64], tabname[64]; /* defined as UI_MAX_NAME_STR */
104 char drawname[64]; /* panelname is identifier for restoring location */
105 int ofsx, ofsy, sizex, sizey;
107 short flag, runtime_flag;
110 int sortorder; /* panels are aligned according to increasing sortorder */
111 struct Panel *paneltab; /* this panel is tabbed in *paneltab */
112 void *activedata; /* runtime for panel manipulation */
115 /* uiList dynamic data... */
116 /* These two Lines with # tell makesdna this struct can be excluded. */
119 typedef struct uiListDyn {
120 int height; /* Number of rows needed to draw all elements. */
121 int visual_height; /* Actual visual height of the list (in rows). */
122 int visual_height_min; /* Minimal visual height of the list (in rows). */
124 int items_len; /* Number of items in collection. */
125 int items_shown; /* Number of items actually visible after filtering. */
128 typedef struct uiList { /* some list UI data need to be saved in file */
129 struct uiList *next, *prev;
131 struct uiListType *type; /* runtime */
133 char list_id[64]; /* defined as UI_MAX_NAME_STR */
135 int layout_type; /* How items are layedout in the list */
143 /* Dynamic data (runtime). */
147 typedef struct ScrArea {
148 struct ScrArea *next, *prev;
150 ScrVert *v1, *v2, *v3, *v4; /* ordered (bl, tl, tr, br) */
151 bScreen *full; /* if area==full, this is the parent */
153 rcti totrct; /* rect bound by v1 v2 v3 v4 */
155 char spacetype, butspacetype; /* SPACE_..., butspacetype is button arg */
156 short winx, winy; /* size */
158 short headertype; /* OLD! 0=no header, 1= down, 2= up */
159 short do_refresh; /* private, for spacetype refresh callback */
161 short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW'
162 * runtuime variable, updated by executing operators */
165 struct SpaceType *type; /* callbacks for this space type */
167 ListBase spacedata; /* SpaceLink */
168 ListBase regionbase; /* ARegion */
169 ListBase handlers; /* wmEventHandler */
171 ListBase actionzones; /* AZone */
174 typedef struct ARegion {
175 struct ARegion *next, *prev;
177 View2D v2d; /* 2D-View scrolling/zoom info (most regions are 2d anyways) */
178 rcti winrct; /* coordinates of region */
179 rcti drawrct; /* runtime for partial redraw, same or smaller than winrct */
180 short winx, winy; /* size */
183 short regiontype; /* window, header, etc. identifier for drawing */
184 short alignment; /* how it should split */
185 short flag; /* hide, ... */
187 float fsize; /* current split size in float (unused) */
188 short sizex, sizey; /* current split size in pixels (if zero it uses regiontype) */
190 short do_draw; /* private, cached notifier events */
191 short do_draw_overlay; /* private, cached notifier events */
192 short swap; /* private, indicator to survive swap-exchange */
193 short overlap; /* private, set for indicate drawing overlapped */
196 struct ARegionType *type; /* callbacks for this region type */
198 ListBase uiblocks; /* uiBlock */
199 ListBase panels; /* Panel */
200 ListBase ui_lists; /* uiList */
201 ListBase handlers; /* wmEventHandler */
203 struct wmTimer *regiontimer; /* blend in/out */
205 char *headerstr; /* use this string to draw info */
206 void *regiondata; /* XXX 2.50, need spacedata equivalent? */
210 #define WIN_BACK_OK 1
211 #define WIN_FRONT_OK 2
212 // #define WIN_EQUAL 3 // UNUSED
215 #define HEADER_NO_PULLDOWN 1
216 #define AREA_FLAG_DRAWJOINTO 2
217 #define AREA_FLAG_DRAWJOINFROM 4
218 #define AREA_TEMP_INFO 8
219 #define AREA_FLAG_DRAWSPLIT_H 16
220 #define AREA_FLAG_DRAWSPLIT_V 32
226 #define AREAMINY (HEADERY+EDGEWIDTH)
232 #define SCREENNORMAL 0
236 /* Panel->snap - for snapping to screen edges */
237 #define PNL_SNAP_NONE 0
238 /* #define PNL_SNAP_TOP 1 */
239 /* #define PNL_SNAP_RIGHT 2 */
240 #define PNL_SNAP_BOTTOM 4
241 /* #define PNL_SNAP_LEFT 8 */
243 /* #define PNL_SNAP_DIST 9.0 */
246 #define PNL_DEFAULT_CLOSED 1
247 #define PNL_NO_HEADER 2
249 /* uiList layout_type */
251 UILST_LAYOUT_DEFAULT = 0,
252 UILST_LAYOUT_COMPACT = 1,
253 UILST_LAYOUT_GRID = 2,
258 UILST_SCROLL_TO_ACTIVE_ITEM = 1 << 0, /* Scroll list to make active item visible. */
261 /* regiontype, first two are the default set */
262 /* Do NOT change order, append on end. Types are hardcoded needed */
266 RGN_TYPE_CHANNELS = 2,
267 RGN_TYPE_TEMPORARY = 3,
270 RGN_TYPE_TOOL_PROPS = 6,
274 /* region alignment */
275 #define RGN_ALIGN_NONE 0
276 #define RGN_ALIGN_TOP 1
277 #define RGN_ALIGN_BOTTOM 2
278 #define RGN_ALIGN_LEFT 3
279 #define RGN_ALIGN_RIGHT 4
280 #define RGN_ALIGN_HSPLIT 5
281 #define RGN_ALIGN_VSPLIT 6
282 #define RGN_ALIGN_FLOAT 7
283 #define RGN_ALIGN_QSPLIT 8
285 #define RGN_SPLIT_PREV 32
288 #define RGN_FLAG_HIDDEN 1
289 #define RGN_FLAG_TOO_SMALL 2
293 #define RGN_DRAW_PARTIAL 2