You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Merge pull request #81939 from YuriSizov/gui-flat-and-depressed
Replace flat buttons with flat-styled buttons with a visible pressed state
This commit is contained in:
@@ -951,7 +951,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
toolbar_stylebox->set_border_color(accent_color);
|
||||
toolbar_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE));
|
||||
toolbar_stylebox->set_content_margin(SIDE_BOTTOM, 0);
|
||||
toolbar_stylebox->set_expand_margin_all(2 * EDSCALE);
|
||||
toolbar_stylebox->set_expand_margin_individual(4 * EDSCALE, 2 * EDSCALE, 4 * EDSCALE, 4 * EDSCALE);
|
||||
theme->set_stylebox("ContextualToolbar", EditorStringName(EditorStyles), toolbar_stylebox);
|
||||
|
||||
// Script Editor
|
||||
@@ -1022,6 +1022,30 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
theme->set_constant("h_separation", "Button", 4 * EDSCALE);
|
||||
theme->set_constant("outline_size", "Button", 0);
|
||||
|
||||
// Flat button variations.
|
||||
|
||||
Ref<StyleBoxEmpty> style_flat_button = make_empty_stylebox();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
style_flat_button->set_content_margin((Side)i, style_widget->get_margin((Side)i) + style_widget->get_border_width((Side)i));
|
||||
}
|
||||
|
||||
Ref<StyleBoxFlat> style_flat_button_pressed = style_widget_pressed->duplicate();
|
||||
Color flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.8, 0.8, 0.8, 0.85);
|
||||
if (dark_theme) {
|
||||
flat_pressed_color = dark_color_1.lerp(accent_color, 0.2) * Color(0.6, 0.6, 0.6, 0.85);
|
||||
}
|
||||
style_flat_button_pressed->set_bg_color(flat_pressed_color);
|
||||
|
||||
theme->set_stylebox("normal", "FlatButton", style_flat_button);
|
||||
theme->set_stylebox("hover", "FlatButton", style_flat_button);
|
||||
theme->set_stylebox("pressed", "FlatButton", style_flat_button_pressed);
|
||||
theme->set_stylebox("disabled", "FlatButton", style_flat_button);
|
||||
|
||||
theme->set_stylebox("normal", "FlatMenuButton", style_flat_button);
|
||||
theme->set_stylebox("hover", "FlatMenuButton", style_flat_button);
|
||||
theme->set_stylebox("pressed", "FlatMenuButton", style_flat_button_pressed);
|
||||
theme->set_stylebox("disabled", "FlatMenuButton", style_flat_button);
|
||||
|
||||
const float ACTION_BUTTON_EXTRA_MARGIN = 32 * EDSCALE;
|
||||
|
||||
theme->set_type_variation("InspectorActionButton", "Button");
|
||||
|
||||
Reference in New Issue
Block a user