/* * OrbTK - The Orbital Widget Toolkit * * Copyright 2021 Ralf Zerres * SPDX-License-Identifier: (0BSD or MIT) */ use orbtk::prelude::*; use crate::sender::sender_state::{SenderAction, SenderState}; widget!(SenderView { // the Entity of the widget that will receive the messages target: u32 }); impl Template for SenderView { fn template(self, id: Entity, bc: &mut BuildContext) -> Self { self.name("SenderView") .child( Button::new() .text("Click me to send a message!") .v_align("center") .h_align("center") .on_click(move |states, _entity| { states.get_mut::(id).send_message(); //states.send_message(SenderAction::UpdateProgress, id); //ctx.send_message(TestMessageAction::ToggleMessageBox, id); false }) .build(bc) ) } }