pub struct FileChooser {Show 13 fields
id: Id,
rect: Rectangle,
children: Vec<Box<dyn View>>,
current_path: PathBuf,
entries: Vec<FileEntryData>,
current_page: usize,
pages_count: usize,
mode: SelectionMode,
breadcrumb_index: usize,
entries_start_index: usize,
error_message: Option<String>,
selected_path: Option<PathBuf>,
bottom_bar_rect: Rectangle,
}Fields§
§id: Id§rect: Rectangle§children: Vec<Box<dyn View>>§current_path: PathBuf§entries: Vec<FileEntryData>§current_page: usize§pages_count: usize§mode: SelectionMode§entries_start_index: usize§error_message: Option<String>§selected_path: Option<PathBuf>The path that was selected by the user. This is used to determine how the file chooser should be closed.
bottom_bar_rect: RectangleImplementations§
Source§impl FileChooser
impl FileChooser
fn create_separator(rect: Rectangle) -> Box<dyn View>
fn get_title_for_mode(mode: SelectionMode) -> &'static str
fn build_children( rect: Rectangle, initial_path: &Path, mode: SelectionMode, layout: &FileChooserLayout, context: &mut Context, ) -> (Vec<Box<dyn View>>, usize)
pub fn new( rect: Rectangle, initial_path: PathBuf, mode: SelectionMode, _hub: &Hub, rq: &mut RenderQueue, context: &mut Context, ) -> FileChooser
fn list_directory(&self, path: &Path) -> Result<Vec<FileEntryData>, String>
fn calculate_entry_rect( &self, y_pos: i32, index: usize, max_lines: usize, big_height: i32, big_thickness: i32, small_thickness: i32, ) -> Rectangle
fn add_error_label( &mut self, breadcrumb_bottom: i32, thickness: i32, big_height: i32, )
fn add_empty_label( &mut self, breadcrumb_bottom: i32, thickness: i32, big_height: i32, )
Sourcefn add_file_entries(
&mut self,
start_idx: usize,
end_idx: usize,
breadcrumb_bottom: i32,
thickness: i32,
big_height: i32,
big_thickness: i32,
small_thickness: i32,
max_lines: usize,
context: &mut Context,
)
fn add_file_entries( &mut self, start_idx: usize, end_idx: usize, breadcrumb_bottom: i32, thickness: i32, big_height: i32, big_thickness: i32, small_thickness: i32, max_lines: usize, context: &mut Context, )
Adds file entry views to the FileChooser’s children for the current page.
Each file entry is represented using the FileEntry component, which displays
the file or directory’s name, icon, and metadata (such as size and modification date).
Between each entry, a separator is added using the Filler component to visually
separate the entries.
Components used to build each file entry:
FileEntry: Displays the file or directory entry, including icon, name, and metadata.Filler: Used as a separator between file entries for visual clarity.
§Arguments
start_idx- The starting index of the entries to display.end_idx- The ending index (exclusive) of the entries to display.breadcrumb_bottom- The y-coordinate below the breadcrumb bar.thickness- The thickness of the separator lines.big_height- The height of each file entry row.big_thickness- The thickness of the separator between entries.small_thickness- The thickness of the separator at the end of the list.max_lines- The maximum number of entries to display per page.context
fn update_entries_list(&mut self, rq: &mut RenderQueue, context: &mut Context)
fn create_bottom_bar(&mut self)
Sourcefn select_item(&mut self, path: PathBuf, bus: &mut Bus)
fn select_item(&mut self, path: PathBuf, bus: &mut Bus)
Selects the given item if it matches the selection mode. Sends FileChooserClosed event with the selected path to the bus.
fn go_to_page( &mut self, dir: CycleDir, rq: &mut RenderQueue, context: &mut Context, )
Trait Implementations§
Source§impl View for FileChooser
impl View for FileChooser
fn handle_event( &mut self, evt: &Event, _hub: &Hub, bus: &mut Bus, rq: &mut RenderQueue, context: &mut Context, ) -> bool
fn render( &self, _fb: &mut dyn Framebuffer, _rect: Rectangle, _fonts: &mut Fonts, )
fn rect(&self) -> &Rectangle
fn rect_mut(&mut self) -> &mut Rectangle
fn children(&self) -> &Vec<Box<dyn View>>
fn children_mut(&mut self) -> &mut Vec<Box<dyn View>>
fn id(&self) -> Id
fn view_id(&self) -> Option<ViewId>
fn render_rect(&self, _rect: &Rectangle) -> Rectangle
fn resize( &mut self, rect: Rectangle, _hub: &Hub, _rq: &mut RenderQueue, _context: &mut Context, )
fn child(&self, index: usize) -> &dyn View
fn child_mut(&mut self, index: usize) -> &mut dyn View
fn len(&self) -> usize
fn might_skip(&self, _evt: &Event) -> bool
fn might_rotate(&self) -> bool
fn is_background(&self) -> bool
Auto Trait Implementations§
impl Freeze for FileChooser
impl !RefUnwindSafe for FileChooser
impl !Send for FileChooser
impl !Sync for FileChooser
impl Unpin for FileChooser
impl !UnwindSafe for FileChooser
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
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.