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 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file UI_interface.h
32 #ifndef __UI_INTERFACE_H__
33 #define __UI_INTERFACE_H__
35 #include "BLI_sys_types.h" /* size_t */
36 #include "RNA_types.h"
37 #include "DNA_userdef_types.h"
39 /* Struct Declarations */
48 struct wmWindowManager;
63 struct uiWidgetColors;
68 struct wmOperatorType;
69 struct uiWidgetColors;
77 typedef struct uiBut uiBut;
78 typedef struct uiBlock uiBlock;
79 typedef struct uiPopupBlockHandle uiPopupBlockHandle;
80 typedef struct uiLayout uiLayout;
85 #define UI_MAX_DRAW_STR 400
86 #define UI_MAX_NAME_STR 128
88 /* use for clamping popups within the screen */
89 #define UI_SCREEN_MARGIN 10
92 #define UI_EMBOSS 0 /* use widget style for drawing */
93 #define UI_EMBOSSN 1 /* Nothing, only icon and/or text */
94 #define UI_EMBOSSP 2 /* Pulldown menu style */
95 #define UI_EMBOSST 3 /* Table */
97 /* uiBlock->direction */
98 #define UI_DIRECTION (UI_TOP | UI_DOWN | UI_LEFT | UI_RIGHT)
99 #define UI_TOP (1 << 0)
100 #define UI_DOWN (1 << 1)
101 #define UI_LEFT (1 << 2)
102 #define UI_RIGHT (1 << 3)
103 #define UI_CENTER (1 << 4)
104 #define UI_SHIFT_FLIPPED (1 << 5)
107 /* uiBlock->autofill (not yet used) */
108 #define UI_BLOCK_COLLUMNS 1
109 #define UI_BLOCK_ROWS 2
112 /* uiBlock->flag (controls) */
113 #define UI_BLOCK_LOOP (1 << 0)
114 #define UI_BLOCK_REDRAW (1 << 1)
115 #define UI_BLOCK_SEARCH_MENU (1 << 2)
116 #define UI_BLOCK_NUMSELECT (1 << 3)
117 #define UI_BLOCK_NO_WIN_CLIP (1 << 4) /* don't apply window clipping */ /* was UI_BLOCK_ENTER_OK */
118 #define UI_BLOCK_CLIPBOTTOM (1 << 5)
119 #define UI_BLOCK_CLIPTOP (1 << 6)
120 #define UI_BLOCK_MOVEMOUSE_QUIT (1 << 7)
121 #define UI_BLOCK_KEEP_OPEN (1 << 8)
122 #define UI_BLOCK_POPUP (1 << 9)
123 #define UI_BLOCK_OUT_1 (1 << 10)
124 #define UI_BLOCK_NO_FLIP (1 << 11)
125 #define UI_BLOCK_POPUP_MEMORY (1 << 12)
126 #define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */
128 /* XXX This comment is no more valid! Maybe it is now bits 14-17? */
129 /* block->flag bits 12-15 are identical to but->flag bits */
131 #define UI_BLOCK_LIST_ITEM (1 << 19)
133 /* uiPopupBlockHandle->menuretval */
134 #define UI_RETURN_CANCEL (1 << 0) /* cancel all menus cascading */
135 #define UI_RETURN_OK (1 << 1) /* choice made */
136 #define UI_RETURN_OUT (1 << 2) /* left the menu */
137 #define UI_RETURN_OUT_PARENT (1 << 3) /* let the parent handle this event */
138 #define UI_RETURN_UPDATE (1 << 4) /* update the button that opened */
139 #define UI_RETURN_POPUP_OK (1 << 5) /* popup is ok to be handled */
142 #define UI_PNL_SOLID (1 << 1)
143 #define UI_PNL_CLOSE (1 << 5)
144 #define UI_PNL_SCALE (1 << 9)
146 /* warning the first 6 flags are internal */
148 #define UI_TEXT_LEFT (1 << 6)
149 #define UI_ICON_LEFT (1 << 7)
150 #define UI_ICON_SUBMENU (1 << 8)
151 #define UI_ICON_PREVIEW (1 << 9)
153 #define UI_TEXT_RIGHT (1 << 10)
154 #define UI_BUT_NODE_LINK (1 << 11)
155 #define UI_BUT_NODE_ACTIVE (1 << 12)
156 #define UI_BUT_DRAG_LOCK (1 << 13)
158 /* button align flag, for drawing groups together */
159 #define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN)
160 #define UI_BUT_ALIGN_TOP (1 << 14)
161 #define UI_BUT_ALIGN_LEFT (1 << 15)
162 #define UI_BUT_ALIGN_RIGHT (1 << 16)
163 #define UI_BUT_ALIGN_DOWN (1 << 17)
165 #define UI_BUT_DISABLED (1 << 18)
166 #define UI_BUT_COLOR_LOCK (1 << 19)
167 #define UI_BUT_ANIMATED (1 << 20)
168 #define UI_BUT_ANIMATED_KEY (1 << 21)
169 #define UI_BUT_DRIVEN (1 << 22)
170 #define UI_BUT_REDALERT (1 << 23)
171 #define UI_BUT_INACTIVE (1 << 24)
172 #define UI_BUT_LAST_ACTIVE (1 << 25)
173 #define UI_BUT_UNDO (1 << 26)
174 #define UI_BUT_IMMEDIATE (1 << 27)
175 #define UI_BUT_NO_TOOLTIP (1 << 28)
176 #define UI_BUT_NO_UTF8 (1 << 29)
178 #define UI_BUT_VEC_SIZE_LOCK (1 << 30) /* used to flag if color hsv-circle should keep luminance */
179 #define UI_BUT_COLOR_CUBIC (1 << 31) /* cubic saturation for the color wheel */
181 #define UI_PANEL_WIDTH 340
182 #define UI_COMPACT_PANEL_WIDTH 160
184 /* uiBut->drawflag */
185 #define UI_BUT_DRAW_ENUM_ARROWS (1 << 0) /* draw enum-like up/down arrows for button */
187 /* scale fixed button widths by this to account for DPI */
189 #define UI_DPI_FAC ((U.pixelsize * (float)U.dpi) / 72.0f)
190 #define UI_DPI_WINDOW_FAC (((float)U.dpi) / 72.0f)
191 /* 16 to copy ICON_DEFAULT_HEIGHT */
192 #define UI_DPI_ICON_SIZE ((float)16 * UI_DPI_FAC)
194 /* Button types, bits stored in 1 value... and a short even!
195 * - bits 0-4: bitnr (0-31)
196 * - bits 5-7: pointer type
198 * - bit 9-15: button type (now 6 bits, 64 types)
201 UI_BUT_POIN_CHAR = 32,
202 UI_BUT_POIN_SHORT = 64,
203 UI_BUT_POIN_INT = 96,
204 UI_BUT_POIN_FLOAT = 128,
205 /* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/
206 UI_BUT_POIN_BIT = 256 /* OR'd with a bit index*/
209 /* requires (but->poin != NULL) */
210 #define UI_BUT_POIN_TYPES (UI_BUT_POIN_FLOAT | UI_BUT_POIN_SHORT | UI_BUT_POIN_CHAR)
212 /* assigned to but->type, OR'd with the flags above when passing args */
221 MENU = (11 << 9), /* Dropdown list, actually! */
233 PULLDOWN = (27 << 9), /* Menu, actually! */
234 ROUNDBOX = (28 << 9),
235 BUT_COLORBAND = (30 << 9),
236 BUT_NORMAL = (31 << 9),
237 BUT_CURVE = (32 << 9),
238 ICONTOGN = (34 << 9),
244 TRACKPREVIEW = (40 << 9),
245 /* buttons with value >= SEARCH_MENU don't get undo pushes */
246 SEARCH_MENU = (41 << 9),
247 BUT_EXTRA = (42 << 9),
248 HSVCIRCLE = (43 << 9),
249 HOTKEYEVT = (46 << 9),
250 BUT_IMAGE = (47 << 9),
251 HISTOGRAM = (48 << 9),
252 WAVEFORM = (49 << 9),
253 VECTORSCOPE = (50 << 9),
254 PROGRESSBAR = (51 << 9),
255 SEARCH_MENU_UNLINK = (52 << 9),
256 NODESOCKET = (53 << 9),
257 LISTLABEL = (54 << 9),
260 #define BUTTYPE (63 << 9)
262 /* gradient types, for color picker HSVCUBE etc */
270 #define UI_GRAD_V_ALT 9
274 * Functions to draw various shapes, taking theme settings into account.
275 * Used for code that draws its own UI style elements. */
277 void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
278 void uiSetRoundBox(int type);
279 int uiGetRoundBox(void);
280 void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
281 void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy);
282 void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad);
283 void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown);
284 void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadeLeft, float shadeRight);
286 /* state for scrolldrawing */
287 #define UI_SCROLL_PRESSED (1 << 0)
288 #define UI_SCROLL_ARROWS (1 << 1)
289 #define UI_SCROLL_NO_OUTLINE (1 << 2)
290 void uiWidgetScrollDraw(struct uiWidgetColors *wcol, const struct rcti *rect, const struct rcti *slider, int state);
294 * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback.
295 * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is
296 * mostly for compatibility with older code.
298 * uiButSetCompleteFunc is for tab completion.
300 * uiButSearchFunc is for name buttons, showing a popup with matches
302 * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
303 * in case events, operators or RNA are not sufficient to handle the button.
305 * uiButSetNFunc will free the argument with MEM_freeN. */
307 typedef struct uiSearchItems uiSearchItems;
309 typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
310 typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr);
311 typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2);
312 typedef bool (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
313 typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items);
314 typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
318 typedef void (*uiMenuCreateFunc)(struct bContext *C, struct uiLayout *layout, void *arg1);
319 typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
323 * Functions used to create popup menus. For more extended menus the
324 * uiPupMenuBegin/End functions can be used to define own items with
325 * the uiItem functions in between. If it is a simple confirmation menu
326 * or similar, popups can be created with a single function call. */
328 typedef struct uiPopupMenu uiPopupMenu;
330 struct uiPopupMenu *uiPupMenuBegin(struct bContext *C, const char *title, int icon)
332 __attribute__((nonnull))
335 void uiPupMenuEnd(struct bContext *C, struct uiPopupMenu *head);
336 struct uiLayout *uiPupMenuLayout(uiPopupMenu *head);
338 void uiPupMenuOkee(struct bContext *C, const char *opname, const char *str, ...)
340 __attribute__ ((format(printf, 3, 4)))
343 void uiPupMenuSaveOver(struct bContext *C, struct wmOperator *op, const char *filename);
344 void uiPupMenuNotice(struct bContext *C, const char *str, ...)
346 __attribute__ ((format(printf, 2, 3)))
349 void uiPupMenuError(struct bContext *C, const char *str, ...)
351 __attribute__ ((format(printf, 2, 3)))
354 void uiPupMenuReports(struct bContext *C, struct ReportList *reports);
355 void uiPupMenuInvoke(struct bContext *C, const char *idname); /* popup registered menu */
359 * Functions used to create popup blocks. These are like popup menus
360 * but allow using all button types and creating an own layout. */
362 typedef uiBlock * (*uiBlockCreateFunc)(struct bContext *C, struct ARegion *ar, void *arg1);
363 typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
365 void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg);
366 void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext);
367 void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg);
368 /* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */
370 void uiPupBlockClose(struct bContext *C, uiBlock *block);
374 * Functions for creating, drawing and freeing blocks. A Block is a
375 * container of buttons and used for various purposes.
377 * Begin/Define Buttons/End/Draw is the typical order in which these
378 * function should be called, though for popup blocks Draw is left out.
379 * Freeing blocks is done by the screen/ module automatically.
383 uiBlock *uiBeginBlock(const struct bContext *C, struct ARegion *region, const char *name, short dt);
384 void uiEndBlock(const struct bContext *C, uiBlock *block);
385 void uiDrawBlock(const struct bContext *C, struct uiBlock *block);
387 uiBlock *uiGetBlock(const char *name, struct ARegion *ar);
389 void uiBlockSetEmboss(uiBlock *block, char dt);
391 void uiFreeBlock(const struct bContext *C, uiBlock *block);
392 void uiFreeBlocks(const struct bContext *C, struct ListBase *lb);
393 void uiFreeInactiveBlocks(const struct bContext *C, struct ListBase *lb);
394 void uiFreeActiveButtons(const struct bContext *C, struct bScreen *screen);
396 void uiBlockSetRegion(uiBlock *block, struct ARegion *region);
398 void uiBlockSetButLock(uiBlock *block, bool val, const char *lockstr);
399 void uiBlockClearButLock(uiBlock *block);
401 /* automatic aligning, horiz or verical */
402 void uiBlockBeginAlign(uiBlock *block);
403 void uiBlockEndAlign(uiBlock *block);
405 /* block bounds/position calculation */
407 UI_BLOCK_BOUNDS_NONE = 0,
409 UI_BLOCK_BOUNDS_TEXT,
410 UI_BLOCK_BOUNDS_POPUP_MOUSE,
411 UI_BLOCK_BOUNDS_POPUP_MENU,
412 UI_BLOCK_BOUNDS_POPUP_CENTER
415 void uiBoundsBlock(struct uiBlock *block, int addval);
416 void uiTextBoundsBlock(uiBlock *block, int addval);
417 void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my);
418 void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my);
419 void uiCenteredBoundsBlock(uiBlock *block, int addval);
420 void uiExplicitBoundsBlock(uiBlock *block, int minx, int miny, int maxx, int maxy);
422 int uiBlocksGetYMin(struct ListBase *lb);
424 void uiBlockSetDirection(uiBlock *block, int direction);
425 void uiBlockFlipOrder(uiBlock *block);
426 void uiBlockSetFlag(uiBlock *block, int flag);
427 void uiBlockClearFlag(uiBlock *block, int flag);
429 int uiButGetRetVal(uiBut *but);
431 void uiButSetDragID(uiBut *but, struct ID *id);
432 void uiButSetDragRNA(uiBut *but, struct PointerRNA *ptr);
433 void uiButSetDragPath(uiBut *but, const char *path);
434 void uiButSetDragName(uiBut *but, const char *name);
435 void uiButSetDragValue(uiBut *but);
436 void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale);
438 int UI_but_active_drop_name(struct bContext *C);
439 struct uiBut *ui_but_find_mouse_over(struct ARegion *ar, int x, int y);
441 void uiButSetFlag(uiBut *but, int flag);
442 void uiButClearFlag(uiBut *but, int flag);
444 void uiButSetDrawFlag(uiBut *but, int flag);
445 void uiButClearDrawFlag(uiBut *but, int flag);
447 /* special button case, only draw it when used actively, for outliner etc */
448 bool uiButActiveOnly(const struct bContext *C, struct ARegion *ar, uiBlock *block, uiBut *but);
450 void uiButExecute(const struct bContext *C, uiBut *but);
455 * Functions to define various types of buttons in a block. Postfixes:
463 uiBut *uiDefBut(uiBlock *block,
464 int type, int retval, const char *str,
468 float min, float max,
469 float a1, float a2, const char *tip);
470 uiBut *uiDefButF(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
471 uiBut *uiDefButBitF(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
472 uiBut *uiDefButI(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
473 uiBut *uiDefButBitI(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
474 uiBut *uiDefButS(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
475 uiBut *uiDefButBitS(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
476 uiBut *uiDefButC(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
477 uiBut *uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
478 uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
479 uiBut *uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
480 uiBut *uiDefButO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
481 uiBut *uiDefButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, const char *str, int x, int y, short width, short height, const char *tip);
482 uiBut *uiDefButTextO(uiBlock *block, int type, const char *opname, int opcontext, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip);
484 uiBut *uiDefIconBut(uiBlock *block,
485 int type, int retval, int icon,
489 float min, float max,
490 float a1, float a2, const char *tip);
491 uiBut *uiDefIconButF(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
492 uiBut *uiDefIconButBitF(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
493 uiBut *uiDefIconButI(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
494 uiBut *uiDefIconButBitI(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
495 uiBut *uiDefIconButS(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
496 uiBut *uiDefIconButBitS(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
497 uiBut *uiDefIconButC(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
498 uiBut *uiDefIconButBitC(uiBlock *block, int type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
499 uiBut *uiDefIconButR(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
500 uiBut *uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
501 uiBut *uiDefIconButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, int x, int y, short width, short height, const char *tip);
502 uiBut *uiDefIconButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, int x, int y, short width, short height, const char *tip);
504 uiBut *uiDefIconTextBut(uiBlock *block,
505 int type, int retval, int icon, const char *str,
509 float min, float max,
510 float a1, float a2, const char *tip);
511 uiBut *uiDefIconTextButF(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
512 uiBut *uiDefIconTextButBitF(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, float *poin, float min, float max, float a1, float a2, const char *tip);
513 uiBut *uiDefIconTextButI(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
514 uiBut *uiDefIconTextButBitI(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, int *poin, float min, float max, float a1, float a2, const char *tip);
515 uiBut *uiDefIconTextButS(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
516 uiBut *uiDefIconTextButBitS(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, short *poin, float min, float max, float a1, float a2, const char *tip);
517 uiBut *uiDefIconTextButC(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
518 uiBut *uiDefIconTextButBitC(uiBlock *block, int type, int bit, int retval, int icon, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip);
519 uiBut *uiDefIconTextButR(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, const char *propname, int index, float min, float max, float a1, float a2, const char *tip);
520 uiBut *uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip);
521 uiBut *uiDefIconTextButO(uiBlock *block, int type, const char *opname, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip);
522 uiBut *uiDefIconTextButO_ptr(uiBlock *block, int type, struct wmOperatorType *ot, int opcontext, int icon, const char *str, int x, int y, short width, short height, const char *tip);
524 /* for passing inputs to ButO buttons */
525 struct PointerRNA *uiButGetOperatorPtrRNA(uiBut *but);
527 void uiButSetUnitType(uiBut *but, const int unit_type);
528 int uiButGetUnitType(uiBut *but);
531 BUT_GET_RNAPROP_IDENTIFIER = 1,
532 BUT_GET_RNASTRUCT_IDENTIFIER,
533 BUT_GET_RNAENUM_IDENTIFIER,
536 BUT_GET_RNAENUM_LABEL,
537 BUT_GET_RNA_LABEL_CONTEXT, /* Context specified in CTX_XXX_ macros are just unreachable! */
545 typedef struct uiStringInfo {
550 /* Note: Expects pointers to uiStringInfo structs as parameters.
551 * Will fill them with translated strings, when possible.
552 * Strings in uiStringInfo must be MEM_freeN'ed by caller. */
553 void uiButGetStrInfo(struct bContext *C, uiBut *but, ...)
555 __attribute__((sentinel))
559 /* Edit i18n stuff. */
560 /* Name of the main py op from i18n addon. */
561 #define EDTSRC_I18N_OP_NAME "UI_OT_edittranslation"
565 * Buttons with a more specific purpose:
566 * - MenuBut: buttons that popup a menu (in headers usually).
567 * - PulldownBut: like MenuBut, but creating a uiBlock (for compatibility).
568 * - BlockBut: buttons that popup a block with more buttons.
569 * - KeyevtBut: buttons that can be used to turn key events into values.
570 * - PickerButtons: buttons like the color picker (for code sharing).
571 * - AutoButR: RNA property button with type automatically defined. */
573 #define UI_ID_RENAME (1 << 0)
574 #define UI_ID_BROWSE (1 << 1)
575 #define UI_ID_ADD_NEW (1 << 2)
576 #define UI_ID_OPEN (1 << 3)
577 #define UI_ID_ALONE (1 << 4)
578 #define UI_ID_DELETE (1 << 5)
579 #define UI_ID_LOCAL (1 << 6)
580 #define UI_ID_AUTO_NAME (1 << 7)
581 #define UI_ID_FAKE_USER (1 << 8)
582 #define UI_ID_PIN (1 << 9)
583 #define UI_ID_BROWSE_RENDER (1 << 10)
584 #define UI_ID_PREVIEWS (1 << 11)
585 #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)
587 int uiIconFromID(struct ID *id);
589 uiBut *uiDefPulldownBut(uiBlock *block, uiBlockCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
590 uiBut *uiDefMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, const char *str, int x, int y, short width, short height, const char *tip);
591 uiBut *uiDefIconTextMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
592 uiBut *uiDefIconMenuBut(uiBlock *block, uiMenuCreateFunc func, void *arg, int icon, int x, int y, short width, short height, const char *tip);
594 uiBut *uiDefBlockBut(uiBlock *block, uiBlockCreateFunc func, void *func_arg1, const char *str, int x, int y, short width, short height, const char *tip);
595 uiBut *uiDefBlockButN(uiBlock *block, uiBlockCreateFunc func, void *argN, const char *str, int x, int y, short width, short height, const char *tip);
597 uiBut *uiDefIconBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int retval, int icon, int x, int y, short width, short height, const char *tip);
598 uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg, int icon, const char *str, int x, int y, short width, short height, const char *tip);
600 uiBut *uiDefKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *spoin, const char *tip);
601 uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x, int y, short width, short height, short *keypoin, short *modkeypoin, const char *tip);
603 uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip);
604 uiBut *uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, IDProperty *properties,
605 void *arg, int retval, int icon, int maxlen, int x, int y,
606 short width, short height, float a1, float a2, const char *tip);
608 uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2);
609 int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *), const char label_align);
613 * Game engine logic brick links. Non-functional currently in 2.5,
614 * code to handle and draw these is disabled internally. */
616 void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, int from, int to);
618 void uiComposeLinks(uiBlock *block);
619 uiBut *uiFindInlink(uiBlock *block, void *poin);
621 /* use inside searchfunc to add items */
622 bool uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid);
623 /* bfunc gets search item *poin as arg2, or if NULL the old string */
624 void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc, void *active);
625 /* height in pixels, it's using hardcoded values still */
626 int uiSearchBoxHeight(void);
627 int uiSearchBoxWidth(void);
628 /* check if a string is in an existing search box */
629 int uiSearchItemFindIndex(uiSearchItems *items, const char *name);
631 void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg);
632 void uiBlockSetButmFunc(uiBlock *block, uiMenuHandleFunc func, void *arg);
633 void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
634 void uiBlockSetNFunc(uiBlock *block, uiButHandleNFunc funcN, void *argN, void *arg2);
636 void uiButSetRenameFunc(uiBut *but, uiButHandleRenameFunc func, void *arg1);
637 void uiButSetFunc(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
638 void uiButSetNFunc(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2);
640 void uiButSetCompleteFunc(uiBut *but, uiButCompleteFunc func, void *arg);
642 void uiBlockSetDrawExtraFunc(uiBlock *block,
643 void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect),
644 void *arg1, void *arg2);
646 bool UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar,
647 const void *rna_poin_data, const char *rna_prop_id);
649 void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but);
653 * Tab complete helper functions, for use in uiButCompleteFunc callbacks.
654 * Call begin once, then multiple times do_name with all possibilities,
655 * and finally end to finish and get the completed name. */
657 typedef struct AutoComplete AutoComplete;
659 AutoComplete *autocomplete_begin(const char *startname, size_t maxlen);
660 void autocomplete_do_name(AutoComplete *autocpl, const char *name);
661 bool autocomplete_end(AutoComplete *autocpl, char *autoname);
665 * Functions for creating, freeing and drawing panels. The API here
666 * could use a good cleanup, though how they will function in 2.5 is
667 * not clear yet so we postpone that. */
669 void uiBeginPanels(const struct bContext *C, struct ARegion *ar);
670 void uiEndPanels(const struct bContext *C, struct ARegion *ar, int *x, int *y);
671 void uiDrawPanels(const struct bContext *C, struct ARegion *ar);
673 struct Panel *uiBeginPanel(struct ScrArea *sa, struct ARegion *ar, uiBlock *block, struct PanelType *pt, int *open);
674 void uiEndPanel(uiBlock *block, int width, int height);
675 void uiScalePanels(struct ARegion *ar, float new_width);
679 * Handlers that can be registered in regions, areas and windows for
680 * handling WM events. Mostly this is done automatic by modules such
681 * as screen/ if ED_KEYMAP_UI is set, or internally in popup functions. */
683 void UI_add_region_handlers(struct ListBase *handlers);
684 void UI_add_popup_handlers(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup);
685 void UI_remove_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *popup);
686 void UI_remove_popup_handlers_all(struct bContext *C, struct ListBase *handlers);
690 * init and exit should be called before using this module. init_userdef must
691 * be used to reinitialize some internal state if user preferences change. */
694 void UI_init_userdef(void);
695 void UI_reinit_font(void);
700 * More automated layout of buttons. Has three levels:
701 * - Layout: contains a number templates, within a bounded width or height.
702 * - Template: predefined layouts for buttons with a number of slots, each
703 * slot can contain multiple items.
704 * - Item: item to put in a template slot, being either an RNA property,
705 * operator, label or menu. Also regular buttons can be used when setting
706 * uiBlockCurLayout. */
709 #define UI_LAYOUT_HORIZONTAL 0
710 #define UI_LAYOUT_VERTICAL 1
712 #define UI_LAYOUT_PANEL 0
713 #define UI_LAYOUT_HEADER 1
714 #define UI_LAYOUT_MENU 2
715 #define UI_LAYOUT_TOOLBAR 3
717 #define UI_UNIT_X U.widget_unit
718 #define UI_UNIT_Y U.widget_unit
720 #define UI_LAYOUT_ALIGN_EXPAND 0
721 #define UI_LAYOUT_ALIGN_LEFT 1
722 #define UI_LAYOUT_ALIGN_CENTER 2
723 #define UI_LAYOUT_ALIGN_RIGHT 3
725 #define UI_ITEM_O_RETURN_PROPS (1 << 0)
726 #define UI_ITEM_R_EXPAND (1 << 1)
727 #define UI_ITEM_R_SLIDER (1 << 2)
728 #define UI_ITEM_R_TOGGLE (1 << 3)
729 #define UI_ITEM_R_ICON_ONLY (1 << 4)
730 #define UI_ITEM_R_EVENT (1 << 5)
731 #define UI_ITEM_R_FULL_EVENT (1 << 6)
732 #define UI_ITEM_R_NO_BG (1 << 7)
733 #define UI_ITEM_R_IMMEDIATE (1 << 8)
735 /* uiLayoutOperatorButs flags */
736 #define UI_LAYOUT_OP_SHOW_TITLE 1
737 #define UI_LAYOUT_OP_SHOW_EMPTY 2
739 /* flags to set which corners will become rounded:
746 UI_CNR_TOP_LEFT = (1 << 0),
747 UI_CNR_TOP_RIGHT = (1 << 1),
748 UI_CNR_BOTTOM_RIGHT = (1 << 2),
749 UI_CNR_BOTTOM_LEFT = (1 << 3),
750 /* just for convenience */
752 UI_CNR_ALL = (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)
755 /* not apart of the corner flags but mixed in some functions */
756 #define UI_RB_ALPHA (UI_CNR_ALL + 1)
758 uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
759 void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
760 void uiBlockLayoutResolve(uiBlock *block, int *x, int *y);
762 uiBlock *uiLayoutGetBlock(uiLayout *layout);
764 void uiLayoutSetFunc(uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv);
765 void uiLayoutSetContextPointer(uiLayout *layout, const char *name, struct PointerRNA *ptr);
766 void uiLayoutContextCopy(uiLayout *layout, struct bContextStore *context);
767 const char *uiLayoutIntrospect(uiLayout *layout); // XXX - testing
768 void uiLayoutOperatorButs(const struct bContext *C, struct uiLayout *layout, struct wmOperator *op,
769 bool (*check_prop)(struct PointerRNA *, struct PropertyRNA *),
770 const char label_align, const short flag);
771 struct MenuType *uiButGetMenuType(uiBut *but);
773 void uiLayoutSetOperatorContext(uiLayout *layout, int opcontext);
774 void uiLayoutSetActive(uiLayout *layout, bool active);
775 void uiLayoutSetEnabled(uiLayout *layout, bool enabled);
776 void uiLayoutSetRedAlert(uiLayout *layout, bool redalert);
777 void uiLayoutSetAlignment(uiLayout *layout, char alignment);
778 void uiLayoutSetKeepAspect(uiLayout *layout, bool keepaspect);
779 void uiLayoutSetScaleX(uiLayout *layout, float scale);
780 void uiLayoutSetScaleY(uiLayout *layout, float scale);
782 int uiLayoutGetOperatorContext(uiLayout *layout);
783 bool uiLayoutGetActive(uiLayout *layout);
784 bool uiLayoutGetEnabled(uiLayout *layout);
785 bool uiLayoutGetRedAlert(uiLayout *layout);
786 int uiLayoutGetAlignment(uiLayout *layout);
787 bool uiLayoutGetKeepAspect(uiLayout *layout);
788 int uiLayoutGetWidth(uiLayout *layout);
789 float uiLayoutGetScaleX(uiLayout *layout);
790 float uiLayoutGetScaleY(uiLayout *layout);
792 /* layout specifiers */
793 uiLayout *uiLayoutRow(uiLayout *layout, int align);
794 uiLayout *uiLayoutColumn(uiLayout *layout, int align);
795 uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align);
796 uiLayout *uiLayoutBox(uiLayout *layout);
797 uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop,
798 struct PointerRNA *actptr, struct PropertyRNA *actprop);
799 uiLayout *uiLayoutAbsolute(uiLayout *layout, int align);
800 uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align);
801 uiLayout *uiLayoutOverlap(uiLayout *layout);
803 uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout);
806 void uiTemplateHeader(uiLayout *layout, struct bContext *C, int menus);
807 void uiTemplateID(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
808 const char *newop, const char *openop, const char *unlinkop);
809 void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
810 const char *newop, const char *openop, const char *unlinkop);
811 void uiTemplateIDPreview(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname,
812 const char *newop, const char *openop, const char *unlinkop, int rows, int cols);
813 void uiTemplateAnyID(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
814 const char *proptypename, const char *text);
815 void uiTemplatePathBuilder(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
816 struct PointerRNA *root_ptr, const char *text);
817 uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr);
818 uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
819 void uiTemplatePreview(uiLayout *layout, struct ID *id, int show_buttons, struct ID *parent, struct MTex *slot);
820 void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand);
821 void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
822 void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
823 void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
824 void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
825 void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, int levels, int brush);
826 void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
827 void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
828 PointerRNA *used_ptr, const char *used_propname, int active_layer);
829 void uiTemplateGameStates(uiLayout *layout, struct PointerRNA *ptr, const char *propname,
830 PointerRNA *used_ptr, const char *used_propname, int active_state);
831 void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact);
832 void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management);
833 void uiTemplateImageLayers(uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser);
834 void uiTemplateRunningJobs(uiLayout *layout, struct bContext *C);
835 void uiOperatorSearch_But(uiBut *but);
836 void uiTemplateOperatorSearch(uiLayout *layout);
837 void uiTemplateHeader3D(uiLayout *layout, struct bContext *C);
838 void uiTemplateEditModeSelection(uiLayout *layout, struct bContext *C);
839 void uiTemplateReportsBanner(uiLayout *layout, struct bContext *C);
840 void uiTemplateKeymapItemProperties(uiLayout *layout, struct PointerRNA *ptr);
841 void uiTemplateComponentMenu(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name);
842 void uiTemplateNodeSocket(uiLayout *layout, struct bContext *C, float *color);
844 /* Default UIList class name, keep in sync with its declaration in bl_ui/__init__.py */
845 #define UI_UL_DEFAULT_CLASS_NAME "UI_UL_list"
846 void uiTemplateList(uiLayout *layout, struct bContext *C, const char *listtype_name, const char *list_id,
847 struct PointerRNA *dataptr, const char *propname, struct PointerRNA *active_dataptr,
848 const char *active_propname, int rows, int maxrows, int layout_type);
849 void uiTemplateNodeLink(uiLayout *layout, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
850 void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *input);
851 void uiTemplateTextureUser(uiLayout *layout, struct bContext *C);
852 void uiTemplateTextureShow(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop);
854 void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int compact);
855 void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
856 void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int cmpact);
857 void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr);
859 void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname);
860 void uiTemplateColormanagedViewSettings(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname);
863 void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname);
864 void uiItemEnumO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, const char *propname, int value);
865 void uiItemEnumO(uiLayout *layout, const char *opname, const char *name, int icon, const char *propname, int value);
866 void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value);
867 void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, const char *value);
868 void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname);
869 void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value);
870 void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value);
871 void uiItemFloatO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, float value);
872 void uiItemStringO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, const char *value);
874 PointerRNA uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, IDProperty *properties, int context, int flag);
875 PointerRNA uiItemFullO(uiLayout *layout, const char *idname, const char *name, int icon, struct IDProperty *properties, int context, int flag);
877 void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon);
878 void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon);
879 void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA *ptr, const char *propname, int value);
880 void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, const char *name, int icon);
881 void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname);
882 void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, const char *name, int icon);
883 void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, struct IDProperty *properties, int context, int flag);
885 void uiItemL(uiLayout *layout, const char *name, int icon); /* label */
886 void uiItemLDrag(uiLayout *layout, struct PointerRNA *ptr, const char *name, int icon); /* label icon for dragging */
887 void uiItemM(uiLayout *layout, struct bContext *C, const char *menuname, const char *name, int icon); /* menu */
888 void uiItemV(uiLayout *layout, const char *name, int icon, int argval); /* value */
889 void uiItemS(uiLayout *layout); /* separator */
891 void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg);
892 void uiItemMenuEnumO(uiLayout *layout, struct bContext *C, const char *opname, const char *propname, const char *name, int icon);
893 void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, int icon);
896 void UI_buttons_operatortypes(void);
898 /* Helpers for Operators */
899 uiBut *uiContextActiveButton(const struct bContext *C);
900 void uiContextActiveProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop, int *index);
901 void uiContextActivePropertyHandle(struct bContext *C);
902 struct wmOperator *uiContextActiveOperator(const struct bContext *C);
903 void uiContextAnimUpdate(const struct bContext *C);
904 void uiFileBrowseContextProperty(const struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
905 void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA **prop);
907 /* Styled text draw */
908 void uiStyleFontSet(struct uiFontStyle *fs);
909 void uiStyleFontDrawExt(struct uiFontStyle *fs, const struct rcti *rect, const char *str,
910 float *r_xofs, float *r_yofs);
911 void uiStyleFontDraw(struct uiFontStyle *fs, struct rcti *rect, const char *str);
912 void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const char *str);
914 int UI_GetStringWidth(const char *str); // XXX temp
915 void UI_DrawString(float x, float y, const char *str); // XXX temp
916 void UI_DrawTriIcon(float x, float y, char dir);
918 uiStyle *UI_GetStyle(void); /* use for fonts etc */
919 uiStyle *UI_GetStyleDraw(void); /* DPI scaled settings for drawing */
921 /* linker workaround ack! */
922 void UI_template_fix_linking(void);
924 /* UI_OT_editsource helpers */
925 bool UI_editsource_enable_check(void);
926 void UI_editsource_active_but_test(uiBut *but);
928 #endif /* __UI_INTERFACE_H__ */