Struct fltk::dialog::FileChooser [−][src]
FLTK’s own FileChooser. Which differs for the Native FileDialog Example:
use fltk::*; let mut chooser = dialog::FileChooser::new( ".", // directory "*", // filter or pattern dialog::FileChooserType::Multi, // chooser type "Title Of Chooser", // title ); chooser.show(); chooser.window().set_pos(300, 300); // Block until user picks something. // (The other way to do this is to use a callback()) // while chooser.shown() { app::wait(); } // User hit cancel? if chooser.value(1).is_none() { println!("(User hit 'Cancel')"); return; } // Print what the user picked println!("--------------------"); println!("DIRECTORY: '{}'", chooser.directory().unwrap()); println!(" VALUE: '{}'", chooser.value(1).unwrap()); // value starts at 1! println!(" COUNT: {} files selected", chooser.count()); // Multiple files? Show all of them if chooser.count() > 1 { for t in 1..=chooser.count() { println!(" VALUE[{}]: '{}'", t, chooser.value(t).unwrap()); } }
Implementations
impl FileChooser
[src]
pub fn new(
dir: &str,
pattern: &str,
typ: FileChooserType,
title: &str
) -> FileChooser
[src]
dir: &str,
pattern: &str,
typ: FileChooserType,
title: &str
) -> FileChooser
Instantiates a new FileChooser
pub unsafe fn delete(dlg: Self)
[src]
pub fn new_button(&mut self) -> Option<impl ButtonExt>
[src]
Gets the new button of the FileChooser
pub fn preview_button(&mut self) -> Option<impl ButtonExt>
[src]
Gets the preview button of the FileChooser
pub fn show_hidden_button(&mut self) -> Option<impl ButtonExt>
[src]
Gets the show hidden button of the FileChooser
pub fn set_callback<F: FnMut() + 'static>(&mut self, cb: F)
[src]
Sets the callback of the FileChooser
pub fn set_callback2<F: FnMut(&mut Self) + 'static>(&mut self, cb: F)
[src]
Sets the callback of the FileChooser
pub fn set_color(&mut self, c: Color)
[src]
Sets the color of the FileChooser
pub fn color(&mut self) -> Color
[src]
Gets the color of the FileChooser
pub fn count(&mut self) -> u32
[src]
Gets the count of chosen items
pub fn set_directory(&mut self, dir: &str)
[src]
Sets the directory of the FileChooser
pub fn directory(&mut self) -> Option<String>
[src]
Gets the directory of the FileChooser
pub fn set_filter(&mut self, pattern: &str)
[src]
Sets the filter for the dialog, can be:
A single wildcard (eg. "*.txt"
)
Multiple wildcards (eg. "*.{cxx,h,H}"
)
A descriptive name followed by a \t
and a wildcard (eg. "Text Files\t*.txt"
)
A list of separate wildcards with a \n
between each (eg. "*.{cxx,H}\n*.txt"
)
A list of descriptive names and wildcards (eg. "C++ Files\t*.{cxx,H}\nTxt Files\t*.txt"
)
pub fn filter(&mut self) -> Option<String>
[src]
Gets the filter of the FileChooser
pub fn filter_value(&mut self) -> u32
[src]
Gets the current filename filter selection
pub fn set_filter_value(&mut self, f: u32)
[src]
Sets the filter for the dialog, can be:
A single wildcard (eg. "*.txt"
)
Multiple wildcards (eg. "*.{cxx,h,H}"
)
A descriptive name followed by a \t
and a wildcard (eg. "Text Files\t*.txt"
)
A list of separate wildcards with a \n
between each (eg. "*.{cxx,H}\n*.txt"
)
A list of descriptive names and wildcards (eg. "C++ Files\t*.{cxx,H}\nTxt Files\t*.txt"
)
pub fn hide(&mut self)
[src]
Hides the File chooser
pub fn set_icon_size(&mut self, s: u8)
[src]
Sets the icon size of the FileChooser
pub fn icon_size(&mut self) -> u8
[src]
Gets the icon size of the FileChooser
pub fn set_label(&mut self, l: &str)
[src]
Sets the label of the FileChooser
pub fn label(&mut self) -> String
[src]
Gets the label of the FileChooser
pub fn set_ok_label(&mut self, l: &str)
[src]
Sets the label of the Ok button
pub fn ok_label(&mut self) -> String
[src]
Gets the label of the Ok button
pub fn set_preview(&mut self, e: bool)
[src]
Add preview to the FileChooser
pub fn preview(&self) -> bool
[src]
Returns whether preview is enabled for the FileChooser
pub fn rescan(&mut self)
[src]
Rescan the directory
pub fn rescan_keep_filename(&mut self)
[src]
Rescan the directory while keeping the file name
pub fn show(&mut self)
[src]
Shows the File Chooser
pub fn shown(&mut self) -> bool
[src]
Returns whether the file chooser is shown
pub fn set_text_color(&mut self, c: Color)
[src]
Sets the text color of the file chooser
pub fn text_color(&mut self) -> Color
[src]
Gets the text color of the file chooser
pub fn set_text_font(&mut self, f: Font)
[src]
Sets the text font of the file chooser
pub fn text_font(&mut self) -> Font
[src]
Gets the text font of the file chooser
pub fn set_text_size(&mut self, s: u32)
[src]
Sets the text size of the file chooser
pub fn text_size(&mut self) -> u32
[src]
Gets the text size of the file chooser
pub fn set_type(&mut self, t: FileChooserType)
[src]
Sets the type of the FileChooser
pub fn get_type(&mut self) -> FileChooserType
[src]
Gets the type of the FileChooser
pub unsafe fn user_data(&self) -> Option<Box<dyn FnMut()>>
[src]
Gets the user data of the FileChooser
Safety
Can invalidate the user data while the FileChooser is in use
pub fn value(&mut self, f: u32) -> Option<String>
[src]
Gets the file or dir name chosen by the FileChooser
pub fn set_value(&mut self, filename: &str)
[src]
Sets the file or dir name chosen by the FileChooser
pub fn visible(&mut self) -> bool
[src]
Returns whether the FileChooser is visible or not
pub fn window(&mut self) -> impl WindowExt
[src]
Return dialog window
pub fn set_add_favorites_label(msg: &str)
[src]
Set “Add favorites” label
pub fn set_all_files_label(msg: &str)
[src]
Set “All Files” label
pub fn set_custom_filter_label(msg: &str)
[src]
Set “Custom Filter” label
pub fn set_existing_file_label(msg: &str)
[src]
Set “Existing file” label
pub fn set_favorites_label(msg: &str)
[src]
Set “Favorites” label
pub fn set_filename_label(msg: &str)
[src]
Set “Filename” label
pub fn set_filesystems_label(msg: &str)
[src]
Set “Filesystems” label
pub fn set_manage_favorites_label(msg: &str)
[src]
Set “Manage favorites” label
pub fn set_new_directory_label(msg: &str)
[src]
Set “New directory” label
pub fn set_new_directory_tooltip(msg: &str)
[src]
Set “New directory” tooltip
pub fn set_preview_label(msg: &str)
[src]
Set “Preview” label
pub fn set_save_label(msg: &str)
[src]
Set “Save” label
pub fn set_show_label(msg: &str)
[src]
Set “Show” label
pub fn set_hidden_label(msg: &str)
[src]
Set “Hidden” label
Trait Implementations
impl Drop for FileChooser
[src]
Auto Trait Implementations
impl RefUnwindSafe for FileChooser
impl !Send for FileChooser
impl !Sync for FileChooser
impl Unpin for FileChooser
impl UnwindSafe for FileChooser
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,