Blender V5.0
interface_region_popup.cc File Reference
#include <algorithm>
#include <cstdarg>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_userdef_types.h"
#include "BLF_api.hh"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_rect.h"
#include "BLI_utildefines.h"
#include "BKE_context.hh"
#include "BKE_screen.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_screen.hh"
#include "interface_intern.hh"
#include "interface_regions_intern.hh"

Go to the source code of this file.

Classes

struct  uiAlertData

Functions

Utility Functions
void ui_popup_translate (ARegion *region, const int mdiff[2])
static void ui_popup_block_position (wmWindow *window, ARegion *butregion, uiBut *but, uiBlock *block)
Menu Block Creation
static void ui_block_region_refresh (const bContext *C, ARegion *region)
static void ui_block_region_draw (const bContext *C, ARegion *region)
static void ui_block_region_popup_window_listener (const wmRegionListenerParams *params)
static void ui_popup_block_clip (wmWindow *window, uiBlock *block)
void ui_popup_block_scrolltest (uiBlock *block)
static void ui_popup_block_remove (bContext *C, uiPopupBlockHandle *handle)
void ui_layout_panel_popup_scroll_apply (Panel *panel, const float dy)
void UI_popup_dummy_panel_set (ARegion *region, uiBlock *block)
uiBlockui_popup_block_refresh (bContext *C, uiPopupBlockHandle *handle, ARegion *butregion, uiBut *but)
uiPopupBlockHandleui_popup_block_create (bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg, uiFreeArgFunc arg_free, const bool can_refresh)
void ui_popup_block_free (bContext *C, uiPopupBlockHandle *handle)
static void ui_alert_ok_cb (bContext *C, void *arg1, void *arg2)
static void ui_alert_ok (bContext *, void *arg, int)
static void ui_alert_cancel (bContext *, void *user_data)
static uiBlockui_alert_create (bContext *C, ARegion *region, void *user_data)
void UI_alert (bContext *C, const StringRef title, const StringRef message, const eAlertIcon icon, const bool compact)

Detailed Description

PopUp Region (Generic)

Definition in file interface_region_popup.cc.

Function Documentation

◆ UI_alert()

void UI_alert ( bContext * C,
const StringRef title,
const StringRef message,
const eAlertIcon icon,
const bool compact )

◆ ui_alert_cancel()

void ui_alert_cancel ( bContext * ,
void * user_data )
static

Definition at line 1032 of file interface_region_popup.cc.

References data.

Referenced by UI_alert().

◆ ui_alert_create()

◆ ui_alert_ok()

void ui_alert_ok ( bContext * ,
void * arg,
int  )
static

Definition at line 1026 of file interface_region_popup.cc.

References data.

Referenced by UI_alert().

◆ ui_alert_ok_cb()

void ui_alert_ok_cb ( bContext * C,
void * arg1,
void * arg2 )
static

◆ ui_block_region_draw()

void ui_block_region_draw ( const bContext * C,
ARegion * region )
static

Definition at line 450 of file interface_region_popup.cc.

References C, LISTBASE_FOREACH, ARegion::runtime, and UI_block_draw().

Referenced by ui_popup_block_create().

◆ ui_block_region_popup_window_listener()

void ui_block_region_popup_window_listener ( const wmRegionListenerParams * params)
static

Use to refresh centered popups on screen resizing (for splash).

Definition at line 460 of file interface_region_popup.cc.

References wmNotifier::action, wmNotifier::category, ED_region_tag_refresh_ui(), NA_EDITED, NC_WINDOW, and params.

Referenced by ui_popup_block_create().

◆ ui_block_region_refresh()

◆ ui_layout_panel_popup_scroll_apply()

void ui_layout_panel_popup_scroll_apply ( Panel * panel,
const float dy )

◆ ui_popup_block_clip()

◆ ui_popup_block_create()

uiPopupBlockHandle * ui_popup_block_create ( bContext * C,
ARegion * butregion,
uiBut * but,
uiBlockCreateFunc create_func,
uiBlockHandleCreateFunc handle_create_func,
void * arg,
uiFreeArgFunc arg_free,
const bool can_refresh )

◆ ui_popup_block_free()

◆ ui_popup_block_position()

