82 butrct.
ymax +=
U.pixelsize;
85 butrct.
xmin -=
U.pixelsize;
101 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
118 const float max_radius = (0.5f *
U.widget_unit);
120 if (delta >= 0 && delta < max_radius) {
121 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
123 if (bt->rect.xmax == block->
rect.
xmax) {
124 bt->rect.xmax -= delta;
159 short dir1 = 0, dir2 = 0;
162 bool left =
false, right =
false,
top =
false, down =
false;
165 if (butrct.
xmin - max_size[0] + center_x > 0.0f) {
168 if (butrct.
xmax + max_size[0] - center_x < win_size[0]) {
171 if (butrct.
ymin - max_size[1] + center_y > 0.0f) {
174 if (butrct.
ymax + max_size[1] - center_y < win_size[1]) {
178 if (
top == 0 && down == 0) {
179 if (butrct.
ymin - max_size[1] < win_size[1] - butrct.
ymax - max_size[1]) {
248 float offset_x = 0, offset_y = 0;
251 const float offset_overlap =
max_ff(
U.pixelsize, 1.0f);
254 offset_x = (butrct.
xmin - block->
rect.
xmax) + offset_overlap;
263 offset_x = (butrct.
xmax - block->
rect.
xmin) - offset_overlap;
272 offset_y = (butrct.
ymax - block->
rect.
ymin) - offset_overlap;
292 offset_y = (butrct.
ymin - block->
rect.
ymax) + offset_overlap;
316 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
338 if (midx < block->rect.xmin) {
353 if (midy < block->rect.ymin) {
368 if (dir1 && (dir1 & block->
direction) == 0) {
379 const bool off_screen_left = (block->
rect.
xmin < 0);
380 const bool off_screen_right = (block->
rect.
xmax > win_size[0]);
382 if (fully_aligned_with_button) {
386 else if (off_screen_left || off_screen_right) {
395 block->
direction = no_2nd_dir ? dir1 : (dir1 | dir2);
432 if (handle_ctx_area) {
435 if (handle_ctx_region) {
481 const float xmin_orig = block->
rect.
xmin;
491 if (block->
rect.
xmax > win_size[0] - margin) {
492 const float xofs = win_size[0] - margin - block->
rect.
xmax;
498 const float xofs = (margin - block->
rect.
xmin);
507 const float xofs = block->
rect.
xmin - xmin_orig;
508 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
509 bt->rect.xmin += xofs;
510 bt->rect.xmax += xofs;
518 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
527 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
528 if (bt->rect.ymin < block->
rect.
ymin) {
532 if (bt->rect.ymax > block->
rect.
ymax) {
539 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
597 if (!panel || dy == 0.0f) {
623 block->
panel = panel;
642 handle->
refresh = (block_old !=
nullptr);
657 block = handle_create_func(
C, handle, arg);
697 if (but ==
nullptr) {
743 x_offset += win_width - block->
rect.
xmin;
745 if (block->
rect.
xmax > win_size[0] - win_width) {
746 x_offset += win_size[0] - win_width - block->
rect.
xmax;
753 y_offset += win_width - block->
rect.
ymin;
755 if (block->
rect.
ymax > win_size[1] - win_width) {
756 y_offset += win_size[1] - win_width - block->
rect.
ymax;
761 if ((x_offset != 0) || (y_offset != 0)) {
767 if (
U.pie_initial_timeout > 0) {
780 if (
U.pie_animation_timeout > 0) {
781 for (
const std::unique_ptr<uiBut> &but_iter : block->
buttons) {
792 const float unit_size =
U.widget_unit / block->
aspect;
825 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
826 ymin =
min_ff(ymin, bt->rect.ymin);
827 ymax =
max_ff(ymax, bt->rect.ymax);
830 const float scroll_min = std::min(block->
rect.
ymax - ymax - scroll_pad, 0.0f);
831 const float scroll_max = std::max(block->
rect.
ymin - ymin + scroll_pad, 0.0f);
835 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
882 const bool can_refresh)
942 ARegion *region_popup_prev =
nullptr;
969 bool is_submenu =
false;
974 if (region !=
nullptr) {
1044 const int max_width = int((
data->compact ? 250.0f : 350.0f) *
UI_SCALE_FAC);
1054 if (
data->mouse_move_quit) {
1067 for (
auto &st_ref : messages) {
1068 const std::string &st = st_ref;
1069 text_width = std::max(text_width,
1073 int dialog_width = std::max(text_width +
int(style->
columnspace * 2.5), min_width);
1087 for (
auto &st : messages) {
1088 content->
label(st, ICON_NONE);
1091 if (
data->okay_button) {
1098 const float pad = std::max((1.0f - ((200.0f *
UI_SCALE_FAC) /
float(text_width))) / 2.0f,
1101 split->column(
true);
1107 buttons_block,
ButType::But, 0,
"OK", 0, 0, 0,
UI_UNIT_Y,
nullptr, 0, 0,
"");
1114 if (
data->mouse_move_quit) {
1115 const float button_center_x = -0.5f;
1116 const float button_center_y =
data->okay_button ? 4.0f : 2.0f;
1117 const int bounds_offset[2] = {int(button_center_x * layout->
width()),
1135 data->title = title;
1136 data->message = message;
1138 data->compact = compact;
1139 data->okay_button =
true;
1140 data->mouse_move_quit = compact;
bScreen * CTX_wm_screen(const bContext *C)
ARegion * CTX_wm_region_popup(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
void CTX_wm_region_popup_set(bContext *C, ARegion *region_popup)
void BKE_panel_free(Panel *panel)
Panel * BKE_panel_new(PanelType *panel_type)
blender::Vector< blender::StringRef > BLF_string_wrap(int fontid, blender::StringRef str, const int max_pixel_width, BLFWrapMode mode=BLFWrapMode::Minimal)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
void BLI_rctf_translate(struct rctf *rect, float x, float y)
void BLI_rctf_union(struct rctf *rct_a, const struct rctf *rct_b)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
void BLI_rcti_translate(struct rcti *rect, int x, int y)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
void BLI_rctf_recenter(struct rctf *rect, float x, float y)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
void BLI_rctf_init_minmax(struct rctf *rect)
void ED_region_tag_refresh_ui(ARegion *region)
void ED_region_update_rect(ARegion *region)
void ED_region_floating_init(ARegion *region)
void ED_workspace_status_text(bContext *C, const char *str)
void ED_region_tag_redraw(ARegion *region)
static void split(const char *text, const char *seps, char ***str, int *count)
Read Guarded memory(de)allocation.
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void UI_block_update_from_old(const bContext *C, uiBlock *block)
void UI_block_emboss_set(uiBlock *block, blender::ui::EmbossType emboss)
void UI_popup_menu_retval_set(const uiBlock *block, int retval, bool enable)
@ UI_BLOCK_MOVEMOUSE_QUIT
@ UI_BLOCK_NO_ACCELERATOR_KEYS
void UI_block_theme_style_set(uiBlock *block, char theme_style)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, blender::ui::EmbossType emboss)
void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2])
const uiStyle * UI_style_get_dpi()
void UI_popup_block_ex(bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, wmOperator *op)
void UI_block_translate(uiBlock *block, float x, float y)
void UI_block_flag_disable(uiBlock *block, int flag)
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
uiBut * UI_context_active_but_get(const bContext *C)
void UI_fontstyle_set(const uiFontStyle *fs)
@ UI_BLOCK_BOUNDS_POPUP_CENTER
uiBlock *(*)(bContext *C, ARegion *region, void *arg1) uiBlockCreateFunc
void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2)
void UI_block_draw(const bContext *C, uiBlock *block)
void UI_blocklist_free_inactive(const bContext *C, ARegion *region)
void UI_block_bounds_set_centered(uiBlock *block, int addval)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_flag_enable(uiBlock *block, int flag)
void UI_block_end_ex(const bContext *C, Main *bmain, wmWindow *window, Scene *scene, ARegion *region, Depsgraph *depsgraph, uiBlock *block, const int xy[2]=nullptr, int r_xy[2]=nullptr)
void UI_region_handlers_add(ListBase *handlers)
uiBut * uiDefBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_but_flag_enable(uiBut *but, int flag)
uiLayout * uiItemsAlertBox(uiBlock *block, const uiStyle *style, const int dialog_width, const eAlertIcon icon, const int icon_size)
uiBut * uiItemL_ex(uiLayout *layout, blender::StringRef name, int icon, bool highlight, bool redalert)
void(*)(void *arg) uiFreeArgFunc
int pad[32 - sizeof(int)]
BMesh const char void * data
void ui_but_update(uiBut *but)
bool ui_but_menu_draw_as_popover(const uiBut *but)
void ui_block_to_window_rctf(const ARegion *region, const uiBlock *block, rctf *rct_dst, const rctf *rct_src)
float ui_block_calc_pie_segment(uiBlock *block, const float event_xy[2])
#define UI_POPUP_MENU_TOP
@ UI_PIE_INITIAL_DIRECTION
uiBlock *(*)(bContext *C, uiPopupBlockHandle *handle, void *arg1) uiBlockHandleCreateFunc
#define UI_MENU_SUBMENU_PADDING
bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT
#define UI_MENU_SCROLL_PAD
#define UI_MENU_SCROLL_ARROW
@ UI_BLOCK_CONTAINS_SUBMENU_BUT
ARegion * ui_region_temp_add(bScreen *screen)
void ui_region_temp_remove(bContext *C, bScreen *screen, ARegion *region)
void * MEM_callocN(size_t len, const char *str)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
static PyObject * create_func(PyObject *, PyObject *args)
void(* listener)(const wmRegionListenerParams *params)
void(* draw)(const bContext *C, ARegion *region)
void(* layout)(const bContext *C, ARegion *region)
ARegionRuntimeHandle * runtime
blender::Vector< LayoutPanelBody > bodies
blender::Vector< LayoutPanelHeader > headers
LayoutPanels layout_panels
struct Panel_Runtime * runtime
blender::Vector< std::unique_ptr< uiBut > > buttons
uiPopupBlockHandle * handle
eBlockBoundsCalc bounds_type
void scale_y_set(float scale)
void label(blender::StringRef name, int icon)
uiLayout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
uiLayout & split(float percentage, bool align)
uiPopupBlockCreate popup_create_vars
struct wmEvent * eventstate
struct wmEvent * event_last_handled
void WM_cursor_set(wmWindow *win, int curs)
void wmGetProjectionMatrix(float mat[4][4], const rcti *winrct)
blender::int2 WM_window_native_pixel_size(const wmWindow *win)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
bScreen * WM_window_get_active_screen(const wmWindow *win)