fluxxcode / egui-file-dialog

Full featured and customizable file dialog for egui
MIT License
78 stars 10 forks source link

Implement file filters #124

Closed fluxxcode closed 3 months ago

fluxxcode commented 3 months ago

This PR implements FileDialog::add_file_filter which allows adding file filters from the backend, selectable by the user from a dropdown in the bottom right.

Additionally, FileDialog::default_file_filter has been implemented to set a file filter that is selected by default.

Example:

        let file_dialog = FileDialog::default()
            .add_file_filter("PNG files", Arc::new(|p| p.extension().unwrap_or_default() == "png"))
            .add_file_filter("TOML files", Arc::new(|p| p.extension().unwrap_or_default() == "toml"))
            .add_file_filter("Rust source files", Arc::new(|p| p.extension().unwrap_or_default() == "rs"))
            .default_file_filter("TOML files");

Screenshot_20240601_222528

Ref: #122