switch to WidgetRef

This commit is contained in:
2025-12-07 15:18:39 -05:00
parent f9376eb6d4
commit 089ed08c16
6 changed files with 32 additions and 32 deletions

View File

@@ -2,7 +2,7 @@ use iris::winit::attr::Selector;
use super::*;
pub fn werror(ui: &mut Ui, msg: &str) -> WidgetId {
pub fn werror(ui: &mut Ui, msg: &str) -> WidgetRef {
wtext(msg)
.size(20)
.pad(10)
@@ -15,7 +15,7 @@ pub fn hint(msg: impl Into<String>) -> TextBuilder {
wtext(msg).size(20).color(Color::GRAY)
}
pub fn field_widget(name: &str, hint_text: &str, ui: &mut Ui) -> WidgetId<TextEdit> {
pub fn field_widget(name: &str, hint_text: &str, ui: &mut Ui) -> WidgetRef<TextEdit> {
wtext(name)
.editable(true)
.size(20)
@@ -23,7 +23,7 @@ pub fn field_widget(name: &str, hint_text: &str, ui: &mut Ui) -> WidgetId<TextEd
.add(ui)
}
pub fn field_box(field: WidgetId<TextEdit>, ui: &mut Ui) -> WidgetId {
pub fn field_box(field: WidgetRef<TextEdit>, ui: &mut Ui) -> WidgetRef {
field
.clone()
.pad(10)
@@ -41,17 +41,17 @@ pub fn submit_button(
rect(color)
.radius(15)
.on(CursorSense::click(), move |ctx| {
ctx.ui[ctx.id].color = color.darker(0.2);
ctx.widget.get_mut().color = color.darker(0.2);
on_submit(ctx.state, ctx.ui);
})
.on(
CursorSense::HoverStart | CursorSense::unclick(),
move |ctx| {
ctx.ui[ctx.id].color = color.brighter(0.1);
ctx.widget.get_mut().color = color.brighter(0.1);
},
)
.on(CursorSense::HoverEnd, move |ctx| {
ctx.ui[ctx.id].color = color;
ctx.widget.get_mut().color = color;
})
.height(60)
.foreground(wtext(text).size(25).text_align(Align::CENTER))