use graphite_editor::messages::prelude::FrontendMessage; use std::path::PathBuf; pub(crate) use graphite_editor::messages::prelude::Message as EditorMessage; pub use graphite_editor::messages::frontend::utility_types::{DocumentInfo, PersistedState}; pub use graphite_editor::messages::input_mapper::utility_types::input_keyboard::{Key, ModifierKeys}; pub use graphite_editor::messages::input_mapper::utility_types::input_mouse::{EditorMouseState as MouseState, EditorPosition as Position, MouseKeys}; pub use graphite_editor::messages::prelude::DocumentId; pub use graphite_editor::messages::prelude::InputPreprocessorMessage as InputMessage; pub use graphite_editor::messages::prelude::PreferencesMessageHandler as Preferences; pub enum DesktopFrontendMessage { ToWeb(Vec), OpenLaunchDocuments, OpenFileDialog { title: String, filters: Vec, multiple: bool, context: OpenFileDialogContext, }, SaveFileDialog { title: String, default_filename: String, default_folder: Option, filters: Vec, context: SaveFileDialogContext, }, WriteFile { path: PathBuf, content: Vec, }, OpenUrl(String), UpdateViewportPhysicalBounds { x: f64, y: f64, width: f64, height: f64, }, UpdateUIScale { scale: f64, }, UpdateOverlays(vello::Scene), PersistenceWriteDocument { id: DocumentId, document_serialized_content: String, }, PersistenceDeleteDocument { id: DocumentId, }, PersistenceWritePreferences { preferences: Preferences, }, PersistenceLoadPreferences, PersistenceWriteState { state: PersistedState, }, PersistenceReadState, PersistenceReadDocument { id: DocumentId, }, UpdateMenu { entries: Vec, }, ClipboardRead, ClipboardWrite { content: String, }, PointerLock, WindowClose, WindowMinimize, WindowMaximize, WindowFullscreen, WindowDrag, WindowFocus, WindowHide, WindowHideOthers, WindowShowAll, Restart, LoadThirdPartyLicenses, } pub enum DesktopWrapperMessage { FromWeb(Box), Input(InputMessage), FileDialogResult { path: PathBuf, content: Vec, context: OpenFileDialogContext }, SaveFileDialogResult { path: PathBuf, context: SaveFileDialogContext }, OpenFile { path: PathBuf, content: Vec }, ImportFile { path: PathBuf, content: Vec }, PollNodeGraphEvaluation, UpdateMaximized { maximized: bool }, UpdateFullscreen { fullscreen: bool }, LoadDocumentContent { id: DocumentId, document: String }, LoadPersistedState { state: PersistedState }, LoadPreferences { preferences: Preferences }, MenuEvent { id: String }, ClipboardReadResult { content: Option }, PointerLockMove { x: f64, y: f64 }, LoadThirdPartyLicenses { text: String }, } pub struct FileFilter { pub name: String, pub extensions: Vec, } #[derive(Clone, Copy)] pub enum OpenFileDialogContext { Open, Import, } pub enum SaveFileDialogContext { Document { document_id: DocumentId, content: Vec }, File { content: Vec }, } pub enum MenuItem { Action { id: String, text: String, enabled: bool, shortcut: Option, }, Checkbox { id: String, text: String, enabled: bool, shortcut: Option, checked: bool, }, SubMenu { id: String, text: String, enabled: bool, items: Vec, }, Separator, } pub use keyboard_types::{Code as KeyCode, Modifiers}; pub struct Shortcut { pub key: KeyCode, pub modifiers: Modifiers, }