pub struct FileDialogBuilder {
pub filename: Option<String>,
pub location: Option<PathBuf>,
pub filters: FileFiltersBag,
pub owner: UnsafeWindowHandle,
pub title: Option<String>,
}
Expand description
Builder for file dialogs.
Fields§
§filename: Option<String>
§location: Option<PathBuf>
§filters: FileFiltersBag
§owner: UnsafeWindowHandle
§title: Option<String>
Implementations§
Source§impl FileDialogBuilder
impl FileDialogBuilder
Sourcepub fn set_filename(self, filename: impl ToString) -> Self
pub fn set_filename(self, filename: impl ToString) -> Self
Sets the default value of the filename text field in the dialog. For open dialogs of macOS and zenity, this is a no-op because there’s no such text field on the dialog.
Sourcepub fn reset_filename(self) -> Self
pub fn reset_filename(self) -> Self
Resets the default value of the filename field in the dialog.
Sourcepub fn set_location<P: AsRef<Path> + ?Sized>(self, path: &P) -> Self
pub fn set_location<P: AsRef<Path> + ?Sized>(self, path: &P) -> Self
Sets the default directory that the dialog shows at open.
Sourcepub fn reset_location(self) -> Self
pub fn reset_location(self) -> Self
Resets the default directory that the dialog shows at open. If a location is not set, the dialog will probably go to the current working directory.
Sourcepub fn add_filter<T, U, V>(self, name: T, extensions: V) -> Self
pub fn add_filter<T, U, V>(self, name: T, extensions: V) -> Self
Adds a file type filter. The filter must contains at least one extension, otherwise this method will be a no-op. For dialogs that open directories, this is also a no-op.
Sourcepub fn add_filters<I>(self, filters: I) -> Self
pub fn add_filters<I>(self, filters: I) -> Self
Adds a bunch of file type filters.
Sourcepub fn reset_filters(self) -> Self
pub fn reset_filters(self) -> Self
Removes all file type filters.
Sourcepub fn set_owner<W: HasWindowHandle>(self, window: &W) -> Self
pub fn set_owner<W: HasWindowHandle>(self, window: &W) -> Self
Sets the owner of the dialog.
Sourcepub fn reset_owner(self) -> Self
pub fn reset_owner(self) -> Self
Resets the owner of the dialog to nothing.
Sourcepub fn open_single_file(self) -> OpenSingleFile
pub fn open_single_file(self) -> OpenSingleFile
Builds a dialog that let users to open one file.
Sourcepub fn open_multiple_file(self) -> OpenMultipleFile
pub fn open_multiple_file(self) -> OpenMultipleFile
Builds a dialog that let users to open multiple files.
Sourcepub fn open_single_dir(self) -> OpenSingleDir
pub fn open_single_dir(self) -> OpenSingleDir
Builds a dialog that let users to open one directory.
Sourcepub fn save_single_file(self) -> SaveSingleFile
pub fn save_single_file(self) -> SaveSingleFile
Builds a dialog that let users to save one file.
Trait Implementations§
Source§impl Clone for FileDialogBuilder
impl Clone for FileDialogBuilder
Source§fn clone(&self) -> FileDialogBuilder
fn clone(&self) -> FileDialogBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for FileDialogBuilder
impl Debug for FileDialogBuilder
Source§impl Default for FileDialogBuilder
impl Default for FileDialogBuilder
Source§fn default() -> FileDialogBuilder
fn default() -> FileDialogBuilder
Auto Trait Implementations§
impl Freeze for FileDialogBuilder
impl RefUnwindSafe for FileDialogBuilder
impl Send for FileDialogBuilder
impl Sync for FileDialogBuilder
impl Unpin for FileDialogBuilder
impl UnwindSafe for FileDialogBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more