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) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 #ifndef UI_INTERFACE_H
31 #define UI_INTERFACE_H
33 /* Struct Declarations */
41 struct wmWindowManager;
57 typedef struct uiBut uiBut;
58 typedef struct uiBlock uiBlock;
59 typedef struct uiPopupBlockHandle uiPopupBlockHandle;
60 typedef struct uiLayout uiLayout;
65 #define UI_EMBOSS 0 /* use widget style for drawing */
66 #define UI_EMBOSSN 1 /* Nothing, only icon and/or text */
67 #define UI_EMBOSSP 2 /* Pulldown menu style */
68 #define UI_EMBOSST 3 /* Table */
70 /* uiBlock->direction */
75 #define UI_DIRECTION 15
77 #define UI_SHIFT_FLIPPED 32
79 /* uiBlock->autofill (not yet used) */
80 #define UI_BLOCK_COLLUMNS 1
81 #define UI_BLOCK_ROWS 2
83 /* uiBlock->flag (controls) */
84 #define UI_BLOCK_LOOP 1
85 #define UI_BLOCK_REDRAW 2
86 #define UI_BLOCK_RET_1 4 /* XXX 2.5 not implemented */
87 #define UI_BLOCK_NUMSELECT 8
88 #define UI_BLOCK_ENTER_OK 16
89 #define UI_BLOCK_NOSHADOW 32
90 #define UI_BLOCK_UNUSED 64
91 #define UI_BLOCK_MOVEMOUSE_QUIT 128
92 #define UI_BLOCK_KEEP_OPEN 256
93 #define UI_BLOCK_POPUP 512
95 /* uiPopupBlockHandle->menuretval */
96 #define UI_RETURN_CANCEL 1 /* cancel all menus cascading */
97 #define UI_RETURN_OK 2 /* choice made */
98 #define UI_RETURN_OUT 4 /* left the menu */
100 /* block->flag bits 12-15 are identical to but->flag bits */
103 #define UI_PNL_TRANSP 1
104 #define UI_PNL_SOLID 2
106 #define UI_PNL_CLOSE 32
107 #define UI_PNL_STOW 64
108 #define UI_PNL_TO_MOUSE 128
109 #define UI_PNL_UNSTOW 256
110 #define UI_PNL_SCALE 512
112 /* warning the first 6 flags are internal */
114 #define UI_TEXT_LEFT 64
115 #define UI_ICON_LEFT 128
116 #define UI_ICON_SUBMENU 256
117 /* control for button type block */
118 #define UI_MAKE_TOP 512
119 #define UI_MAKE_DOWN 1024
120 #define UI_MAKE_LEFT 2048
121 #define UI_MAKE_RIGHT 4096
123 /* button align flag, for drawing groups together */
124 #define UI_BUT_ALIGN (15<<14)
125 #define UI_BUT_ALIGN_TOP (1<<14)
126 #define UI_BUT_ALIGN_LEFT (1<<15)
127 #define UI_BUT_ALIGN_RIGHT (1<<16)
128 #define UI_BUT_ALIGN_DOWN (1<<17)
130 #define UI_BUT_DISABLED (1<<18)
131 #define UI_BUT_UNUSED (1<<19)
132 #define UI_BUT_ANIMATED (1<<20)
133 #define UI_BUT_ANIMATED_KEY (1<<21)
134 #define UI_BUT_DRIVEN (1<<22)
135 #define UI_BUT_INACTIVE (1<<23)
137 #define UI_PANEL_WIDTH 340
138 #define UI_COMPACT_PANEL_WIDTH 160
140 /* Button types, bits stored in 1 value... and a short even!
141 - bits 0-4: bitnr (0-31)
142 - bits 5-7: pointer type
144 - bit 9-15: button type (now 6 bits, 64 types)
154 #define BUTPOIN (128+64+32)
165 #define LABEL (10<<9)
167 #define ICONROW (12<<9)
168 #define ICONTOG (13<<9)
169 #define NUMSLI (14<<9)
171 #define IDPOIN (16<<9)
172 #define HSVSLI (17<<9)
173 #define SCROLL (18<<9)
174 #define BLOCK (19<<9)
178 #define INLINK (23<<9)
179 #define KEYEVT (24<<9)
180 #define ICONTEXTROW (25<<9)
181 #define HSVCUBE (26<<9)
182 #define PULLDOWN (27<<9)
183 #define ROUNDBOX (28<<9)
184 #define CHARTAB (29<<9)
185 #define BUT_COLORBAND (30<<9)
186 #define BUT_NORMAL (31<<9)
187 #define BUT_CURVE (32<<9)
188 #define BUT_TOGDUAL (33<<9)
189 #define ICONTOGN (34<<9)
190 #define FTPREVIEW (35<<9)
191 #define NUMABS (36<<9)
192 #define TOGBUT (37<<9)
193 #define OPTION (38<<9)
194 #define OPTIONN (39<<9)
195 #define SEARCH_MENU (40<<9)
196 #define BUT_EXTRA (41<<9)
197 #define BUTTYPE (63<<9)
201 * Functions to draw various shapes, taking theme settings into account.
202 * Used for code that draws its own UI style elements. */
204 void uiEmboss(float x1, float y1, float x2, float y2, int sel);
205 void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
206 void uiSetRoundBox(int type);
207 int uiGetRoundBox(void);
208 void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
209 void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag, short direction);
210 void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
214 typedef void (*uiMenuCreateFunc)(struct bContext *C, struct uiLayout *layout, void *arg1);
215 typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
219 * Functions used to create popup menus. For more extended menus the
220 * uiPupMenuBegin/End functions can be used to define own items with
221 * the uiItem functions inbetween. If it is a simple confirmation menu
222 * or similar, popups can be created with a single function call. */
224 typedef struct uiPopupMenu uiPopupMenu;
226 uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon);
227 void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head);
228 struct uiLayout *uiPupMenuLayout(uiPopupMenu *head);
230 void uiPupMenuOkee(struct bContext *C, char *opname, char *str, ...);
231 void uiPupMenuSaveOver(struct bContext *C, struct wmOperator *op, char *filename);
232 void uiPupMenuNotice(struct bContext *C, char *str, ...);
233 void uiPupMenuError(struct bContext *C, char *str, ...);
234 void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
236 void uiPupMenuSetActive(int val);
240 * Functions used to create popup blocks. These are like popup menus
241 * but allow using all button types and creating an own layout. */
243 typedef uiBlock* (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
245 void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg);
246 void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, char *opname, int opcontext);
247 void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext);
251 * Functions for creating, drawing and freeing blocks. A Block is a
252 * container of buttons and used for various purposes.
254 * Begin/Define Buttons/End/Draw is the typical order in which these
255 * function should be called, though for popup blocks Draw is left out.
256 * Freeing blocks is done by the screen/ module automatically.
260 uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, const char *name, short dt);
261 void uiEndBlock(const struct bContext *C, uiBlock *block);
262 void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
264 uiBlock *uiGetBlock(char *name, struct ARegion *ar);
266 void uiBlockSetEmboss(uiBlock *block, short dt);
268 void uiFreeBlock(const struct bContext *C, uiBlock *block);
269 void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
270 void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb);
272 void uiBlockSetRegion(uiBlock *block, struct ARegion *region);
274 void uiBlockSetButLock(uiBlock *block, int val, char *lockstr);
275 void uiBlockClearButLock(uiBlock *block);
277 /* automatic aligning, horiz or verical */
278 void uiBlockBeginAlign(uiBlock *block);
279 void uiBlockEndAlign(uiBlock *block);
281 void uiBoundsBlock(struct uiBlock *block, int addval);
282 void uiTextBoundsBlock(uiBlock *block, int addval);
283 void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my);
284 void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my);
286 int uiBlocksGetYMin (struct ListBase *lb);
288 void uiBlockSetDirection (uiBlock *block, int direction);
289 void uiBlockFlipOrder (uiBlock *block);
290 void uiBlockSetFlag (uiBlock *block, int flag);
291 void uiBlockClearFlag (uiBlock *block, int flag);
292 void uiBlockSetXOfs (uiBlock *block, int xofs);
294 int uiButGetRetVal (uiBut *but);
296 void uiButSetFlag (uiBut *but, int flag);
297 void uiButClearFlag (uiBut *but, int flag);
301 * Functions to define various types of buttons in a block. Postfixes:
309 uiBut *uiDefBut(uiBlock *block,
310 int type, int retval, char *str,
314 float min, float max,
315 float a1, float a2, char *tip);
316 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);
317 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);
318 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);
319 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);
320 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);
321 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);
322 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);
323 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);
324 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);
325 uiBut *uiDefButO(uiBlock *block, int type, char *opname, int opcontext, char *str, short x1, short y1, short x2, short y2, char *tip);
327 uiBut *uiDefIconBut(uiBlock *block,
328 int type, int retval, int icon,
332 float min, float max,
333 float a1, float a2, char *tip);
334 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);
335 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);
336 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);
337 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);
338 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);
339 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);
340 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);
341 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);
342 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);
343 uiBut *uiDefIconButO(uiBlock *block, int type, char *opname, int opcontext, int icon, short x1, short y1, short x2, short y2, char *tip);
345 uiBut *uiDefIconTextBut(uiBlock *block,
346 int type, int retval, int icon, char *str,
350 float min, float max,
351 float a1, float a2, char *tip);
352 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);
353 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);
354 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);
355 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);
356 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);
357 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);
358 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);
359 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);
360 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);
361 uiBut *uiDefIconTextButO(uiBlock *block, int type, char *opname, int opcontext, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
363 /* for passing inputs to ButO buttons */
364 struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
368 * Butons with a more specific purpose:
369 * - IDPoinBut: for creating buttons that work on a pointer to an ID block.
370 * - MenuBut: buttons that popup a menu (in headers usually).
371 * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
372 * - BlockBut: buttons that popup a block with more buttons.
373 * - KeyevtBut: buttons that can be used to turn key events into values.
374 * - PickerButtons: buttons like the color picker (for code sharing).
375 * - AutoButR: RNA property button with type automatically defined. */
377 #define UI_ID_RENAME 1
378 #define UI_ID_BROWSE 2
379 #define UI_ID_ADD_NEW 4
381 #define UI_ID_ALONE 16
382 #define UI_ID_DELETE 32
383 #define UI_ID_LOCAL 64
384 #define UI_ID_AUTO_NAME 128
385 #define UI_ID_FAKE_USER 256
386 #define UI_ID_PIN 512
387 #define UI_ID_BROWSE_RENDER 1024
388 #define UI_ID_FULL (UI_ID_RENAME|UI_ID_BROWSE|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_ALONE|UI_ID_DELETE|UI_ID_LOCAL)
390 typedef void (*uiIDPoinFuncFP)(struct bContext *C, char *str, struct ID **idpp);
391 typedef void (*uiIDPoinFunc)(struct bContext *C, struct ID *id, int event);
393 uiBut *uiDefIDPoinBut(uiBlock *block, uiIDPoinFuncFP func, short blocktype, int retval, char *str,
394 short x1, short y1, short x2, short y2, void *idpp, char *tip);
395 int uiDefIDPoinButs(uiBlock *block, struct Main *main, struct ID *parid, struct ID *id, int id_code, short *pin_p, int x, int y, uiIDPoinFunc func, int events);
397 uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
398 uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, char *str, short x1, short y1, short x2, short y2, char *tip);
399 uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
401 uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, char *str, short x1, short y1, short x2, short y2, char *tip);
402 uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, short x1, short y1, short x2, short y2, char *tip);
403 uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, char *str, short x1, short y1, short x2, short y2, char *tip);
405 void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
407 uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, short x1, short y1, short x2, short y2, char *tip);
409 void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
410 void uiBlockColorbandButtons(struct uiBlock *block, struct ColorBand *coba, struct rctf *butr, int event);
412 uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2);
413 void uiDefAutoButsRNA(const struct bContext *C, uiLayout *layout, struct PointerRNA *ptr);
417 * Game engine logic brick links. Non-functional currently in 2.5,
418 * code to handle and draw these is disabled internally. */
420 void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to);
422 void uiComposeLinks(uiBlock *block);
423 uiBut *uiFindInlink(uiBlock *block, void *poin);
427 * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback.
428 * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
429 * mostly for compatibility with older code.
431 * uiButSetCompleteFunc is for tab completion.
433 * uiButSearchFunc is for name buttons, showing a popup with matches
435 * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
436 * in case events, operators or RNA are not sufficient to handle the button.
438 * uiButSetNFunc will free the argument with MEM_freeN. */
440 typedef struct uiSearchItems uiSearchItems;
442 typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
443 typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr);
444 typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2);
445 typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
446 typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, char *str, uiSearchItems *items);
447 typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
449 /* use inside searchfunc to add items */
450 int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin);
451 /* bfunc gets search item *poin as arg2, or if NULL the old string */
452 void uiButSetSearchFunc (uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc);
453 /* height in pixels, it's using hardcoded values still */
454 int uiSearchBoxhHeight(void);
456 void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg);
457 void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg);
459 void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
460 void uiBlockSetRenameFunc(uiBlock *block, uiButHandleRenameFunc func, void *arg1);
461 void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
462 void uiButSetNFunc (uiBut *but, uiButHandleNFunc func, void *argN, void *arg2);
464 void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg);
466 void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const struct bContext *C, void *, struct rcti *rect));
470 * Tab complete helper functions, for use in uiButCompleteFunc callbacks.
471 * Call begin once, then multiple times do_name with all possibilities,
472 * and finally end to finish and get the completed name. */
474 typedef struct AutoComplete AutoComplete;
476 AutoComplete *autocomplete_begin(char *startname, int maxlen);
477 void autocomplete_do_name(AutoComplete *autocpl, const char *name);
478 void autocomplete_end(AutoComplete *autocpl, char *autoname);
482 * Functions for creating, freeing and drawing panels. The API here
483 * could use a good cleanup, though how they will function in 2.5 is
484 * not clear yet so we postpone that. */
486 void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
487 void uiEndPanels(const struct bContext *C, struct ARegion *ar);
489 struct Panel *uiBeginPanel(struct ARegion *ar, uiBlock *block, struct PanelType *pt, int *open);
490 void uiEndPanel(uiBlock *block, int width, int height);
494 * Handlers that can be registered in regions, areas and windows for
495 * handling WM events. Mostly this is done automatic by modules such
496 * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
498 void UI_add_region_handlers(struct ListBase *handlers);
499 void UI_add_area_handlers(struct ListBase *handlers);
500 void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *menu);
503 * Callbacks and utils to get 2.48 work */
505 void test_idbutton_cb(struct bContext *C, void *namev, void *arg2);
506 void test_scriptpoin_but(struct bContext *C, char *name, struct ID **idpp);
507 void test_actionpoin_but(struct bContext *C, char *name, struct ID **idpp);
508 void test_obpoin_but(struct bContext *C, char *name, struct ID **idpp);
509 void test_meshobpoin_but(struct bContext *C, char *name, struct ID **idpp);
510 void test_meshpoin_but(struct bContext *C, char *name, struct ID **idpp);
511 void test_matpoin_but(struct bContext *C, char *name, struct ID **idpp);
512 void test_scenepoin_but(struct bContext *C, char *name, struct ID **idpp);
513 void test_grouppoin_but(struct bContext *C, char *name, struct ID **idpp);
514 void test_texpoin_but(struct bContext *C, char *name, struct ID **idpp);
515 void test_imapoin_but(struct bContext *C, char *name, struct ID **idpp);
516 void autocomplete_bone(struct bContext *C, char *str, void *arg_v);
517 void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v);
520 void curvemap_buttons(uiBlock *block, struct CurveMapping *cumap, char labeltype, short event, short redraw, struct rctf *rect);
521 void colorband_buttons(uiBlock *block, struct ColorBand *coba, struct rctf *rect, int small);
526 * init and exit should be called before using this module. init_userdef must
527 * be used to reinitialize some internal state if user preferences change. */
530 void UI_init_userdef(void);
535 uiBut *uiDefMenuButO(uiBlock *block, char *opname, char *name);
536 uiBut *uiDefMenuSep(uiBlock *block);
537 uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name);
538 uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name);
542 * More automated layout of buttons. Has three levels:
543 * - Layout: contains a number templates, within a bounded width or height.
544 * - Template: predefined layouts for buttons with a number of slots, each
545 * slot can contain multiple items.
546 * - Item: item to put in a template slot, being either an RNA property,
547 * operator, label or menu. Also regular buttons can be used when setting
548 * uiBlockCurLayout. */
551 #define UI_LAYOUT_HORIZONTAL 0
552 #define UI_LAYOUT_VERTICAL 1
554 #define UI_LAYOUT_PANEL 0
555 #define UI_LAYOUT_HEADER 1
556 #define UI_LAYOUT_MENU 2
561 #define UI_LAYOUT_ALIGN_EXPAND 0
562 #define UI_LAYOUT_ALIGN_LEFT 1
563 #define UI_LAYOUT_ALIGN_CENTER 2
564 #define UI_LAYOUT_ALIGN_RIGHT 3
566 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
567 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
568 void uiBlockLayoutResolve(const struct bContext *C, uiBlock *block, int *x, int *y);
570 uiBlock *uiLayoutGetBlock(uiLayout *layout);
572 void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
573 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
574 void uiLayoutSetContextPointer(uiLayout *layout, char *name, struct PointerRNA *ptr);
576 void uiLayoutSetActive(uiLayout *layout, int active);
577 void uiLayoutSetEnabled(uiLayout *layout, int enabled);
578 void uiLayoutSetRedAlert(uiLayout *layout, int redalert);
579 void uiLayoutSetAlignment(uiLayout *layout, int alignment);
580 void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect);
581 void uiLayoutSetScaleX(uiLayout *layout, float scale);
582 void uiLayoutSetScaleY(uiLayout *layout, float scale);
585 int uiLayoutGetOperatorContext(uiLayout *layout);
586 int uiLayoutGetActive(uiLayout *layout);
587 int uiLayoutGetEnabled(uiLayout *layout);
588 int uiLayoutGetRedAlert(uiLayout *layout);
589 int uiLayoutGetAlignment(uiLayout *layout);
590 int uiLayoutGetKeepAspect(uiLayout *layout);
591 float uiLayoutGetScaleX(uiLayout *layout);
592 float uiLayoutGetScaleY(uiLayout *layout);
594 /* layout specifiers */
595 uiLayout *uiLayoutRow(uiLayout *layout, int align);
596 uiLayout *uiLayoutColumn(uiLayout *layout, int align);
597 uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align);
598 uiLayout *uiLayoutBox(uiLayout *layout);
599 uiLayout *uiLayoutFree(uiLayout *layout, int align);
600 uiLayout *uiLayoutSplit(uiLayout *layout, float percentage);
602 uiBlock *uiLayoutFreeBlock(uiLayout *layout);
605 void uiTemplateHeader(uiLayout *layout, struct bContext *C);
606 void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname,
607 char *newop, char *openop, char *unlinkop);
608 uiLayout *uiTemplateModifier(uiLayout *layout, struct PointerRNA *ptr);
609 uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
610 void uiTemplatePreview(uiLayout *layout, struct ID *id);
611 void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand);
612 void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type);
615 void uiItemO(uiLayout *layout, char *name, int icon, char *opname);
616 void uiItemEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value);
617 void uiItemEnumO_string(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value);
618 void uiItemsEnumO(uiLayout *layout, char *opname, char *propname);
619 void uiItemBooleanO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value);
620 void uiItemIntO(uiLayout *layout, char *name, int icon, char *opname, char *propname, int value);
621 void uiItemFloatO(uiLayout *layout, char *name, int icon, char *opname, char *propname, float value);
622 void uiItemStringO(uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value);
623 void uiItemFullO(uiLayout *layout, char *name, int icon, char *idname, struct IDProperty *properties, int context);
625 void uiItemR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int expand, int slider, int toggle);
626 void uiItemFullR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int expand, int slider, int toggle);
627 void uiItemEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname, int value);
628 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, char *propname);
630 void uiItemL(uiLayout *layout, char *name, int icon); /* label */
631 void uiItemM(uiLayout *layout, struct bContext *C, char *name, int icon, char *menuname); /* menu */
632 void uiItemV(uiLayout *layout, char *name, int icon, int argval); /* value */
633 void uiItemS(uiLayout *layout); /* separator */
635 void uiItemMenuF(uiLayout *layout, char *name, int icon, uiMenuCreateFunc func);
636 void uiItemMenuEnumO(uiLayout *layout, char *name, int icon, char *opname, char *propname);
637 void uiItemMenuEnumR(uiLayout *layout, char *name, int icon, struct PointerRNA *ptr, char *propname);
641 void uiAnimContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index);
643 /* Styled text draw */
644 void uiStyleFontSet(struct uiFontStyle *fs);
645 void uiStyleFontDraw(struct uiFontStyle *fs, struct rcti *rect, char *str);
647 int UI_GetStringWidth(char *str); // XXX temp
648 void UI_DrawString(float x, float y, char *str); // XXX temp
650 #endif /* UI_INTERFACE_H */