From 3ec4d0b51bf3a76725e39a57b0f30bec3edc6882 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Nov 2017 04:30:07 +1100 Subject: UI: Add UILayout.operator_menu_hold This is an operator button that opens a menu when the button is held. --- source/blender/editors/include/UI_interface.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 8b4f094cb8d..a609a3b51fd 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -136,6 +136,7 @@ enum { /* block->flag bits 14-17 are identical to but->drawflag bits */ +#define UI_BLOCK_POPUP_HOLD (1 << 18) #define UI_BLOCK_LIST_ITEM (1 << 19) #define UI_BLOCK_RADIAL (1 << 20) @@ -354,6 +355,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 void (*uiButHandleHoldFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); typedef int (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg); typedef struct ARegion *(*uiButSearchCreateFunc)(struct bContext *C, struct ARegion *butregion, uiBut *but); typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, const char *str, uiSearchItems *items); @@ -395,6 +397,7 @@ void UI_popup_menu_reports(struct bContext *C, struct ReportList *reports) ATTR_ int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1, 2); void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); +void UI_popup_menu_but_set(uiPopupMenu *pup, struct ARegion *butregion, uiBut *but); /* Pie menus */ typedef struct uiPieMenu uiPieMenu; @@ -726,6 +729,8 @@ bool UI_textbutton_activate_but(const struct bContext *C, uiBut *but); void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); +void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN); + /* Autocomplete * * Tab complete helper functions, for use in uiButCompleteFunc callbacks. @@ -988,6 +993,11 @@ void uiItemFullO( uiLayout *layout, const char *idname, const char *name, int icon, struct IDProperty *properties, int context, int flag, PointerRNA *r_opptr); +void uiItemFullOMenuHold_ptr( + uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, + struct IDProperty *properties, int context, int flag, + const char *menu_id, /* extra menu arg. */ + PointerRNA *r_opptr); void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon); void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon); -- cgit v1.2.3