diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 17:51:31 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-24 17:51:31 +0400 |
commit | c1c3d66079adb2e0ea7b7eb9bdb2997f37623591 (patch) | |
tree | 7e5c443db618d598a10306a9efc2d9684ef6c8d3 /source/blender/editors/include/UI_interface.h | |
parent | 51014d8e4f45c132433f1319ddfa67419455c670 (diff) |
Fix #29306: Alt+N, Enter In Image View Does closes the dialog without executing.
If enter is pressed outside of any button in menu, generate two menu return values:
- UI_RETURN_CANCEL so button wouldn't be executed
- UI_RETURN_POPUP_OK so callback associated with popup block would be executed
Diffstat (limited to 'source/blender/editors/include/UI_interface.h')
-rw-r--r-- | source/blender/editors/include/UI_interface.h | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index ec6958c8415..d1f11d60999 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -122,6 +122,7 @@ typedef struct uiLayout uiLayout; #define UI_RETURN_OK 2 /* choice made */ #define UI_RETURN_OUT 4 /* left the menu */ #define UI_RETURN_UPDATE 8 /* update the button that opened */ +#define UI_RETURN_POPUP_OK 16 /* popup is ok to be handled */ /* block->flag bits 12-15 are identical to but->flag bits */ @@ -278,6 +279,30 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float #define UI_SCROLL_NO_OUTLINE 4 void uiWidgetScrollDraw(struct uiWidgetColors *wcol, struct rcti *rect, struct rcti *slider, int state); +/* Callbacks + * + * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback. + * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is + * mostly for compatibility with older code. + * + * uiButSetCompleteFunc is for tab completion. + * + * uiButSearchFunc is for name buttons, showing a popup with matches + * + * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used, + * in case events, operators or RNA are not sufficient to handle the button. + * + * uiButSetNFunc will free the argument with MEM_freeN. */ + +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 (*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); + /* Menu Callbacks */ typedef void (*uiMenuCreateFunc)(struct bContext *C, struct uiLayout *layout, void *arg1); @@ -313,7 +338,7 @@ typedef void (*uiBlockCancelFunc)(void *arg1); void uiPupBlock(struct bContext *C, uiBlockCreateFunc func, void *arg); void uiPupBlockO(struct bContext *C, uiBlockCreateFunc func, void *arg, const char *opname, int opcontext); -void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockCancelFunc cancel_func, void *arg); +void uiPupBlockEx(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg); /* void uiPupBlockOperator(struct bContext *C, uiBlockCreateFunc func, struct wmOperator *op, int opcontext); */ /* UNUSED */ void uiPupBlockClose(struct bContext *C, uiBlock *block); @@ -529,30 +554,6 @@ void uiSetButLink(struct uiBut *but, void **poin, void ***ppoin, short *tot, void uiComposeLinks(uiBlock *block); uiBut *uiFindInlink(uiBlock *block, void *poin); -/* Callbacks - * - * uiBlockSetHandleFunc/ButmFunc are for handling events through a callback. - * HandleFunc gets the retval passed on, and ButmFunc gets a2. The latter is - * mostly for compatibility with older code. - * - * uiButSetCompleteFunc is for tab completion. - * - * uiButSearchFunc is for name buttons, showing a popup with matches - * - * uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used, - * in case events, operators or RNA are not sufficient to handle the button. - * - * uiButSetNFunc will free the argument with MEM_freeN. */ - -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 (*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); - /* use inside searchfunc to add items */ int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin, int iconid); /* bfunc gets search item *poin as arg2, or if NULL the old string */ |