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§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more