Struct FileDialog

Source
pub struct FileDialog { /* private fields */ }
Expand description

egui component that represents OpenFileDialog or SaveFileDialog.

Implementations§

Source§

impl FileDialog

Source

pub fn select_folder(initial_path: Option<PathBuf>) -> Self

Create dialog that prompts the user to select a folder.

Source

pub fn open_file(initial_path: Option<PathBuf>) -> Self

Create dialog that prompts the user to open a file.

Source

pub fn save_file(initial_path: Option<PathBuf>) -> Self

Create dialog that prompts the user to save a file.

Source

pub fn default_filename(self, filename: impl Into<String>) -> Self

Set the default file name.

Source

pub fn title(self, title: &str) -> Self

Set the window title text.

Source

pub fn open_button_text(self, text: Cow<'static, str>) -> Self

Set the open button text.

Source

pub fn save_button_text(self, text: Cow<'static, str>) -> Self

Set the save button text.

Source

pub fn cancel_button_text(self, text: Cow<'static, str>) -> Self

Set the cancel button text.

Source

pub fn new_folder_button_text(self, text: Cow<'static, str>) -> Self

Set the new folder button text.

Source

pub fn new_folder_name_text(self, text: Cow<'static, str>) -> Self

Set the new folder name text.

Source

pub fn refresh_button_hover_text(self, text: Cow<'static, str>) -> Self

Set the refresh button hover text.

Source

pub fn parent_folder_button_hover_text(self, text: Cow<'static, str>) -> Self

Set the parent folder button hover text.

Source

pub fn rename_button_text(self, text: Cow<'static, str>) -> Self

Set the rename button text.

Source

pub fn file_label_text(self, text: Cow<'static, str>) -> Self

Set the file label text.

Source

pub fn show_hidden_checkbox_text(self, text: Cow<'static, str>) -> Self

Set the show hidden checkbox text.

Source

pub fn id(self, id: impl Into<Id>) -> Self

Set the window ID.

Source

pub fn anchor(self, align: Align2, offset: impl Into<Vec2>) -> Self

Set the window anchor.

Source

pub fn current_pos(self, current_pos: impl Into<Pos2>) -> Self

Set the window’s current position.

Source

pub fn default_pos(self, default_pos: impl Into<Pos2>) -> Self

Set the window’s default position.

Source

pub fn default_size(self, default_size: impl Into<Vec2>) -> Self

Set the window’s default size.

Source

pub fn resizable(self, resizable: bool) -> Self

Enable/disable resizing the window. Default is true.

Source

pub fn show_rename(self, rename: bool) -> Self

Show the Rename button. Default is true.

Source

pub fn show_new_folder(self, new_folder: bool) -> Self

Show the New Folder button. Default is true.

Source

pub fn multi_select(self, multi_select: bool) -> Self

Source

pub fn has_multi_select(&self) -> bool

Source

pub fn show_files_filter(self, filter: Filter<PathBuf>) -> Self

Set a function to filter listed files.

Source

pub fn filename_filter(self, filter: Filter<String>) -> Self

Set a function to filter the selected filename.

Source

pub fn keep_on_top(self, keep_on_top: bool) -> Self

Set to true in order to keep this window on top of other windows. Default is false.

Source

pub fn with_fs(self, fs: Box<dyn Vfs>) -> Self

Source

pub fn show_system_files(self, show_system_files: bool) -> Self

Set to true in order to show system files. Default is false.

Source

pub fn dialog_type(&self) -> DialogType

Get the dialog type.

Source

pub fn visible(&self) -> bool

Get the window’s visibility.

Source

pub fn open(&mut self)

Opens the dialog.

Source

pub fn path(&self) -> Option<&Path>

Resulting file path.

Source

pub fn selection(&self) -> Vec<&Path>

Retrieves multi selection as a vector.

Source

pub fn directory(&self) -> &Path

Currently mounted directory that is being shown in the dialog box

Source

pub fn set_path(&mut self, path: impl Into<PathBuf>)

Set the dialog’s current opened path

Source

pub fn state(&self) -> State

Dialog state.

Source

pub fn selected(&self) -> bool

Returns true, if the file selection was confirmed.

Source

pub fn show(&mut self, ctx: &Context) -> &Self

Shows the dialog if it is open. It is also responsible for state management. Should be called every ui update.

Trait Implementations§

Source§

impl Debug for FileDialog

Source§

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

Formats the value using the given formatter. 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.