void ui_popup_block_position ( wmWindow * window,
ARegion * butregion,
uiBut * but,
uiBlock * block )
static

◆ ui_popup_block_refresh()

uiBlock * ui_popup_block_refresh ( bContext * C,
uiPopupBlockHandle * handle,
ARegion * butregion,
uiBut * but )

Called for creating new popups and refreshing existing ones.

Definition at line 627 of file interface_region_popup.cc.

References uiPopupBlockCreate::arg, uiBlock::aspect, BLI_addhead(), BLI_assert, BLI_rctf_recenter(), BLI_rctf_size_x(), BLI_rctf_size_y(), uiBut::block, uiBlock::bounds_type, uiBlock::buttons, C, uiPopupBlockHandle::can_refresh, copy_v2_v2(), create_func(), uiPopupBlockCreate::create_func, CTX_data_depsgraph_pointer(), CTX_data_main(), CTX_data_scene(), CTX_wm_window(), uiBlock::direction, uiPopupBlockHandle::direction, ED_region_floating_init(), ED_region_tag_redraw(), ED_region_update_rect(), ELEM, uiBlock::endblock, wmWindow::event_last_handled, uiPopupBlockCreate::event_xy, wmWindow::eventstate, uiBlock::flag, PieMenuData::flags, FLT_MAX, uiBlock::handle, uiPopupBlockCreate::handle_create_func, max_ff(), MEM_callocN(), min_ff(), uiBlock::oldblock, uiBlock::panel, PieMenuData::pie_center_init, PieMenuData::pie_center_spawned, uiBlock::pie_data, uiPopupBlockHandle::popup_create_vars, uiPopupBlockHandle::prev_block_rect, uiBlock::rect, uiPopupBlockHandle::refresh, uiPopupBlockHandle::region, ARegion::regiondata, ARegion::runtime, uiBlock::saferct, uiBlock::safety, uiSafetyRct::safety, uiPopupBlockHandle::scrolloffset, U, UI_BLOCK_BOUNDS_POPUP_CENTER, ui_block_calc_pie_segment(), UI_block_end_ex(), ui_block_is_menu(), UI_BLOCK_LOOP, UI_BLOCK_NO_ACCELERATOR_KEYS, UI_BLOCK_PIE_MENU, UI_BLOCK_POPOVER, UI_BLOCK_POPUP, UI_BLOCK_THEME_STYLE_POPUP, UI_block_theme_style_set(), UI_block_translate(), UI_block_update_from_old(), UI_blocklist_free_inactive(), UI_DIR_DOWN, UI_DIR_UP, ui_layout_panel_popup_scroll_apply(), UI_MENU_SCROLL_PAD, UI_PIE_INITIAL_DIRECTION, ui_popup_block_clip(), ui_popup_block_position(), ui_popup_block_scrolltest(), UI_POPUP_MARGIN, UI_POPUP_MENU_TOP, UI_RADIAL_NONE, UI_SCREEN_MARGIN, UI_UNIT_Y, UNPACK2, uiBlock::winmat, ARegion::winrct, WM_window_native_pixel_size(), wmGetProjectionMatrix(), rctf::xmax, rcti::xmax, rctf::xmin, rcti::xmin, rctf::ymax, rcti::ymax, rctf::ymin, and rcti::ymin.

Referenced by ui_block_region_refresh(), and ui_popup_block_create().

◆ ui_popup_block_remove()

◆ ui_popup_block_scrolltest()

◆ UI_popup_dummy_panel_set()

void UI_popup_dummy_panel_set ( ARegion * region,
uiBlock * block )

Set a dummy panel in the popup block to support using layout panels, the panel is linked to the popup region so layout panels state can be persistent until the popup is closed.

Definition at line 610 of file interface_region_popup.cc.

References BKE_panel_new(), Panel_Runtime::block, LayoutPanels::clear(), PanelType::flag, Panel_Runtime::layout_panels, uiBlock::panel, PANEL_TYPE_NO_HEADER, ARegion::runtime, and Panel::runtime.

Referenced by ui_alert_create(), ui_paneltype_draw_impl(), wm_block_create_redo(), wm_block_dialog_create(), and wm_operator_ui_create().

◆ ui_popup_translate()

void ui_popup_translate ( ARegion * region,
const int mdiff[2] )