Struct egui_file::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 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 position.

source

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

Set the window 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 show_drives(self, drives: bool) -> Self

Show the mapped drives on Windows. Default is true.

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 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 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>,

§

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>,

§

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.