Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_query.c
| Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | return ELEM(but->type, | ||||
| UI_BTYPE_ICON_TOGGLE_N, | UI_BTYPE_ICON_TOGGLE_N, | ||||
| UI_BTYPE_TOGGLE_N, | UI_BTYPE_TOGGLE_N, | ||||
| UI_BTYPE_CHECKBOX, | UI_BTYPE_CHECKBOX, | ||||
| UI_BTYPE_CHECKBOX_N, | UI_BTYPE_CHECKBOX_N, | ||||
| UI_BTYPE_ROW, | UI_BTYPE_ROW, | ||||
| UI_BTYPE_TREEROW); | UI_BTYPE_TREEROW); | ||||
| } | } | ||||
| /** | |||||
| * Can we mouse over the button or is it hidden/disabled/layout. | |||||
| * \note ctrl is kind of a hack currently, | |||||
| * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. | |||||
| */ | |||||
| bool ui_but_is_interactive(const uiBut *but, const bool labeledit) | bool ui_but_is_interactive(const uiBut *but, const bool labeledit) | ||||
| { | { | ||||
| /* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */ | /* NOTE: #UI_BTYPE_LABEL is included for highlights, this allows drags. */ | ||||
| if ((but->type == UI_BTYPE_LABEL) && but->dragpoin == NULL) { | if ((but->type == UI_BTYPE_LABEL) && but->dragpoin == NULL) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| if (ELEM(but->type, UI_BTYPE_ROUNDBOX, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_LISTBOX)) { | if (ELEM(but->type, UI_BTYPE_ROUNDBOX, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, UI_BTYPE_LISTBOX)) { | ||||
| return false; | return false; | ||||
| Show All 10 Lines | bool ui_but_is_interactive(const uiBut *but, const bool labeledit) | ||||
| } | } | ||||
| if ((but->type == UI_BTYPE_LISTROW) && labeledit) { | if ((but->type == UI_BTYPE_LISTROW) && labeledit) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| /* file selectors are exempt from utf-8 checks */ | |||||
| bool UI_but_is_utf8(const uiBut *but) | bool UI_but_is_utf8(const uiBut *but) | ||||
| { | { | ||||
| if (but->rnaprop) { | if (but->rnaprop) { | ||||
| const int subtype = RNA_property_subtype(but->rnaprop); | const int subtype = RNA_property_subtype(but->rnaprop); | ||||
| return !(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING)); | return !(ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING)); | ||||
| } | } | ||||
| return !(but->flag & UI_BUT_NO_UTF8); | return !(but->flag & UI_BUT_NO_UTF8); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH_BACKWARD (uiBut *, but, &block->buttons) { | ||||
| } | } | ||||
| return but; | return but; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* x and y are only used in case event is NULL... */ | |||||
| uiBut *ui_but_find_mouse_over_ex(const ARegion *region, | uiBut *ui_but_find_mouse_over_ex(const ARegion *region, | ||||
| const int xy[2], | const int xy[2], | ||||
| const bool labeledit, | const bool labeledit, | ||||
| const uiButFindPollFn find_poll, | const uiButFindPollFn find_poll, | ||||
| const void *find_custom_data) | const void *find_custom_data) | ||||
| { | { | ||||
| uiBut *butover = NULL; | uiBut *butover = NULL; | ||||
| ▲ Show 20 Lines • Show All 497 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Screen (#bScreen) Spatial | /** \name Screen (#bScreen) Spatial | ||||
| * \{ */ | * \{ */ | ||||
| /** Check if the cursor is over any popups. */ | |||||
| ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2]) | ARegion *ui_screen_region_find_mouse_over_ex(bScreen *screen, const int xy[2]) | ||||
| { | { | ||||
| LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { | LISTBASE_FOREACH (ARegion *, region, &screen->regionbase) { | ||||
| rcti winrct; | rcti winrct; | ||||
| ui_region_winrct_get_no_margin(region, &winrct); | ui_region_winrct_get_no_margin(region, &winrct); | ||||
| if (BLI_rcti_isect_pt_v(&winrct, xy)) { | if (BLI_rcti_isect_pt_v(&winrct, xy)) { | ||||
| Show All 23 Lines | |||||