80 butrct.
ymax +=
U.pixelsize;
83 butrct.
xmin -=
U.pixelsize;
99 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
116 const float max_radius = (0.5f *
U.widget_unit);
118 if (delta >= 0 && delta < max_radius) {
119 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
121 if (bt->rect.xmax == block->
rect.
xmax) {
122 bt->rect.xmax -= delta;
157 short dir1 = 0, dir2 = 0;
160 bool left =
false, right =
false,
top =
false, down =
false;
163 if (butrct.
xmin - max_size[0] + center_x > 0.0f) {
166 if (butrct.
xmax + max_size[0] - center_x < win_size[0]) {
169 if (butrct.
ymin - max_size[1] + center_y > 0.0f) {
172 if (butrct.
ymax + max_size[1] - center_y < win_size[1]) {
176 if (
top == 0 && down == 0) {
177 if (butrct.
ymin - max_size[1] < win_size[1] - butrct.
ymax - max_size[1]) {
246 float offset_x = 0, offset_y = 0;
249 const float offset_overlap =
max_ff(
U.pixelsize, 1.0f);
252 offset_x = (butrct.
xmin - block->
rect.
xmax) + offset_overlap;
261 offset_x = (butrct.
xmax - block->
rect.
xmin) - offset_overlap;
270 offset_y = (butrct.
ymax - block->
rect.
ymin) - offset_overlap;
290 offset_y = (butrct.
ymin - block->
rect.
ymax) + offset_overlap;
314 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
336 if (midx < block->rect.xmin) {
351 if (midy < block->rect.ymin) {
366 if (dir1 && (dir1 & block->
direction) == 0) {
377 const bool off_screen_left = (block->
rect.
xmin < 0);
378 const bool off_screen_right = (block->
rect.
xmax > win_size[0]);
380 if (fully_aligned_with_button) {
384 else if (off_screen_left || off_screen_right) {
393 block->
direction = no_2nd_dir ? dir1 : (dir1 | dir2);
430 if (handle_ctx_area) {
433 if (handle_ctx_region) {
479 const float xmin_orig = block->
rect.
xmin;
489 if (block->
rect.
xmax > win_size[0] - margin) {
490 const float xofs = win_size[0] - margin - block->
rect.
xmax;
496 const float xofs = (margin - block->
rect.
xmin);
505 const float xofs = block->
rect.
xmin - xmin_orig;
506 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
507 bt->rect.xmin += xofs;
508 bt->rect.xmax += xofs;
516 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
525 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
526 if (bt->rect.ymin < block->
rect.
ymin) {
530 if (bt->rect.ymax > block->
rect.
ymax) {
537 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
595 if (!panel || dy == 0.0f) {
621 block->
panel = panel;
640 handle->
refresh = (block_old !=
nullptr);
655 block = handle_create_func(
C, handle, arg);
695 if (but ==
nullptr) {
741 x_offset += win_width - block->
rect.
xmin;
743 if (block->
rect.
xmax > win_size[0] - win_width) {
744 x_offset += win_size[0] - win_width - block->
rect.
xmax;
751 y_offset += win_width - block->
rect.
ymin;
753 if (block->
rect.
ymax > win_size[1] - win_width) {
754 y_offset += win_size[1] - win_width - block->
rect.
ymax;
759 if ((x_offset != 0) || (y_offset != 0)) {
765 if (
U.pie_initial_timeout > 0) {
778 if (
U.pie_animation_timeout > 0) {
779 for (
const std::unique_ptr<uiBut> &but_iter : block->
buttons) {
790 const float unit_size =
U.widget_unit / block->
aspect;
823 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
824 ymin =
min_ff(ymin, bt->rect.ymin);
825 ymax =
max_ff(ymax, bt->rect.ymax);
828 const float scroll_min = std::min(block->
rect.
ymax - ymax - scroll_pad, 0.0f);
829 const float scroll_max = std::max(block->
rect.
ymin - ymin + scroll_pad, 0.0f);
833 for (
const std::unique_ptr<uiBut> &bt : block->
buttons) {
880 const bool can_refresh)
940 ARegion *region_popup_prev =
nullptr;
967 bool is_submenu =
false;
972 if (region !=
nullptr) {
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)
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)
Read Guarded memory(de)allocation.
void UI_block_update_from_old(const bContext *C, uiBlock *block)
void UI_block_theme_style_set(uiBlock *block, char theme_style)
void UI_block_translate(uiBlock *block, float x, float y)
void UI_but_tooltip_timer_remove(bContext *C, uiBut *but)
uiBut * UI_context_active_but_get(const bContext *C)
@ UI_BLOCK_THEME_STYLE_POPUP
@ UI_BLOCK_BOUNDS_POPUP_CENTER
void UI_block_draw(const bContext *C, uiBlock *block)
void UI_blocklist_free_inactive(const bContext *C, ARegion *region)
uiBlock *(*)(bContext *C, ARegion *region, void *arg1) uiBlockCreateFunc
@ UI_BLOCK_NO_ACCELERATOR_KEYS
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)
void(*)(void *arg) uiFreeArgFunc
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
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
@ UI_PIE_INITIAL_DIRECTION
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
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)