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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
/**
* $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) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifndef UI_INTERFACE_H
#define UI_INTERFACE_H
struct ID;
struct ListBase;
struct ARegion;
struct wmWindow;
struct wmWindowManager;
struct wmOperator;
struct AutoComplete;
struct bContext;
struct PointerRNA;
struct PropertyRNA;
struct ReportList;
/* uiBlock->dt */
#define UI_EMBOSS 0 /* use one of the themes for drawing */
#define UI_EMBOSSN 1 /* Nothing */
#define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */
#define UI_EMBOSSP 3 /* Pulldown */
#define UI_EMBOSSR 4 /* Rounded */
#define UI_EMBOSST 5 /* Table */
#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */
/* uiBlock->direction */
#define UI_TOP 1
#define UI_DOWN 2
#define UI_LEFT 4
#define UI_RIGHT 8
#define UI_DIRECTION 15
#define UI_CENTER 16
#define UI_SHIFT_FLIPPED 32
/* uiBlock->autofill */
#define UI_BLOCK_COLLUMNS 1
#define UI_BLOCK_ROWS 2
/* uiBlock->flag (controls) */
#define UI_BLOCK_LOOP 1
#define UI_BLOCK_REDRAW 2
#define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */
#define UI_BLOCK_NUMSELECT 8
#define UI_BLOCK_ENTER_OK 16
#define UI_BLOCK_NOSHADOW 32
#define UI_BLOCK_NO_HILITE 64 /* XXX 2.5 not implemented */
#define UI_BLOCK_MOVEMOUSE_QUIT 128
#define UI_BLOCK_KEEP_OPEN 256
/* uiMenuBlockHandle->menuretval */
#define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
#define UI_RETURN_OK 2 /* choice made */
#define UI_RETURN_OUT 4 /* left the menu */
/* block->flag bits 12-15 are identical to but->flag bits */
/* block->font, for now: bold = medium+1 */
#define UI_HELV 0
#define UI_HELVB 1
/* panel controls */
#define UI_PNL_TRANSP 1
#define UI_PNL_SOLID 2
#define UI_PNL_CLOSE 32
#define UI_PNL_STOW 64
#define UI_PNL_TO_MOUSE 128
#define UI_PNL_UNSTOW 256
#define UI_PNL_SCALE 512
/* warning the first 4 flags are internal */
/* but->flag */
#define UI_TEXT_LEFT 16
#define UI_ICON_LEFT 32
#define UI_ICON_RIGHT 64
/* control for button type block */
#define UI_MAKE_TOP 128
#define UI_MAKE_DOWN 256
#define UI_MAKE_LEFT 512
#define UI_MAKE_RIGHT 1024
/* dont draw hilite on mouse over */
#define UI_NO_HILITE 2048
/* button align flag, for drawing groups together */
#define UI_BUT_ALIGN (15<<12)
#define UI_BUT_ALIGN_TOP (1<<12)
#define UI_BUT_ALIGN_LEFT (1<<13)
#define UI_BUT_ALIGN_RIGHT (1<<14)
#define UI_BUT_ALIGN_DOWN (1<<15)
#define UI_BUT_DISABLED (1<<16)
/* Button types, bits stored in 1 value... and a short even!
- bits 0-4: bitnr (0-31)
- bits 5-7: pointer type
- bit 8: for 'bit'
- bit 9-15: button type (now 6 bits, 64 types)
*/
#define CHA 32
#define SHO 64
#define INT 96
#define FLO 128
#define FUN 192
#define BIT 256
#define BUTPOIN (128+64+32)
#define BUT (1<<9)
#define ROW (2<<9)
#define TOG (3<<9)
#define SLI (4<<9)
#define NUM (5<<9)
#define TEX (6<<9)
#define TOG3 (7<<9)
#define TOGR (8<<9)
#define TOGN (9<<9)
#define LABEL (10<<9)
#define MENU (11<<9)
#define ICONROW (12<<9)
#define ICONTOG (13<<9)
#define NUMSLI (14<<9)
#define COL (15<<9)
#define IDPOIN (16<<9)
#define HSVSLI (17<<9)
#define SCROLL (18<<9)
#define BLOCK (19<<9)
#define BUTM (20<<9)
#define SEPR (21<<9)
#define LINK (22<<9)
#define INLINK (23<<9)
#define KEYEVT (24<<9)
#define ICONTEXTROW (25<<9)
#define HSVCUBE (26<<9)
#define PULLDOWN (27<<9)
#define ROUNDBOX (28<<9)
#define CHARTAB (29<<9)
#define BUT_COLORBAND (30<<9)
#define BUT_NORMAL (31<<9)
#define BUT_CURVE (32<<9)
#define BUT_TOGDUAL (33<<9)
#define ICONTOGN (34<<9)
#define FTPREVIEW (35<<9)
#define NUMABS (36<<9)
#define BUTTYPE (63<<9)
typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
/* Common Drawing Functions */
void uiEmboss(float x1, float y1, float x2, float y2, int sel);
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
void uiSetRoundBox(int type);
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction);
void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
/* Popup Menu's */
typedef struct uiMenuBlockHandle {
/* internal */
struct ARegion *region;
int towardsx, towardsy;
double towardstime;
int dotowards;
int popup;
void (*popup_func)(struct bContext *C, void *arg, int event);
void *popup_arg;
/* for operator menus */
struct wmOperator *op_arg;
const char *propname;
/* return values */
int butretval;
int menuretval;
float retvalue;
float retvec[3];
} uiMenuBlockHandle;
typedef uiBlock* (*uiBlockFuncFP)(struct bContext *C, struct uiMenuBlockHandle *handle, void *arg1);
typedef void (*uiPupmenuFunc)(struct bContext *C, void *arg, int event);
void uiPupmenuSetActive(int val);
void uiPupmenuOperator(struct bContext *C, int maxrow, struct wmOperator *op, const char *propname, char *str);
void uiPupmenu(struct bContext *C, int maxrow, uiPupmenuFunc func, void *arg, char *str, ...);
void uiPupmenuOkee(struct bContext *C, char *opname, char *str, ...);
void uiPupmenuSaveOver(struct bContext *C, char *opname, char *filename, ...);
void uiPupmenuNotice(struct bContext *C, char *str, ...);
void uiPupmenuError(struct bContext *C, char *str, ...);
void uiPupmenuReports(struct bContext *C, struct ReportList *reports);
/* Block */
uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, char *name, short dt, short font);
void uiEndBlock(const struct bContext *C, uiBlock *block);
void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
uiBlock *uiGetBlock(char *name, struct ARegion *ar);
void uiFreeBlock(const struct bContext *C, uiBlock *block);
void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb);
void uiBoundsBlock(struct uiBlock *block, int addval);
void uiTextBoundsBlock(uiBlock *block, int addval);
void uiBlockSetButLock(uiBlock *block, int val, char *lockstr);
void uiBlockClearButLock(uiBlock *block);
/* automatic aligning, horiz or verical */
void uiBlockBeginAlign(uiBlock *block);
void uiBlockEndAlign(uiBlock *block);
/* Misc */
void uiSetCurFont(uiBlock *block, int index);
void *uiSetCurFont_ext(float aspect);
void uiDefFont(unsigned int index, void *xl, void *large, void *medium, void *small);
void uiComposeLinks(uiBlock *block);
uiBut *uiFindInlink(uiBlock *block, void *poin);
void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
/* Defining Buttons */
uiBut *uiDefBut(uiBlock *block,
int type, int retval, char *str,
short x1, short y1,
short x2, short y2,
void *poin,
float min, float max,
float a1, float a2, char *tip);
uiBut *uiDefButF(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButI(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButS(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButC(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButR(uiBlock *block, int type, int retval, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconBut(uiBlock *block,
int type, int retval, int icon,
short x1, short y1,
short x2, short y2,
void *poin,
float min, float max,
float a1, float a2, char *tip);
uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconTextBut(uiBlock *block,
int type, int retval, int icon, char *str,
short x1, short y1,
short x2, short y2,
void *poin,
float min, float max,
float a1, float a2, char *tip);
uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, float *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, int *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, short *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, char *str, short x1, short y1, short x2, short y2, char *poin, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, char *str, short x1, short y1, short x2, short y2, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, char *tip);
uiBut *uiDefIconTextButO(struct bContext *C, uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
typedef void (*uiIDPoinFuncFP) (struct bContext *C, char *str, struct ID **idpp);
uiBut *uiDefIDPoinBut(struct uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
short x1, short y1, short x2, short y2, void *idpp, char *tip);
uiBut *uiDefBlockBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefPulldownBut(uiBlock *block, uiBlockFuncFP func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockFuncFP func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
void uiAutoBlock(struct uiBlock *block,
float minx, float miny,
float sizex, float sizey, int flag);
void uiSetButLink(struct uiBut *but,
void **poin,
void ***ppoin,
short *tot,
int from, int to);
int uiBlocksGetYMin (ListBase *lb);
int uiBlockGetCol (uiBlock *block);
void* uiBlockGetCurFont (uiBlock *block);
void uiBlockSetCol (uiBlock *block, int col);
void uiBlockSetEmboss (uiBlock *block, int emboss);
void uiBlockSetDirection (uiBlock *block, int direction);
void uiBlockFlipOrder (uiBlock *block);
void uiBlockSetFlag (uiBlock *block, int flag);
void uiBlockSetXOfs (uiBlock *block, int xofs);
int uiButGetRetVal (uiBut *but);
void uiButSetFlag (uiBut *but, int flag);
void uiButClearFlag (uiBut *but, int flag);
struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
void uiBlockSetHandleFunc(uiBlock *block, void (*func)(struct bContext *C, void *arg, int event), void *arg);
void uiBlockSetButmFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg, int but_a2), void *arg);
void uiBlockSetFunc (uiBlock *block, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
void uiButSetFunc (uiBut *but, void (*func)(struct bContext *C, void *arg1, void *arg2), void *arg1, void *arg2);
void uiButSetCompleteFunc(uiBut *but, void (*func)(struct bContext *C, char *str, void *arg), void *arg);
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(struct bContext *C, uiBlock *block));
/* Panels */
extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
extern int uiNewPanel(const struct bContext *C, struct ARegion *ar, uiBlock *block, char *panelname, char *tabname, int ofsx, int ofsy, int sizex, int sizey);
extern void uiDrawPanels(const struct bContext *C, int re_align);
extern void uiSetPanelsView2d(struct ARegion *ar);
extern void uiMatchPanelsView2d(struct ARegion *ar);
extern void uiNewPanelHeight(struct uiBlock *block, int sizey);
extern void uiNewPanelTitle(struct uiBlock *block, char *str);
extern uiBlock *uiFindOpenPanelBlockName(ListBase *lb, char *name);
extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac);
extern void uiPanelControl(int);
extern void uiSetPanelHandler(int);
/* Autocomplete */
typedef struct AutoComplete AutoComplete;
AutoComplete *autocomplete_begin(char *startname, int maxlen);
void autocomplete_do_name(AutoComplete *autocpl, const char *name);
void autocomplete_end(AutoComplete *autocpl, char *autoname);
/* Handlers for regions with UI blocks */
void UI_add_region_handlers(struct ListBase *handlers);
void UI_add_area_handlers(struct ListBase *handlers);
void UI_add_popup_handlers(struct ListBase *handlers, uiMenuBlockHandle *menu);
/* Module initialization and exit */
void UI_init(void);
void UI_init_userdef(void);
void UI_exit(void);
#endif /* UI_INTERFACE_H */
|