cacao/appkit/src/file_panel/traits.rs

22 lines
976 B
Rust
Raw Normal View History

2020-02-28 13:34:34 +11:00
//! A trait that you can implement to handle open and save file dialogs. This more or less maps
//! over to `NSOpenPanel` and `NSSavePanel` handling.
pub trait OpenSaveController {
/// Called when the user has entered a filename (typically, during saving). `confirmed`
/// indicates whether or not they hit the save button.
fn user_entered_filename(&self, filename: &str, confirmed: bool) {}
/// Notifies you that the panel selection changed.
fn panel_selection_did_change(&self) {}
/// Notifies you that the user changed directories.
fn did_change_to_directory(&self, url: &str) {}
/// Notifies you that the Save panel is about to expand or collapse because the user
/// clicked the disclosure triangle that displays or hides the file browser.
fn will_expand(&self, expanding: bool) {}
/// Determine whether the specified URL should be enabled in the Open panel.
fn should_enable_url(&self, url: &str) -> bool { true }
}