Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_region_popover.c
| Show First 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Popup Menu API with begin & end | /** \name Popup Menu API with begin & end | ||||
| * \{ */ | * \{ */ | ||||
| /** | |||||
| * Only return handler, and set optional title. | |||||
| * | |||||
| * \param from_active_button: Use the active button for positioning, | |||||
| * use when the popover is activated from an operator instead of directly from the button. | |||||
| */ | |||||
| uiPopover *UI_popover_begin(bContext *C, int ui_menu_width, bool from_active_button) | uiPopover *UI_popover_begin(bContext *C, int ui_menu_width, bool from_active_button) | ||||
| { | { | ||||
| uiPopover *pup = MEM_callocN(sizeof(uiPopover), "popover menu"); | uiPopover *pup = MEM_callocN(sizeof(uiPopover), "popover menu"); | ||||
| if (ui_menu_width == 0) { | if (ui_menu_width == 0) { | ||||
| ui_menu_width = U.widget_unit * UI_POPOVER_WIDTH_UNITS; | ui_menu_width = U.widget_unit * UI_POPOVER_WIDTH_UNITS; | ||||
| } | } | ||||
| pup->ui_size_x = ui_menu_width; | pup->ui_size_x = ui_menu_width; | ||||
| Show All 21 Lines | |||||
| } | } | ||||
| static void popover_keymap_fn(wmKeyMap *UNUSED(keymap), wmKeyMapItem *UNUSED(kmi), void *user_data) | static void popover_keymap_fn(wmKeyMap *UNUSED(keymap), wmKeyMapItem *UNUSED(kmi), void *user_data) | ||||
| { | { | ||||
| uiPopover *pup = user_data; | uiPopover *pup = user_data; | ||||
| pup->block->handle->menuretval = UI_RETURN_OK; | pup->block->handle->menuretval = UI_RETURN_OK; | ||||
| } | } | ||||
| /* set the whole structure to work */ | |||||
| void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) | void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) | ||||
| { | { | ||||
| wmWindow *window = CTX_wm_window(C); | wmWindow *window = CTX_wm_window(C); | ||||
| /* Create popup block. No refresh support since the buttons were created | /* Create popup block. No refresh support since the buttons were created | ||||
| * between begin/end and we have no callback to recreate them. */ | * between begin/end and we have no callback to recreate them. */ | ||||
| uiPopupBlockHandle *handle; | uiPopupBlockHandle *handle; | ||||
| if (keymap) { | if (keymap) { | ||||
| ▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines | |||||