2 * blenlib/BKE_screen.h (mar-2001 nzc)
6 * ***** BEGIN GPL LICENSE BLOCK *****
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
23 * All rights reserved.
25 * The Original Code is: all of this file.
27 * Contributor(s): none yet.
29 * ***** END GPL LICENSE BLOCK *****
36 struct bContextDataMember;
37 struct bContextDataResult;
44 struct wmWindowManager;
46 /* spacetype has everything stored to get an editor working, it gets initialized via
47 ED_spacetypes_init() in editors/area/spacetypes.c */
48 /* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */
50 #define BKE_ST_MAXNAME 32
52 typedef struct SpaceType {
53 struct SpaceType *next, *prev;
55 char name[BKE_ST_MAXNAME]; /* for menus */
56 int spaceid; /* unique space identifier */
57 int iconid; /* icon lookup for menus */
59 /* initial allocation, after this WM will call init() too */
60 struct SpaceLink *(*new)(const struct bContext *C);
61 /* not free spacelink itself */
62 void (*free)(struct SpaceLink *);
64 /* init is to cope with file load, screen (size) changes, check handlers */
65 void (*init)(struct wmWindowManager *, struct ScrArea *);
66 /* Listeners can react to bContext changes */
67 void (*listener)(struct ARegion *, struct wmNotifier *);
69 /* after a spacedata copy, an init should result in exact same situation */
70 struct SpaceLink *(*duplicate)(struct SpaceLink *);
72 /* register operator types on startup */
73 void (*operatortypes)(void);
74 /* add default items to WM keymap */
75 void (*keymap)(struct wmWindowManager *);
76 /* sets default cursor per region */
77 void (*cursor)(struct wmWindow *win, struct ARegion *ar);
79 /* return context data */
80 int (*context)(const struct bContext *, const struct bContextDataMember *, struct bContextDataResult *);
82 /* region type definitions */
85 /* read and write... */
87 /* default keymaps to add */
92 /* region types are also defined using spacetypes_init, via a callback */
94 typedef struct ARegionType {
95 struct ARegionType *next, *prev;
97 int regionid; /* unique identifier within this space */
99 /* add handlers, stuff you only do once or on area/region type/size changes */
100 void (*init)(struct wmWindowManager *, struct ARegion *);
101 /* draw entirely, view changes should be handled here */
102 void (*draw)(const struct bContext *, struct ARegion *);
103 /* contextual changes should be handled here */
104 void (*listener)(struct ARegion *, struct wmNotifier *);
106 void (*free)(struct ARegion *);
108 /* register operator types on startup */
109 void (*operatortypes)(void);
110 /* add own items to keymap */
111 void (*keymap)(struct wmWindowManager *);
113 /* return context data */
114 int (*context)(const struct bContext *, const struct bContextDataMember *, struct bContextDataResult *);
116 /* hardcoded constraints, smaller than these values region is not visible */
117 int minsizex, minsizey;
118 /* default keymaps to add */
124 struct SpaceType *BKE_spacetype_from_id(int spaceid);
125 const struct ListBase *BKE_spacetypes_list(void);
126 void BKE_spacetype_register(struct SpaceType *st);
127 void BKE_spacetypes_free(void); /* only for quitting blender */
130 void BKE_spacedata_freelist(ListBase *lb);
131 void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2);
134 struct ARegion *BKE_area_region_copy(struct ARegion *ar);
135 void BKE_area_region_free(struct ARegion *ar);
137 void BKE_screen_area_free(struct ScrArea *sa);
139 void free_screen(struct bScreen *sc);