bevy_ui_builders/dialog/
types.rs

1//! Dialog component types and markers
2
3use bevy::prelude::*;
4
5/// Component for dialog overlays
6#[derive(Component, Debug, Clone)]
7pub struct DialogOverlay {
8    pub dialog_type: DialogType,
9    pub dismissible: bool,
10}
11
12/// Types of dialogs
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub enum DialogType {
15    /// Exit confirmation dialog
16    ExitConfirmation,
17    /// Unsaved changes warning
18    UnsavedChanges,
19    /// Resolution change confirmation
20    Resolution,
21    /// Error message
22    Error,
23    /// Information message
24    Info,
25    /// Warning message
26    Warning,
27    /// Success message
28    Success,
29    /// Custom dialog
30    Custom,
31}
32
33/// Component for dialog containers
34#[derive(Component, Debug)]
35pub struct DialogContainer {
36    pub dialog_type: DialogType,
37}
38
39/// Component for dialog title text
40#[derive(Component)]
41pub struct DialogTitle;
42
43/// Component for dialog body text
44#[derive(Component)]
45pub struct DialogBody;
46
47/// Component for dialog button row
48#[derive(Component)]
49pub struct DialogButtonRow;
50
51/// Marker for exit confirmation dialog
52#[derive(Component)]
53pub struct ExitConfirmationDialog;
54
55/// Marker for unsaved changes dialog
56#[derive(Component)]
57pub struct UnsavedChangesDialog;
58
59/// Marker for resolution dialog
60#[derive(Component)]
61pub struct ResolutionDialog;
62
63/// Marker for error dialog
64#[derive(Component)]
65pub struct ErrorDialog;
66
67/// Marker for info dialog
68#[derive(Component)]
69pub struct InfoDialog;
70
71/// Marker for warning dialog
72#[derive(Component)]
73pub struct WarningDialog;
74
75/// Marker for success dialog
76#[derive(Component)]
77pub struct SuccessDialog;
78
79/// Button markers for dialog actions
80#[derive(Component)]
81pub struct ConfirmButton;
82
83#[derive(Component)]
84pub struct CancelButton;
85
86#[derive(Component)]
87pub struct SaveButton;
88
89#[derive(Component)]
90pub struct DiscardButton;
91
92#[derive(Component)]
93pub struct OkButton;
94
95#[derive(Component)]
96pub struct YesButton;
97
98#[derive(Component)]
99pub struct NoButton;
100
101/// Button configuration for dialogs
102pub struct DialogButton {
103    pub text: String,
104    pub style: crate::ButtonStyle,
105    pub marker: DialogButtonMarker,
106}
107
108/// Marker types for dialog buttons
109#[derive(Debug, Clone, Hash, PartialEq, Eq)]
110pub enum DialogButtonMarker {
111    Confirm,
112    Cancel,
113    Save,
114    Discard,
115    Ok,
116    Yes,
117    No,
118    Custom(String),
119}