diff options
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 103 |
1 files changed, 55 insertions, 48 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 50e2e53dbf0..e931aad2722 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -93,7 +93,7 @@ typedef struct uiLayout uiLayout; /* use for clamping popups within the screen */ #define UI_SCREEN_MARGIN 10 -/* uiBlock->dt */ +/* uiBlock->dt and uiBut->dt */ #define UI_EMBOSS 0 /* use widget style for drawing */ #define UI_EMBOSSN 1 /* Nothing, only icon and/or text */ #define UI_EMBOSSP 2 /* Pulldown menu style */ @@ -130,8 +130,7 @@ typedef struct uiLayout uiLayout; #define UI_BLOCK_POPUP_MEMORY (1 << 12) #define UI_BLOCK_CLIP_EVENTS (1 << 13) /* stop handling mouse events */ -/* XXX This comment is no more valid! Maybe it is now bits 14-17? */ -/* block->flag bits 12-15 are identical to but->flag bits */ +/* block->flag bits 14-17 are identical to but->drawflag bits */ #define UI_BLOCK_LIST_ITEM (1 << 19) @@ -148,46 +147,55 @@ typedef struct uiLayout uiLayout; #define UI_PNL_CLOSE (1 << 5) #define UI_PNL_SCALE (1 << 9) -/* warning the first 6 flags are internal */ -/* but->flag */ -#define UI_TEXT_LEFT (1 << 6) -#define UI_ICON_LEFT (1 << 7) -#define UI_ICON_SUBMENU (1 << 8) -#define UI_ICON_PREVIEW (1 << 9) - -#define UI_TEXT_RIGHT (1 << 10) -#define UI_BUT_NODE_LINK (1 << 11) -#define UI_BUT_NODE_ACTIVE (1 << 12) -#define UI_BUT_DRAG_LOCK (1 << 13) - -/* button align flag, for drawing groups together */ -#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN) -#define UI_BUT_ALIGN_TOP (1 << 14) -#define UI_BUT_ALIGN_LEFT (1 << 15) -#define UI_BUT_ALIGN_RIGHT (1 << 16) -#define UI_BUT_ALIGN_DOWN (1 << 17) - -#define UI_BUT_DISABLED (1 << 18) -#define UI_BUT_COLOR_LOCK (1 << 19) -#define UI_BUT_ANIMATED (1 << 20) -#define UI_BUT_ANIMATED_KEY (1 << 21) -#define UI_BUT_DRIVEN (1 << 22) -#define UI_BUT_REDALERT (1 << 23) -#define UI_BUT_INACTIVE (1 << 24) -#define UI_BUT_LAST_ACTIVE (1 << 25) -#define UI_BUT_UNDO (1 << 26) -#define UI_BUT_IMMEDIATE (1 << 27) -#define UI_BUT_NO_TOOLTIP (1 << 28) -#define UI_BUT_NO_UTF8 (1 << 29) - -#define UI_BUT_VEC_SIZE_LOCK (1 << 30) /* used to flag if color hsv-circle should keep luminance */ -#define UI_BUT_COLOR_CUBIC (1 << 31) /* cubic saturation for the color wheel */ +/* but->flag - general state flags. */ +enum { + /* warning, the first 6 flags are internal */ + UI_ICON_SUBMENU = (1 << 6), + UI_ICON_PREVIEW = (1 << 7), + + UI_BUT_NODE_LINK = (1 << 8), + UI_BUT_NODE_ACTIVE = (1 << 9), + UI_BUT_DRAG_LOCK = (1 << 10), + UI_BUT_DISABLED = (1 << 11), + UI_BUT_COLOR_LOCK = (1 << 12), + UI_BUT_ANIMATED = (1 << 13), + UI_BUT_ANIMATED_KEY = (1 << 14), + UI_BUT_DRIVEN = (1 << 15), + UI_BUT_REDALERT = (1 << 16), + UI_BUT_INACTIVE = (1 << 17), + UI_BUT_LAST_ACTIVE = (1 << 18), + UI_BUT_UNDO = (1 << 19), + UI_BUT_IMMEDIATE = (1 << 20), + UI_BUT_NO_UTF8 = (1 << 21), + + UI_BUT_VEC_SIZE_LOCK = (1 << 22), /* used to flag if color hsv-circle should keep luminance */ + UI_BUT_COLOR_CUBIC = (1 << 23), /* cubic saturation for the color wheel */ + UI_BUT_LIST_ITEM = (1 << 24), /* This but is "inside" a list item (currently used to change theme colors). */ +}; #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 -/* uiBut->drawflag */ -#define UI_BUT_DRAW_ENUM_ARROWS (1 << 0) /* draw enum-like up/down arrows for button */ +/* but->drawflag - these flags should only affect how the button is drawn. */ +/* Note: currently, these flags _are not passed_ to the widget's state() or draw() functions + * (except for the 'align' ones)! + */ +enum { + /* draw enum-like up/down arrows for button */ + UI_BUT_DRAW_ENUM_ARROWS = (1 << 0), + /* Text and icon alignment (by default, they are centered). */ + UI_BUT_TEXT_LEFT = (1 << 1), + UI_BUT_ICON_LEFT = (1 << 2), + UI_BUT_TEXT_RIGHT = (1 << 3), + /* Prevent the button to show any tooltip. */ + UI_BUT_NO_TOOLTIP = (1 << 4), + /* button align flag, for drawing groups together (also used in uiBlock->flag!) */ + UI_BUT_ALIGN_TOP = (1 << 14), + UI_BUT_ALIGN_LEFT = (1 << 15), + UI_BUT_ALIGN_RIGHT = (1 << 16), + UI_BUT_ALIGN_DOWN = (1 << 17), + UI_BUT_ALIGN = (UI_BUT_ALIGN_TOP | UI_BUT_ALIGN_LEFT | UI_BUT_ALIGN_RIGHT | UI_BUT_ALIGN_DOWN), +}; /* scale fixed button widths by this to account for DPI */ @@ -259,7 +267,6 @@ typedef enum { PROGRESSBAR = (51 << 9), SEARCH_MENU_UNLINK = (52 << 9), NODESOCKET = (53 << 9), - LISTLABEL = (54 << 9), } eButType; #define BUTTYPE (63 << 9) @@ -314,7 +321,7 @@ typedef struct uiSearchItems uiSearchItems; typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2); typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr); typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2); -typedef bool (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); +typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); @@ -425,7 +432,6 @@ void uiButSetDragValue(uiBut *but); void uiButSetDragImage(uiBut *but, const char *path, int icon, struct ImBuf *ima, float scale); int UI_but_active_drop_name(struct bContext *C); -struct uiBut *ui_but_find_mouse_over(struct ARegion *ar, int x, int y); void uiButSetFlag(uiBut *but, int flag); void uiButClearFlag(uiBut *but, int flag); @@ -468,7 +474,6 @@ uiBut *uiDefButR(uiBlock *block, int type, int retval, const char *str, int x, i 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); 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); 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); -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); uiBut *uiDefIconBut(uiBlock *block, int type, int retval, int icon, @@ -628,8 +633,9 @@ void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)(const struct bContext *C, void *, void *, void *, struct rcti *rect), void *arg1, void *arg2); -bool UI_textbutton_activate_event(const struct bContext *C, struct ARegion *ar, - const void *rna_poin_data, const char *rna_prop_id); +bool UI_textbutton_activate_rna(const struct bContext *C, struct ARegion *ar, + const void *rna_poin_data, const char *rna_prop_id); +bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); void uiButSetFocusOnEnter(struct wmWindow *win, uiBut *but); @@ -681,6 +687,7 @@ void UI_remove_popup_handlers_all(struct bContext *C, struct ListBase *handlers) void UI_init(void); void UI_init_userdef(void); +void UI_init_userdef_factory(void); void UI_reinit_font(void); void UI_exit(void); @@ -896,9 +903,9 @@ void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct Prop /* Styled text draw */ void uiStyleFontSet(struct uiFontStyle *fs); void uiStyleFontDrawExt(struct uiFontStyle *fs, const struct rcti *rect, const char *str, - float *r_xofs, float *r_yofs); -void uiStyleFontDraw(struct uiFontStyle *fs, struct rcti *rect, const char *str); -void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const char *str); + size_t len, float *r_xofs, float *r_yofs); +void uiStyleFontDraw(struct uiFontStyle *fs, const struct rcti *rect, const char *str); +void uiStyleFontDrawRotated(struct uiFontStyle *fs, const struct rcti *rect, const char *str); int UI_GetStringWidth(const char *str); // XXX temp void UI_DrawString(float x, float y, const char *str); // XXX temp |