diff options
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 100 |
1 files changed, 87 insertions, 13 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 75c78f4a0d2..24d44f3484f 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -36,6 +36,7 @@ struct ID; struct Main; struct ListBase; struct ARegion; +struct ScrArea; struct wmWindow; struct wmWindowManager; struct wmOperator; @@ -303,7 +304,7 @@ void uiTextBoundsBlock(uiBlock *block, int addval); void uiPopupBoundsBlock(uiBlock *block, int addval, int mx, int my); void uiMenuPopupBoundsBlock(uiBlock *block, int addvall, int mx, int my); -int uiBlocksGetYMin (ListBase *lb); +int uiBlocksGetYMin (struct ListBase *lb); int uiBlockGetCol (uiBlock *block); void uiBlockSetCol (uiBlock *block, int col); @@ -430,7 +431,7 @@ void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval); -uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int x1, int y1, int x2, int y2); +uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2); int uiDefAutoButsRNA(uiBlock *block, struct PointerRNA *ptr); /* Links @@ -500,7 +501,7 @@ 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 uiBlock *uiFindOpenPanelBlockName(struct ListBase *lb, char *name); extern int uiAlignPanelStep(struct ScrArea *sa, struct ARegion *ar, float fac); extern void uiPanelControl(int); extern void uiSetPanelHandler(int); @@ -519,16 +520,16 @@ void UI_add_popup_handlers(struct ListBase *handlers, uiPopupBlockHandle *menu); * Callbacks and utils to get 2.48 work */ void test_idbutton_cb(struct bContext *C, void *namev, void *arg2); -void test_scriptpoin_but(struct bContext *C, char *name, ID **idpp); -void test_actionpoin_but(struct bContext *C, char *name, ID **idpp); -void test_obpoin_but(struct bContext *C, char *name, ID **idpp); -void test_meshobpoin_but(struct bContext *C, char *name, ID **idpp); -void test_meshpoin_but(struct bContext *C, char *name, ID **idpp); -void test_matpoin_but(struct bContext *C, char *name, ID **idpp); -void test_scenepoin_but(struct bContext *C, char *name, ID **idpp); -void test_grouppoin_but(struct bContext *C, char *name, ID **idpp); -void test_texpoin_but(struct bContext *C, char *name, ID **idpp); -void test_imapoin_but(struct bContext *C, char *name, ID **idpp); +void test_scriptpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_actionpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_obpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_meshobpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_meshpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_matpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_scenepoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_grouppoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_texpoin_but(struct bContext *C, char *name, struct ID **idpp); +void test_imapoin_but(struct bContext *C, char *name, struct ID **idpp); void autocomplete_bone(struct bContext *C, char *str, void *arg_v); void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v); @@ -553,5 +554,78 @@ uiBut *uiDefMenuSep(uiBlock *block); uiBut *uiDefMenuSub(uiBlock *block, uiBlockCreateFunc func, char *name); uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, char *propvalue, char *name); +/* Layout + * + * More automated layout of buttons. Has three levels: + * - Layout: contains a number templates, within a bounded width or height. + * - Template: predefined layouts for buttons with a number of slots, each + * slot can contain multiple items. + * - Item: item to put in a template slot, being either an RNA property, + * operator, label or menu currently. */ + +/* layout */ +#define UI_LAYOUT_HORIZONTAL 0 +#define UI_LAYOUT_VERTICAL 1 + +typedef struct uiLayout uiLayout; + +uiLayout *uiLayoutBegin(int dir, int x, int y, int w, int h); +void uiLayoutContext(uiLayout *layout, int opcontext); +void uiLayoutEnd(const struct bContext *C, uiBlock *block, uiLayout *layout, int *x, int *y); + +/* vertical button templates */ +#define UI_TSLOT_COLUMN_1 0 +#define UI_TSLOT_COLUMN_2 1 +#define UI_TSLOT_COLUMN_3 2 +#define UI_TSLOT_COLUMN_4 3 +#define UI_TSLOT_COLUMN_5 4 +#define UI_TSLOT_COLUMN_MAX 5 + +#define UI_TSLOT_LR_LEFT 0 +#define UI_TSLOT_LR_RIGHT 1 + +void uiTemplateLeftRight(uiLayout *layout); +void uiTemplateColumn(uiLayout *layout); +uiLayout *uiTemplateStack(uiLayout *layout); + +/* horizontal header templates */ +#define UI_TSLOT_HEADER 0 + +void uiTemplateHeaderMenus(uiLayout *layout); +void uiTemplateHeaderButtons(uiLayout *layout); +void uiTemplateHeaderID(uiLayout *layout, struct PointerRNA *ptr, char *propname, int flag, uiIDPoinFunc func); +void uiTemplateSetColor(uiLayout *layout, int color); + +/* items */ +void uiItemO(uiLayout *layout, int slot, const char *name, int icon, char *opname); +void uiItemEnumO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value); +void uiItemsEnumO(uiLayout *layout, int slot, char *opname, char *propname); +void uiItemBooleanO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value); +void uiItemIntO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, int value); +void uiItemFloatO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, float value); +void uiItemStringO(uiLayout *layout, int slot, const char *name, int icon, char *opname, char *propname, char *value); +void uiItemFullO(uiLayout *layout, int slot, const char *name, int icon, char *idname, IDProperty *properties, int context); + +void uiItemR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname); +void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, struct PointerRNA *ptr, char *propname, int index); + +void uiItemLabel(uiLayout *layout, int slot, const char *name, int icon); + +void uiItemMenu(uiLayout *layout, int slot, const char *name, int icon, uiMenuCreateFunc func); + +/* utilities */ +#define UI_PANEL_WIDTH 340 +#define UI_COMPACT_PANEL_WIDTH 160 + +typedef void (*uiHeaderCreateFunc)(const struct bContext *C, uiLayout *layout); +typedef void (*uiPanelCreateFunc)(const struct bContext *C, uiLayout *layout); + +void uiPanelLayout(const struct bContext *C, struct ARegion *ar, char *blockname, + char *panelname, char *tabname, uiPanelCreateFunc func, int order); +void uiCompactPanelLayout(const struct bContext *C, struct ARegion *ar, char *blockname, + char *panelname, char *tabname, uiPanelCreateFunc func, int order); +void uiHeaderLayout(const struct bContext *C, struct ARegion *ar, + uiHeaderCreateFunc func); + #endif /* UI_INTERFACE_H */ |