cacao/appkit/filesystem/traits.rs

28 lines
1.2 KiB
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) {}
2020-02-28 13:34:34 +11:00
/// 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) {}
2020-02-28 13:34:34 +11:00
/// 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) {}
2020-02-28 13:34:34 +11:00
/// Determine whether the specified URL should be enabled in the Open panel.
fn should_enable_url(&self, _url: &str) -> bool { true }
2020-02-28 13:34:34 +11:00
}
/// A trait you can implement for working with the underlying filesystem. This is important,
/// notably, because sandboxed applications have different working restrictions surrounding what
/// they can access.
pub trait FileManagerController {
}