diff options
| author | pml68 <contact@pml68.dev> | 2025-06-08 02:04:09 +0200 |
|---|---|---|
| committer | pml68 <contact@pml68.dev> | 2025-06-08 02:04:09 +0200 |
| commit | c1f50e1efa78ef7f35ed6f44828976fb7328d85b (patch) | |
| tree | a33930e87597b02aafa22e8f209e114eaef79912 /src/types.rs | |
| parent | fix: animated theme change on startup when config theme != "Dark" (diff) | |
| download | iced-builder-c1f50e1efa78ef7f35ed6f44828976fb7328d85b.tar.gz | |
feat: dialog improvements
- "Unsaved changes" dialogs ask about saving the project
- Trying to close the window also triggers an "unsaved changes" dialog
when the editor is dirty.
- Nicer API for dialogs (similar to what I do in `foghorn-rs/foghorn`)
Diffstat (limited to 'src/types.rs')
| -rw-r--r-- | src/types.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/types.rs b/src/types.rs index 608f285..ef6d5c3 100644 --- a/src/types.rs +++ b/src/types.rs @@ -7,6 +7,7 @@ use std::path::PathBuf; pub use element_name::ElementName; use iced::advanced::widget::Id; use iced::widget::{pane_grid, text_editor}; +use iced::window; use iced_anim::Event; use material_theme::Theme; pub use project::Project; @@ -33,9 +34,9 @@ pub enum Message { PaneResized(pane_grid::ResizeEvent), PaneClicked(pane_grid::Pane), PaneDragged(pane_grid::DragEvent), - OpenDialog(&'static str, String, DialogButtons, DialogAction), CloseDialog, - DialogOk, + DialogYes, + DialogNo, DialogCancel, NewFile, OpenFile, @@ -43,22 +44,8 @@ pub enum Message { SaveFile, SaveFileAs, FileSaved(Result<PathBuf, Error>), -} - -#[derive(Debug, Clone, Copy, Default)] -pub enum DialogButtons { - #[default] - None, - Ok, - OkCancel, -} - -#[derive(Debug, Clone, Copy, Default)] -pub enum DialogAction { - #[default] - None, - NewFile, - OpenFile, + CloseApp, + WindowEvent(window::Event), } #[derive(Debug, Clone, Copy)] |
