use egui::{Button, TextEdit, Vec2};
pub trait ButtonWidgetExt<'a>: Sized {
fn fill_width(self) -> Self;
fn min_width(self, width: f32) -> Self;
fn min_height(self, height: f32) -> Self;
fn exact_size(self, size: Vec2) -> Self;
}
impl<'a> ButtonWidgetExt<'a> for Button<'a> {
fn fill_width(self) -> Self {
self.min_size(Vec2::new(f32::INFINITY, 0.0))
}
fn min_width(self, width: f32) -> Self {
self.min_size(Vec2::new(width, 0.0))
}
fn min_height(self, height: f32) -> Self {
self.min_size(Vec2::new(0.0, height))
}
fn exact_size(self, size: Vec2) -> Self {
self.min_size(size)
}
}
pub trait TextEditWidgetExt<'a>: Sized {
fn fill_width(self) -> Self;
fn fixed_width(self, width: f32) -> Self;
fn char_limit(self, limit: usize) -> Self;
}
impl<'a> TextEditWidgetExt<'a> for TextEdit<'a> {
fn fill_width(self) -> Self {
self.desired_width(f32::INFINITY)
}
fn fixed_width(self, width: f32) -> Self {
self.desired_width(width)
}
fn char_limit(self, limit: usize) -> Self {
self.char_limit(limit)
}
}
pub trait RoundingExt: Sized {
fn button_rounding(self) -> Self;
fn panel_rounding(self) -> Self;
fn no_rounding(self) -> Self;
fn pill_rounding(self) -> Self;
}