pub struct FileDialogConfig {
Show 36 fields pub labels: FileDialogLabels, pub initial_directory: PathBuf, pub default_file_name: String, pub directory_separator: String, pub canonicalize_paths: bool, pub err_icon: String, pub default_file_icon: String, pub default_folder_icon: String, pub device_icon: String, pub removable_device_icon: String, pub file_icon_filters: Vec<IconFilter>, pub quick_accesses: Vec<QuickAccess>, pub title: Option<String>, pub id: Option<Id>, pub default_pos: Option<Pos2>, pub fixed_pos: Option<Pos2>, pub default_size: Vec2, pub max_size: Option<Vec2>, pub min_size: Vec2, pub anchor: Option<(Align2, Vec2)>, pub resizable: bool, pub movable: bool, pub title_bar: bool, pub show_top_panel: bool, pub show_parent_button: bool, pub show_back_button: bool, pub show_forward_button: bool, pub show_new_folder_button: bool, pub show_current_path: bool, pub show_path_edit_button: bool, pub show_reload_button: bool, pub show_search: bool, pub show_left_panel: bool, pub show_places: bool, pub show_devices: bool, pub show_removable_devices: bool,
}
Expand description

Contains configuration values of a file dialog.

The configuration of a file dialog can be set using FileDialog::with_config or FileDialog::overwrite_config.

If you only need to configure a single file dialog, you don’t need to manually use a FileDialogConfig object. FileDialog provides setter methods for each of these configuration options, for example: FileDialog::initial_directory or FileDialog::default_size.

FileDialogConfig is useful when you need to configure multiple FileDialog objects with the same or almost the same options.

§Example

use egui_file_dialog::{FileDialog, FileDialogConfig};

let config = FileDialogConfig {
    initial_directory: std::path::PathBuf::from("/app/config"),
    fixed_pos: Some(egui::Pos2::new(40.0, 40.0)),
    show_left_panel: false,
    ..Default::default()
};

let file_dialog_a = FileDialog::with_config(config.clone())
    .id("file-dialog-a");

let file_dialog_b = FileDialog::with_config(config.clone());

Fields§

§labels: FileDialogLabels

The labels that the dialog uses.

§initial_directory: PathBuf

The first directory that will be opened when the dialog opens.

§default_file_name: String

The default filename when opening the dialog in DialogMode::SaveFile mode.

§directory_separator: String

Sets the separator of the directories when displaying a path. Currently only used when the current path is displayed in the top panel.

§canonicalize_paths: bool

If the paths in the file dialog should be canonicalized before use.

§err_icon: String

The icon that is used to display error messages.

§default_file_icon: String

The default icon used to display files.

§default_folder_icon: String

The default icon used to display folders.

§device_icon: String

The icon used to display devices in the left panel.

§removable_device_icon: String

The icon used to display removable devices in the left panel.

§file_icon_filters: Vec<IconFilter>

Sets custom icons for different files or folders. Use FileDialogConfig::set_file_icon to add a new icon to this list.

§quick_accesses: Vec<QuickAccess>

Custom sections added to the left sidebar for quick access. Use FileDialogConfig::add_quick_access to add a new section to this list.

§title: Option<String>

If set, the window title will be overwritten and set to the fixed value instead of being set dynamically.

§id: Option<Id>

The ID of the window.

§default_pos: Option<Pos2>

The default position of the window.

§fixed_pos: Option<Pos2>

Sets the window position and prevents it from being dragged around.

§default_size: Vec2

The default size of the window.

§max_size: Option<Vec2>

The maximum size of the window.

§min_size: Vec2

The minimum size of the window.

§anchor: Option<(Align2, Vec2)>

The anchor of the window.

§resizable: bool

If the window is resizable.

§movable: bool

If the window is movable.

§title_bar: bool

If the title bar of the window is shown.

§show_top_panel: bool

If the top panel with the navigation buttons, current path display and search input should be visible.

§show_parent_button: bool

Whether the parent folder button should be visible at the top.

§show_back_button: bool

Whether the back button should be visible at the top.

§show_forward_button: bool

Whether the forward button should be visible at the top.

§show_new_folder_button: bool

If the button to create a new folder should be visible at the top.

§show_current_path: bool

If the current path display in the top panel should be visible.

§show_path_edit_button: bool

If the button to text edit the current path should be visible.

§show_reload_button: bool

If the reload button in the top panel should be visible.

§show_search: bool

If the search input in the top panel should be visible.

§show_left_panel: bool

If the sidebar with the shortcut directories such as “Home”, “Documents” etc. should be visible.

§show_places: bool

If the Places section in the left sidebar should be visible.

§show_devices: bool

If the Devices section in the left sidebar should be visible.

§show_removable_devices: bool

If the Removable Devices section in the left sidebar should be visible.

Implementations§

source§

impl FileDialogConfig

source

pub fn set_file_icon( self, icon: &str, filter: Arc<dyn Fn(&Path) -> bool> ) -> Self

Sets a new icon for specific files or folders.

§Arguments
  • icon - The icon that should be used.
  • filter - Sets a filter function that checks whether a given Path matches the criteria for this icon.
§Examples
use std::sync::Arc;
use egui_file_dialog::FileDialogConfig;

let config = FileDialogConfig::default()
    // .png files should use the "document with picture (U+1F5BB)" icon.
    .set_file_icon("🖻", Arc::new(|path| path.extension().unwrap_or_default() == "png"))
    // .git directories should use the "web-github (U+E624)" icon.
    .set_file_icon("", Arc::new(|path| path.file_name().unwrap_or_default() == ".git"));
source

pub fn add_quick_access( self, heading: &str, builder: impl FnOnce(&mut QuickAccess) ) -> Self

Adds a new custom quick access section to the left panel of the file dialog.

§Examples
use egui_file_dialog::FileDialogConfig;

FileDialogConfig::default()
    .add_quick_access("My App", |s| {
        s.add_path("Config", "/app/config");
        s.add_path("Themes", "/app/themes");
        s.add_path("Languages", "/app/languages");
    });

Trait Implementations§

source§

impl Clone for FileDialogConfig

source§

fn clone(&self) -> FileDialogConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FileDialogConfig

source§

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

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

impl Default for FileDialogConfig

source§

fn default() -> Self

Creates a new configuration with default values

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.