Struct bevy_file_dialog::FileDialog
source · pub struct FileDialog<'w, 's, 'a> { /* private fields */ }Expand description
File dialog for saving/loading files. You can further customize what can be saved/loaded and the initial state of dialog with its functions.
Implementations§
source§impl<'w, 's, 'a> FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> FileDialog<'w, 's, 'a>
sourcepub fn pick_directory_path<T: PickDirectoryPath>(self)
pub fn pick_directory_path<T: PickDirectoryPath>(self)
Open pick directory dialog and send DialogDirectoryPicked<T>
event. You can read this event with Bevy’s
EventReader<DialogDirectoryPicked<T>>.
Does not exist in wasm32.
sourcepub fn pick_multiple_directory_paths<T: PickDirectoryPath>(self)
pub fn pick_multiple_directory_paths<T: PickDirectoryPath>(self)
Open pick multiple directories dialog and send
DialogDirectoryPicked<T> for each selected directory path. You
can get each path by reading every event received with with Bevy’s
EventReader<DialogDirectoryPicked<T>>.
Does not exist in wasm32.
sourcepub fn pick_file_path<T: PickFilePath>(self)
pub fn pick_file_path<T: PickFilePath>(self)
Open pick file dialog and send DialogFilePicked<T>
event. You can read this event with Bevy’s
EventReader<DialogFilePicked<T>>.
Does not exist in wasm32. If you want cross-platform solution, you
need to use FileDialog::load_file, which does picking and loading in
one step which is compatible with wasm.
sourcepub fn pick_multiple_file_paths<T: PickDirectoryPath>(self)
pub fn pick_multiple_file_paths<T: PickDirectoryPath>(self)
Open pick multiple files dialog and send
DialogFilePicked<T> for each selected file path. You
can get each path by reading every event received with with Bevy’s
EventReader<DialogFilePicked<T>>.
Does not exist in wasm32. If you want cross-platform solution, you
need to use FileDialog::load_multiple_files, which does picking and
loading in one step which is compatible with wasm.
source§impl<'w, 's, 'a> FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> FileDialog<'w, 's, 'a>
sourcepub fn add_filter(
self,
name: impl Into<String>,
extensions: &[impl ToString]
) -> Self
pub fn add_filter( self, name: impl Into<String>, extensions: &[impl ToString] ) -> Self
Add file extension filter.
Takes in the name of the filter, and list of extensions
The name of the filter will be displayed on supported platforms:
- Windows
- Linux
On platforms that don’t support filter names, all filters will be merged into one filter
sourcepub fn set_directory<P: AsRef<Path>>(self, path: P) -> Self
pub fn set_directory<P: AsRef<Path>>(self, path: P) -> Self
Set starting directory of the dialog. Supported platforms:
- Linux (GTK only)
- Windows
- Mac
sourcepub fn set_file_name(self, file_name: impl Into<String>) -> Self
pub fn set_file_name(self, file_name: impl Into<String>) -> Self
Set starting file name of the dialog. Supported platforms:
- Windows
- Linux
- Mac
sourcepub fn set_title(self, title: impl Into<String>) -> Self
pub fn set_title(self, title: impl Into<String>) -> Self
Set the title of the dialog. Supported platforms:
- Windows
- Linux
- Mac (Only below version 10.11)
- WASM32
sourcepub fn save_file<T: SaveContents>(self, contents: Vec<u8>)
pub fn save_file<T: SaveContents>(self, contents: Vec<u8>)
Open save file dialog and save the contents to that file. When file
gets saved, the DialogFileSaved<T> gets sent. You can get read this event
with Bevy’s EventReader<DialogFileSaved<T>> system param.
sourcepub fn load_file<T: LoadContents>(self)
pub fn load_file<T: LoadContents>(self)
Open pick file dialog and load its contents. When file contents get
loaded, the DialogFileLoaded<T> gets sent. You can read this event with
Bevy’s EventReader<DialogFileLoaded<T>>.
sourcepub fn load_multiple_files<T: LoadContents>(self)
pub fn load_multiple_files<T: LoadContents>(self)
Open pick file dialog for multiple files and load contents for all
selected files. When file contents get loaded, the
DialogFileLoaded<T> gets sent for each file. You can read each file
by reading every event received with with Bevy’s
EventReader<DialogFileLoaded<T>>.
Auto Trait Implementations§
impl<'w, 's, 'a> RefUnwindSafe for FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> Send for FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> Sync for FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> Unpin for FileDialog<'w, 's, 'a>
impl<'w, 's, 'a> !UnwindSafe for FileDialog<'w, 's, 'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.