You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Merge pull request #89693 from Calinou/dialogs-add-button-minimum-size
Add minimum width/height to dialog buttons
This commit is contained in:
@@ -210,6 +210,15 @@ void AcceptDialog::_update_child_rects() {
|
||||
bg_panel->set_position(Point2());
|
||||
bg_panel->set_size(dlg_size);
|
||||
|
||||
for (int i = 0; i < buttons_hbox->get_child_count(); i++) {
|
||||
Button *b = Object::cast_to<Button>(buttons_hbox->get_child(i));
|
||||
if (!b) {
|
||||
continue;
|
||||
}
|
||||
|
||||
b->set_custom_minimum_size(Size2(theme_cache.buttons_min_width, theme_cache.buttons_min_height));
|
||||
}
|
||||
|
||||
// Place the buttons from the bottom edge to their minimum required size.
|
||||
Size2 buttons_minsize = buttons_hbox->get_combined_minimum_size();
|
||||
Size2 buttons_size = Size2(dlg_size.x - h_margins, buttons_minsize.y);
|
||||
@@ -389,6 +398,8 @@ void AcceptDialog::_bind_methods() {
|
||||
|
||||
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, AcceptDialog, panel_style, "panel");
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, AcceptDialog, buttons_separation);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, AcceptDialog, buttons_min_width);
|
||||
BIND_THEME_ITEM(Theme::DATA_TYPE_CONSTANT, AcceptDialog, buttons_min_height);
|
||||
}
|
||||
|
||||
bool AcceptDialog::swap_cancel_ok = false;
|
||||
|
||||
Reference in New Issue
Block a user