mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
Add AtomLayoutStyle
This commit is contained in:
@@ -6,7 +6,9 @@
|
||||
use eframe::egui::{
|
||||
self, CentralPanel, Color32, Frame, Panel, TextStyle,
|
||||
theme::StyleProvider,
|
||||
widget_style::{ButtonStyle, HasClasses as _, StyleArgs, TextVisuals, WidgetState},
|
||||
widget_style::{
|
||||
AtomLayoutStyle, ButtonStyle, HasClasses as _, StyleArgs, TextVisuals, WidgetState,
|
||||
},
|
||||
};
|
||||
|
||||
/// Buttons with this class are styled as a destructive action.
|
||||
@@ -60,15 +62,19 @@ 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),
|
||||
text_style: TextVisuals {
|
||||
color: Color32::WHITE,
|
||||
// Resolve the font from the style, so we follow the user's font sizes:
|
||||
font_id: TextStyle::Button.resolve(style),
|
||||
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),
|
||||
text_style: TextVisuals {
|
||||
color: Color32::WHITE,
|
||||
// Resolve the font from the style, so we follow the user's font sizes:
|
||||
font_id: TextStyle::Button.resolve(style),
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user