void Popup::popup_centered_ratio(float p_screen_ratio) { Control *window = get_window(); ERR_FAIL_COND(!window); emit_signal("about_to_show"); Rect2 rect; Point2 window_size = window==this ? get_parent_area_size() :window->get_size(); rect.size = (window_size * p_screen_ratio).floor(); rect.pos = ((window_size-rect.size)/2.0).floor(); set_pos( rect.pos ); set_size( rect.size ); show_modal(exclusive); _fix_size(); Control *focusable = find_next_valid_focus(); if (focusable) focusable->grab_focus(); _post_popup(); notification(NOTIFICATION_POST_POPUP); }
void Popup::popup() { emit_signal("about_to_show"); show_modal(exclusive); _fix_size(); Control *focusable = find_next_valid_focus(); if (focusable) focusable->grab_focus(); _post_popup(); notification(NOTIFICATION_POST_POPUP); }
void Popup::popup(const Rect2 &bounds) { emit_signal("about_to_show"); show_modal(exclusive); // Fit the popup into the optionally provided bounds. if (!bounds.has_no_area()) { set_position(bounds.position); set_size(bounds.size); } _fix_size(); Control *focusable = find_next_valid_focus(); if (focusable) focusable->grab_focus(); _post_popup(); notification(NOTIFICATION_POST_POPUP); popped_up = true; }
void Popup::popup_centered_ratio(float p_screen_ratio) { emit_signal("about_to_show"); Rect2 rect; Point2 window_size = get_viewport_rect().size; rect.size = (window_size * p_screen_ratio).floor(); rect.position = ((window_size - rect.size) / 2.0).floor(); set_position(rect.position); set_size(rect.size); show_modal(exclusive); _fix_size(); Control *focusable = find_next_valid_focus(); if (focusable) focusable->grab_focus(); _post_popup(); notification(NOTIFICATION_POST_POPUP); popped_up = true; }