bunch of ui tweaks and server ui

This commit is contained in:
2025-09-04 23:29:46 -05:00
parent ea9f255e95
commit e07b5044f9
3 changed files with 116 additions and 34 deletions
+17
View File
@@ -0,0 +1,17 @@
use eframe::egui::{Align, InnerResponse, Layout, Response, Ui, Widget};
pub trait UiExtensions {
fn fill_button(&mut self, widget: impl Widget) -> Response;
fn column<R>(&mut self, width: f32, f: impl FnOnce(&mut Self)-> R) -> InnerResponse<R>;
}
impl UiExtensions for Ui {
fn fill_button(&mut self, widget: impl Widget) -> Response {
self.add_sized((self.available_width(), 20.0), widget)
}
fn column<R>(&mut self, width: f32, f: impl FnOnce(&mut Self) -> R) -> InnerResponse<R> {
let third = (width, self.available_height()).into();
self.allocate_ui_with_layout(third, Layout::top_down(Align::Max), f)
}
}