layer_shika_domain/value_objects/
popup_config.rs

1use crate::value_objects::handle::PopupHandle;
2use crate::value_objects::output_target::OutputTarget;
3use crate::value_objects::popup_behavior::PopupBehavior;
4use crate::value_objects::popup_position::{Offset, PopupPosition};
5use crate::value_objects::popup_size::PopupSize;
6
7/// Declarative popup configuration (runtime modifiable)
8#[derive(Debug, Clone)]
9pub struct PopupConfig {
10    /// Component name from compiled Slint file
11    pub component: String,
12
13    /// Positioning configuration
14    pub position: PopupPosition,
15
16    /// Size configuration
17    pub size: PopupSize,
18
19    /// Popup behavior flags
20    pub behavior: PopupBehavior,
21
22    /// Output targeting
23    pub output: OutputTarget,
24
25    /// Parent popup (for hierarchical popups)
26    pub parent: Option<PopupHandle>,
27
28    /// Z-order relative to siblings
29    pub z_index: i32,
30
31    /// Callback invoked by the component to request close
32    pub close_callback: Option<String>,
33
34    /// Callback invoked by the component to request resize (content-sizing)
35    pub resize_callback: Option<String>,
36}
37
38impl PopupConfig {
39    #[must_use]
40    pub fn new(component: impl Into<String>) -> Self {
41        Self {
42            component: component.into(),
43            position: PopupPosition::Cursor {
44                offset: Offset::default(),
45            },
46            size: PopupSize::default(),
47            behavior: PopupBehavior::default(),
48            output: OutputTarget::Active,
49            parent: None,
50            z_index: 0,
51            close_callback: None,
52            resize_callback: None,
53        }
54    }
55}