78 printf(
"%s: cannot cycle button '%s'\n", __func__, but->
str.c_str());
98 str.substr(0, sep_index);
111 static uint mem[256];
112 static bool first =
true;
119 memset(mem, -1,
sizeof(mem));
130 for (
const std::unique_ptr<uiBut> &but_iter : block->
buttons) {
139 return but_iter.get();
302 int offset[2] = {0, 0};
304 uiBut *but_activate =
nullptr;
328 for (
const std::unique_ptr<uiBut> &but_iter : block->
buttons) {
329 offset[0] =
min_ii(offset[0],
335 for (
const std::unique_ptr<uiBut> &but_iter : block->
buttons) {
337 but_activate = but_iter.get();
402 const bool can_refresh)
430 handle->
popup =
true;
464 uiDefIconTextBut(block,
ButType::Label, 0, icon, titlestr, 0, 0, 200,
UI_UNIT_Y,
nullptr,
"");
468 block,
ButType::Label, 0, title, 0, 0, 200,
UI_UNIT_Y,
nullptr, 0.0, 0.0,
"");
477 const char *block_name,
487 pup->
block->
handle = MEM_new<uiPopupBlockHandle>(__func__);
515 uiBut *but =
nullptr;
569 const char *msg, *msg_next;
575 if (pup ==
nullptr) {
587 msg = report->message;
591 msg_next = strchr(msg,
'\n');
597 layout->
label(msg, icon);
599 }
while ((msg = msg_next) && *msg);
620 if (title && title[0]) {
631 status.range(
IFACE_(
"Search"), ICON_EVENT_A, ICON_EVENT_Z);
653 const bool allow_refresh =
true;
682 C,
nullptr,
nullptr, func,
nullptr, arg, arg_free, can_refresh);
683 handle->
popup =
true;
687 status.item(
" ", ICON_NONE);
710 C,
nullptr,
nullptr, func,
nullptr, arg,
nullptr,
true);
711 handle->
popup =
true;
722 status.item(
" ", ICON_NONE);
735 if (handle ==
nullptr) {
736 printf(
"Error: used outside of a popup!\n");
759 const bool cancel_default,
764 const bool windows_layout =
true;
766 const bool windows_layout =
false;
769 if (windows_layout) {
778 if (
uiBut *but = (*but_fn)()) {
779 const bool is_cancel = (but_fn == &cancel_fn);
783 if (is_cancel == cancel_default) {
795 const std::optional<StringRef> confirm_text_opt,
796 const std::optional<StringRef> cancel_text_opt,
803 const StringRef confirm_text = confirm_text_opt.value_or(
IFACE_(
"OK"));
804 const StringRef cancel_text = cancel_text_opt.value_or(
IFACE_(
"Cancel"));
807 const bool show_confirm = !confirm_text.
is_empty();
808 const bool show_cancel = !cancel_text.
is_empty();
809 uiLayout *row = (show_confirm && show_cancel) ? &layout->
split(0.5f,
false) : layout;
813 cancel_default =
true;
816 auto confirm_fn = [&row, &
ot, &confirm_text, &icon, &r_ptr, &show_confirm]() ->
uiBut * {
830 auto cancel_fn = [&row, &cancel_text, &show_cancel]() ->
uiBut * {
868 handle->opcontext = opcontext;
wmWindow * CTX_wm_window(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
void BKE_reports_unlock(ReportList *reports)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_lock(ReportList *reports)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int min_ii(int a, int b)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
#define SNPRINTF_UTF8(dst, format,...)
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
#define ARRAY_SET_ITEMS(...)
#define CTX_IFACE_(context, msgid)
#define RGN_ALIGN_ENUM_FROM_MASK(align)
#define RGN_TYPE_IS_HEADER_ANY(regiontype)
void ED_region_tag_refresh_ui(ARegion *region)
void ED_workspace_status_text(bContext *C, const char *str)
Read Guarded memory(de)allocation.
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
uiBut * uiDefIconTextBut(uiBlock *block, uiButTypeWithPointerType but_and_ptr_type, int retval, int icon, blender::StringRef str, int x, int y, short width, short height, void *poin, std::optional< blender::StringRef > tip)
void UI_popup_menu_retval_set(const uiBlock *block, int retval, bool enable)
@ UI_BLOCK_MOVEMOUSE_QUIT
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)
int UI_icon_from_report_type(int type)
const uiStyle * UI_style_get_dpi()
void(*)(bContext *C, void *arg1) uiBlockCancelFunc
bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block)
bool UI_block_has_active_default_button(const uiBlock *block)
void(*)(bContext *C, void *arg, int event) uiBlockHandleFunc
uiBlock *(*)(bContext *C, ARegion *region, void *arg1) uiBlockCreateFunc
void UI_block_bounds_set_menu(uiBlock *block, int addval, const int bounds_offset[2])
bool UI_block_is_empty_ex(const uiBlock *block, bool skip_title)
void UI_block_bounds_set_text(uiBlock *block, int addval)
void UI_popup_handlers_add(bContext *C, ListBase *handlers, uiPopupBlockHandle *popup, char flag)
void UI_block_free(const bContext *C, uiBlock *block)
void UI_block_region_set(uiBlock *block, ARegion *region)
void UI_block_direction_set(uiBlock *block, char direction)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_flag_enable(uiBlock *block, int flag)
void UI_popup_handlers_remove(ListBase *handlers, uiPopupBlockHandle *popup)
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)
void UI_menutype_draw(bContext *C, MenuType *mt, uiLayout *layout)
void(*)(void *arg) uiFreeArgFunc
void(*)(bContext *C, uiLayout *layout, void *arg1) uiMenuCreateFunc
const T & last(const int64_t n=0) const
static constexpr int64_t not_found
constexpr bool is_empty() const
void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but)
uiBut * ui_popup_menu_memory_get(uiBlock *block)
void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt)
uiPopupBlockHandle * ui_popup_block_create(bContext *C, ARegion *butregion, uiBut *but, uiBlockCreateFunc create_func, uiBlockHandleCreateFunc handle_create_func, void *arg, uiFreeArgFunc arg_free, bool can_refresh)
void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
bool ui_block_is_menu(const uiBlock *block) ATTR_WARN_UNUSED_RESULT
bool ui_but_is_editable(const uiBut *but) ATTR_WARN_UNUSED_RESULT
#define UI_MENU_WIDTH_MIN
int2 block_layout_resolve(uiBlock *block)
uiLayout & block_layout(uiBlock *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
uint64_t get_default_hash(const T &v, const Args &...args)
PropertyType RNA_property_type(PropertyRNA *prop)
int RNA_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
ARegionRuntimeHandle * runtime
blender::Vector< std::unique_ptr< uiBut > > buttons
uiPopupBlockHandle * handle
const bContextStore * context
uiMenuStepFunc menu_step_func
blender::wm::OpCallContext operator_context() const
void operator_context_set(blender::wm::OpCallContext opcontext)
void label(blender::StringRef name, int icon)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
uiLayout & split(float percentage, bool align)
void context_copy(const bContextStore *context)
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, blender::wm::OpCallContext context, eUI_Item_Flag flag)
void(* popup_func)(bContext *C, void *arg, int event)
void(* cancel_func)(bContext *C, void *arg)
int prev_bounds_offset[2]
struct wmEvent * eventstate
void WM_event_add_mousemove(wmWindow *win)
bScreen * WM_window_get_active_screen(const wmWindow *win)