Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_region_popover.c
| Show First 20 Lines • Show All 296 Lines • ▼ Show 20 Lines | if (pt == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (pt->poll && (pt->poll(C, pt) == false)) { | if (pt->poll && (pt->poll(C, pt) == false)) { | ||||
| /* cancel but allow event to pass through, just like operators do */ | /* cancel but allow event to pass through, just like operators do */ | ||||
| return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); | return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH); | ||||
| } | } | ||||
| uiBlock *block = NULL; | |||||
| if (keep_open) { | if (keep_open) { | ||||
| ui_popover_panel_create(C, NULL, NULL, ui_item_paneltype_func, pt); | uiPopupBlockHandle *handle = ui_popover_panel_create(C, NULL, NULL, ui_item_paneltype_func, pt); | ||||
| uiPopover *pup = handle->popup_create_vars.arg; | |||||
| block = pup->block; | |||||
| } | } | ||||
| else { | else { | ||||
| uiPopover *pup = UI_popover_begin(C, U.widget_unit * pt->ui_units_x); | uiPopover *pup = UI_popover_begin(C, U.widget_unit * pt->ui_units_x); | ||||
| layout = UI_popover_layout(pup); | layout = UI_popover_layout(pup); | ||||
| UI_paneltype_draw(C, pt, layout); | UI_paneltype_draw(C, pt, layout); | ||||
| UI_popover_end(C, pup, NULL); | UI_popover_end(C, pup, NULL); | ||||
| block = pup->block; | |||||
| } | } | ||||
| if (block) { | |||||
| for (uiBut *but = block->buttons.first; but; but = but->next) { | |||||
| but->flag |= UI_BUT_ACTIVATE_INIT; | |||||
| } | |||||
| UI_block_active_only(C, CTX_wm_region(C), block); | |||||
| } | |||||
| return OPERATOR_INTERFACE; | return OPERATOR_INTERFACE; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Popup Menu API with begin & end | /** \name Popup Menu API with begin & end | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines | |||||