Struct 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§

Source§

impl FileSelectPanel

Source

pub fn new() -> Self

Creates and returns a FileSelectPanel, which holds pointers to the Objective C runtime for instrumenting the dialog.

Source

pub fn set_delegate(&mut self)

Source

pub fn set_can_choose_files(&mut self, can_choose: bool)

Sets whether files can be chosen by the user.

Source

pub fn set_message<S: AsRef<str>>(&mut self, message: S)

Set the message text displayed in the panel.

Source

pub fn set_can_choose_directories(&mut self, can_choose: bool)

Sets whether the user can choose directories.

Source

pub fn set_resolves_aliases(&mut self, resolves: bool)

Sets whether the panel resolves aliases.

Source

pub fn set_allows_multiple_selection(&mut self, allows: bool)

Sets whether the panel allows multiple selections.

Source

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.

Source

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.

Source

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 Windows 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§

Source§

impl Debug for FileSelectPanel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileSelectPanel

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.