Files
barbar/crates/common/src/effect.rs
T

28 lines
922 B
Rust

use iced::{window, Rectangle};
use crate::Wire;
#[derive(Clone, Debug)]
pub struct PopupSettings {
// pub name: String,
pub module_id: String,
pub element_id: String,
pub gap: i32,
}
/// What a module asks the app to do — the single effect vocabulary shared by
/// modules and app, so mapping module output into a `Message` is a plain
/// `.map(Message::Effect)` with no mirror enum.
#[derive(Debug, Clone)]
pub enum ModuleEffect {
/// Toggle a popup for the given module id (element id anchors it).
RequestPopup(PopupSettings),
/// A widget-tree pass reported a module's laid-out bounds; anchor the
/// popup there. App-internal, but one effect type keeps routing trivial.
BoundsFound(Rectangle, PopupSettings),
/// Request removal of the popup surface.
ClosePopup(window::Id),
/// Route a wire to its target (a module, a service inbox, or a topic).
Send(Wire),
}