diff options
Diffstat (limited to 'source/blender/editors/interface/interface_intern.h')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index bf2971f93df..0dfa23a4332 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -147,19 +147,11 @@ enum { /* max amount of items a radial menu (pie menu) can contain */ #define PIE_MAX_ITEMS 8 -struct uiButSearchData { - uiButSearchCreateFn create_fn; - uiButSearchUpdateFn update_fn; - void *arg; - uiButSearchArgFreeFn arg_free_fn; - uiButSearchContextMenuFn context_menu_fn; - uiButSearchTooltipFn tooltip_fn; - - const char *sep_string; -}; - struct uiBut { struct uiBut *next, *prev; + + /* Pointer back to the layout item holding this button. */ + uiLayout *layout; int flag, drawflag; eButType type; eButPointerType pointype; @@ -214,8 +206,6 @@ struct uiBut { uiButCompleteFunc autocomplete_func; void *autofunc_arg; - struct uiButSearchData *search; - uiButHandleRenameFunc rename_func; void *rename_arg1; void *rename_orig; @@ -256,9 +246,6 @@ struct uiBut { struct PropertyRNA *rnaprop; int rnaindex; - struct PointerRNA rnasearchpoin; - struct PropertyRNA *rnasearchprop; - /* Operator data */ struct wmOperatorType *optype; struct PointerRNA *opptr; @@ -294,11 +281,41 @@ struct uiBut { uiBlock *block; }; +/** Derived struct for #UI_BTYPE_TAB */ typedef struct uiButTab { uiBut but; struct MenuType *menu; } uiButTab; +/** Derived struct for #UI_BTYPE_SEARCH_MENU */ +typedef struct uiButSearch { + uiBut but; + + uiButSearchCreateFn popup_create_fn; + uiButSearchUpdateFn items_update_fn; + void *item_active; + + void *arg; + uiButSearchArgFreeFn arg_free_fn; + + uiButSearchContextMenuFn item_context_menu_fn; + uiButSearchTooltipFn item_tooltip_fn; + + const char *item_sep_string; + + struct PointerRNA rnasearchpoin; + struct PropertyRNA *rnasearchprop; +} uiButSearch; + +/** Derived struct for #UI_BTYPE_DECORATOR */ +typedef struct uiButDecorator { + uiBut but; + + struct PointerRNA rnapoin; + struct PropertyRNA *rnaprop; + int rnaindex; +} uiButDecorator; + /** * Additional, superimposed icon for a button, invoking an operator. */ @@ -493,6 +510,8 @@ extern void ui_window_to_region_rcti(const struct ARegion *region, extern void ui_region_to_window(const struct ARegion *region, int *x, int *y); extern void ui_region_winrct_get_no_margin(const struct ARegion *region, struct rcti *r_rect); +uiBut *ui_but_change_type(uiBut *but, eButType new_type); + extern double ui_but_value_get(uiBut *but); extern void ui_but_value_set(uiBut *but, double value); extern void ui_but_hsv_set(uiBut *but); @@ -662,13 +681,13 @@ ColorPicker *ui_block_colorpicker_create(struct uiBlock *block); /* Searchbox for string button */ struct ARegion *ui_searchbox_create_generic(struct bContext *C, struct ARegion *butregion, - uiBut *but); + uiButSearch *search_but); struct ARegion *ui_searchbox_create_operator(struct bContext *C, struct ARegion *butregion, - uiBut *but); + uiButSearch *search_but); struct ARegion *ui_searchbox_create_menu(struct bContext *C, struct ARegion *butregion, - uiBut *but); + uiButSearch *search_but); bool ui_searchbox_inside(struct ARegion *region, int x, int y); int ui_searchbox_find_index(struct ARegion *region, const char *name); @@ -681,7 +700,7 @@ bool ui_searchbox_event(struct bContext *C, const struct wmEvent *event); bool ui_searchbox_apply(uiBut *but, struct ARegion *region); void ui_searchbox_free(struct bContext *C, struct ARegion *region); -void ui_but_search_refresh(uiBut *but); +void ui_but_search_refresh(uiButSearch *but); /* interface_region_menu_popup.c */ int ui_but_menu_step(uiBut *but, int step); @@ -925,11 +944,12 @@ void ui_resources_free(void); /* interface_layout.c */ void ui_layout_add_but(uiLayout *layout, uiBut *but); -void ui_but_add_search(uiBut *but, - PointerRNA *ptr, - PropertyRNA *prop, - PointerRNA *searchptr, - PropertyRNA *searchprop); +bool ui_layout_replace_but_ptr(uiLayout *layout, const void *old_but_ptr, uiBut *new_but); +uiBut *ui_but_add_search(uiBut *but, + PointerRNA *ptr, + PropertyRNA *prop, + PointerRNA *searchptr, + PropertyRNA *searchprop); void ui_layout_list_set_labels_active(uiLayout *layout); /* menu callback */ void ui_item_menutype_func(struct bContext *C, struct uiLayout *layout, void *arg_mt); @@ -950,7 +970,7 @@ bool ui_but_anim_expression_create(uiBut *but, const char *str); void ui_but_anim_autokey(struct bContext *C, uiBut *but, struct Scene *scene, float cfra); void ui_but_anim_decorate_cb(struct bContext *C, void *arg_but, void *arg_dummy); -void ui_but_anim_decorate_update_from_flag(uiBut *but); +void ui_but_anim_decorate_update_from_flag(uiButDecorator *but); /* interface_query.c */ bool ui_but_is_editable(const uiBut *but) ATTR_WARN_UNUSED_RESULT; |