1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Add AtomLayoutStyle

This commit is contained in:
Lucas Meurer
2026-08-28 18:08:04 +02:00
parent de077b92d3
commit 86dd9b8c00
5 changed files with 144 additions and 68 deletions

View File

@@ -7,7 +7,7 @@ use eframe::egui::{
self, CentralPanel, Color32, Frame, Panel, TextStyle,
class::HasClasses as _,
theme::StyleProvider,
widget_style::{ButtonStyle, StyleArgs, TextVisuals, WidgetState},
widget_style::{AtomLayoutStyle, ButtonStyle, StyleArgs, TextVisuals, WidgetState},
};
/// Buttons with this class are styled as a destructive action.
@@ -61,13 +61,17 @@ impl StyleProvider<ButtonStyle> for MyTheme {
};
ButtonStyle {
min_size: egui::vec2(0.0, style.spacing.interact_size.y),
frame: Frame::new()
.fill(fill)
.corner_radius(self.corner_radius)
.inner_margin(8),
// Resolve the font from the style, so we follow the user's font sizes:
text_style: TextVisuals::new(style, TextStyle::Button, Color32::WHITE),
atom_layout: AtomLayoutStyle {
min_size: egui::vec2(0.0, style.spacing.interact_size.y),
gap: style.spacing.icon_spacing,
frame: Frame::new()
.fill(fill)
.corner_radius(self.corner_radius)
.inner_margin(8),
// Resolve the font from the style, so we follow the user's font sizes:
text_style: TextVisuals::new(style, TextStyle::Button, Color32::WHITE),
..Default::default()
},
}
}
}