Struct cacao::filesystem::select::FileSelectPanel
source · [−]pub struct FileSelectPanel {
pub panel: ShareId<Object>,
pub delegate: ShareId<Object>,
pub can_choose_files: bool,
pub can_choose_directories: bool,
pub resolves_aliases: bool,
pub allows_multiple_selection: bool,
}
Fields
panel: ShareId<Object>
The internal Objective C NSOpenPanel
instance.
delegate: ShareId<Object>
The internal NSObject
that routes delegate callbacks around.
can_choose_files: bool
Whether the user can choose files. Defaults to true
.
can_choose_directories: bool
Whether the user can choose directories. Defaults to false
.
resolves_aliases: bool
When the value of this property is true, dropping an alias on the panel or asking for filenames or URLs returns the resolved aliases. The default value of this property is true. When this value is false, selecting an alias returns the alias instead of the file or directory it represents.
allows_multiple_selection: bool
When the value of this property is true, the user may select multiple items from the
browser. Defaults to false
.
Implementations
sourceimpl FileSelectPanel
impl FileSelectPanel
sourcepub fn new() -> Self
pub fn new() -> Self
Creates and returns a FileSelectPanel
, which holds pointers to the Objective C runtime for
instrumenting the dialog.
pub fn set_delegate(&mut self)
sourcepub fn set_can_choose_files(&mut self, can_choose: bool)
pub fn set_can_choose_files(&mut self, can_choose: bool)
Sets whether files can be chosen by the user.
sourcepub fn set_message<S: AsRef<str>>(&mut self, message: S)
pub fn set_message<S: AsRef<str>>(&mut self, message: S)
Set the message text displayed in the panel.
sourcepub fn set_can_choose_directories(&mut self, can_choose: bool)
pub fn set_can_choose_directories(&mut self, can_choose: bool)
Sets whether the user can choose directories.
sourcepub fn set_resolves_aliases(&mut self, resolves: bool)
pub fn set_resolves_aliases(&mut self, resolves: bool)
Sets whether the panel resolves aliases.
sourcepub fn set_allows_multiple_selection(&mut self, allows: bool)
pub fn set_allows_multiple_selection(&mut self, allows: bool)
Sets whether the panel allows multiple selections.
sourcepub fn show<F>(&self, handler: F) where
F: Fn(Vec<NSURL<'_>>) + 'static,
pub fn show<F>(&self, handler: F) where
F: Fn(Vec<NSURL<'_>>) + 'static,
Shows the panel as a modal.
Note that this clones the underlying NSOpenPanel
pointer. This is theoretically safe as
the system runs and manages that in another process, and we’re still abiding by the general
retain/ownership rules here.
This is offered for scenarios where you don’t necessarily have a Window (e.g, a shell script) or can’t easily pass one to use as a sheet.
sourcepub fn close(&self)
pub fn close(&self)
As panels descend behind the scenes from NSWindow
, we can call through to close it.
You should really prefer to utilize sheets to display panels; this is offered as a convenience for rare cases where you might need to retain a panel and close it later on.
sourcepub fn begin_sheet<T, F>(&self, window: &Window<T>, handler: F) where
F: Fn(Vec<NSURL<'_>>) + 'static,
pub fn begin_sheet<T, F>(&self, window: &Window<T>, handler: F) where
F: Fn(Vec<NSURL<'_>>) + 'static,
Shows the panel as a modal. Currently, this method accepts Window
s which use a delegate.
If you’re using a Window
without a delegate, you may need to opt to use the show()
method.
Note that this clones the underlying NSOpenPanel
pointer. This is theoretically safe as
the system runs and manages that in another process, and we’re still abiding by the general
retain/ownership rules here.
Trait Implementations
sourceimpl Debug for FileSelectPanel
impl Debug for FileSelectPanel
Auto Trait Implementations
impl RefUnwindSafe for FileSelectPanel
impl Send for FileSelectPanel
impl Sync for FileSelectPanel
impl Unpin for FileSelectPanel
impl UnwindSafe for FileSelectPanel
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more