#![cfg_attr(target_arch = "xtensa", no_std, no_main)]
#![cfg_attr(
target_arch = "xtensa",
feature(impl_trait_in_assoc_type, type_alias_impl_trait)
)]
use oxivgl::{
style::Selector,
view::{NavAction, View},
widgets::{Align, Label, Msgbox, Obj, Screen, WidgetError},
};
#[derive(Default)]
struct WidgetMsgbox3 {
_label1: Option<Label<'static>>,
_label2: Option<Label<'static>>,
_label3: Option<Label<'static>>,
}
impl View for WidgetMsgbox3 {
fn create(&mut self, container: &Obj<'static>) -> Result<(), WidgetError> {
let label1 = Label::new(container)?;
label1.text("Background text line 1");
label1.align(Align::TopMid, 0, 30);
let label2 = Label::new(container)?;
label2.text("Background text line 2");
label2.align(Align::Center, 0, 0);
let label3 = Label::new(container)?;
label3.text("Background text line 3");
label3.align(Align::BottomMid, 0, -30);
let layer = Screen::layer_top();
layer.style_blur_radius(20, Selector::DEFAULT);
layer.style_blur_backdrop(true, Selector::DEFAULT);
core::mem::forget(layer);
let mbox = Msgbox::new(None::<&oxivgl::widgets::Obj<'_>>)?;
mbox.add_title("Notice");
mbox.add_text("This dialog has a blurred backdrop.\nClose to dismiss.");
mbox.add_close_button();
mbox.add_footer_button("OK");
core::mem::forget(mbox);
self._label1 = Some(label1);
self._label2 = Some(label2);
self._label3 = Some(label3);
Ok(())
}
fn update(&mut self) -> Result<NavAction, WidgetError> {
Ok(NavAction::None)
}
}
oxivgl_examples_common::example_main!(WidgetMsgbox3::default());