Skip to main content

Module browser

Module browser 

Source
Expand description

A file browser with pluggable view modes (design).

FileBrowser owns what every view shares: the entries of a place, read from a FileSource; the selection and the focus; type-ahead; the mode switcher. A ViewMode draws the entries and answers what the person did; the browser decides what it means. Thumbnails come from a ThumbnailProvider, egui-pop’s default being PreviewThumbnails over the files service’s preview providers.

Built-in modes: DetailsMode (rows with columns), ThumbnailsMode (a virtualised grid), FilmstripMode, ColumnsMode (Finder’s), CarouselMode and AgendaMode (by day). Others register on a ViewModes registry.

Structs§

AgendaMode
The entries by day, month or year, the newest first: one heading per group (when the entry was taken, given by the application’s source, else when it last changed; UTC), which a click collapses or expands, its entries under it in a grid, the newest first, those without a time last. The arrows move across the groups’ grids; Ctrl+Up and Ctrl+Down change the level, Ctrl+Left and Ctrl+Right collapse and expand the focused entry’s group. The dates and the groups are computed once per listing, not every frame.
AgendaSettings
The agenda’s settings: its level, and the groups collapsed at that level (None: the entries without a time). A change of level expands them all.
AppDropTarget
One of the application’s own drop targets: an id it is reported by, and the label its zone shows.
BrowserOutput
What the browser did this frame.
CarouselMode
The focused entry large in the middle, at the thumbnail size (smaller when the room is short), its neighbours smaller and smaller on each side (Finder’s Gallery), spaced by their cells’ own widths. Left and Right bring the previous or next entry to the middle; a click on a neighbour does too. The middle one asks for its thumbnail first, then the neighbours outwards, then the next one on each side (Near).
Column
One folder’s listing beside the place’s: an ancestor, or the focused folder looked into, for a mode that shows the path as columns.
ColumnListings
The listings of the columns beside the place’s, for a mode that shows the path (Finder’s columns): the place’s ancestors and the focused folder looked into. Each lists off the interface thread when its source does (a FsSource over the system’s file system), its entries streaming in page by page, Column::loading until the end; one no longer wanted (the focus moved on, the place changed) is dropped, which cancels it.
ColumnsMode
Finder’s columns: one column per folder of the path, the place’s last, then the focused entry looked into (a folder’s entries, a file’s thumbnail and facts). Up and Down move in the place’s column; Right enters the focused folder, Left goes back to the parent.
DetailsMode
Rows with columns: the name, the size and when it last changed.
DraggedPaths
Paths dragged inside the application, for a file browser to take: the payload a widget sets with egui::DragAndDrop::set_payload as a drag starts.
DropOffer
A drop on offer: what the application’s accept is asked about while hovering, and what BrowserOutput::dropped gives once it is taken. While a system drag hovers, paths may be empty: some platforms say the files only on the drop.
EntryFilter
Which entries a browser shows (FileBrowser::set_filter): files by extension, and one kind of entry or both. Folders pass an extension filter (the person goes through them), unless the kind leaves them out. A group is shown when its main file passes, its members with it.
EntryMarks
What an application says of an entry beyond its facts (FileBrowser::with_marks): short badges drawn as text on its cell and after its name; chips (an icon or a short text in a corner of its thumbnail, MarkChip); both said with its name to assistive technology; and whether it is dimmed (shown, but not what the person acts on).
FileBrowser
The file browser: entries from a FileSource, shown by a ViewMode chosen in its toolbar (or with Ctrl+1 to Ctrl+9), kept per dialog in the host’s store when drawn with FileBrowser::show_in.
FilmstripMode
One row of thumbnails, the focused entry large above it (Lightroom’s Loupe and Filmstrip). The large view asks first (Visible), then the strip’s cells in view, then the next screen of them (Near).
FsSource
A FileSource over a super::fs::FileSystem: in pages of page_size, on a thread of its own for the system’s file system (off the web), at once for one held in memory.
ListOptions
How to list.
Listing
A listing under way: its pages arrive through Listing::poll, and the frame never waits. Dropping it cancels it.
ListingSender
The source’s end of a Listing.
MarkChip
A mark in a corner of an entry’s thumbnail: an icon (“in your Library” as a check) or a short text (“R+J” for a RAW and JPEG pair), on a pill of its tone. Its name is said after the entry’s name and is its tooltip.
ModeContext
What a mode is given to draw.
ModeInfo
What a mode is, for the switcher, persistence, agents and screen readers.
ModeNeeds
What a mode needs from the browser.
ModeOutput
What the person did in a mode; the browser decides what it means.
ModeSettings
A mode’s own settings, kept per browser.
NoThumbnails
A provider that gives nothing: icons stand in.
PlainDrawer
The browser’s own drawing: a plain row (name, size, date) or a cell (the thumbnail and the name), selected and focused as the context says.
PreviewThumbnails
egui-pop’s default thumbnails: the files service’s preview providers (PNG and JPEG with image, folders, the system’s thumbnails when installed), made by their worker, visible first.
Reach
Somewhere a mode asks the browser to go: a place, and the entry to focus there (a click in another column than the place’s).
RecordedThumbnails
What a recording ThumbnailProvider saw, for tests and agents.
RecordingThumbnails
A provider that makes nothing and records what it is asked, to check a mode’s loading order.
Renewals
The bookkeeping of renewed requests: what a frame asked, in priority order, and what the frame before asked that this one did not.
Selection
The selected entries, by path, and the anchor a range starts from.
SelectionPolicy
What a browser lets the person select (FileBrowser::set_selection_policy): which kind of entry, and one or several. A click, the keys, a rubber band, select all and FileBrowser::set_selection all keep to it; an entry it refuses is still focused and opened.
SourceEntry
One entry as a source gives it.
ThumbRequest
One thumbnail asked for.
ThumbnailsMode
A virtualised grid of thumbnails with their names. Only the cells in view ask for a thumbnail, in reading order, then the next row as Near, so what scrolls away is cancelled by the provider.
ViewModes
The view modes on offer, in the switcher’s order: the built-ins first, then those plugins register (and take back when they disconnect).

Enums§

AgendaLevel
What an agenda groups its entries by.
DropOrigin
Where what is dropped comes from.
DropTarget
Where a drop goes.
EntryKind
What an entry is.
GridResize
How a thumbnail grid’s zoom answers a resize: what the zoom (its slider, Ctrl and + or -, Ctrl and the wheel) means, and so what a wider grid shows.
MarkCorner
The corner of a thumbnail a MarkChip sits in. Chips in one corner line up from it towards the middle, in their order.
ModeKey
A key a mode moves the focus with: its layout decides where it goes.
Page
What a listing delivers, in order.
Priority
How soon a thumbnail is wanted.
SelectMode
How many entries can be selected.
Selectable
Which kind of entry can be selected (SelectionPolicy).
SourceError
Why a source could not list.
ThumbState
A thumbnail’s state.
ThumbZoom
A thumbnail grid’s zoom: how many thumbnails fill a row, the API’s side of the library grid’s Zoom (egui_pop_views::library::grid, which converts from and into it).
Travel
A key that leaves the place, in a mode that shows the path.

Constants§

MODE_AGENDA
The id of the agenda mode.
MODE_CAROUSEL
The id of the carousel mode.
MODE_COLUMNS
The id of the columns mode (Finder’s).
MODE_DETAILS
The id of the details mode, the first in the switcher.
MODE_FILMSTRIP
The id of the filmstrip mode.
MODE_KEYS
How many modes have a key (Ctrl+1 to Ctrl+9).
MODE_THUMBNAILS
The id of the thumbnails mode.
SEGMENTED_MAX
Up to this many modes, the switcher is a segmented control; beyond, a menu.

Traits§

EntryDrawer
Draws the entries a mode lays out, one at a time: the layer that knows its host. A mode owns the layout (the virtualised rows or cells, the scrolling, the keys’ moves, the thumbnails’ order); the drawer owns what an entry looks like and does. The browser’s own is PlainDrawer; the in-app picker gives its rows with their columns, its groups’ badges, the highlight its field drives and its own clicks.
FileSource
Where a browser’s entries come from: a file system, a camera card, a catalogue. Entries are paged and streamed.
ThumbnailProvider
Makes thumbnails off the interface thread. A frame starts with ThumbnailProvider::begin_frame, asks with ThumbnailProvider::request, and ends with ThumbnailProvider::end_frame: a request not renewed in a frame is cancelled, so what scrolled away leaves the queue without the mode’s help.
ViewMode
A way to show a browser’s entries. It draws and reports; selection rules, what Enter does and what a click on a folder does are the browser’s.

Functions§

mode_key
The n-th mode key pressed (Ctrl+1 is 1), consumed; None when none was.
mode_label
A mode’s name in the interface’s language: the catalogue’s egui-pop-files-mode-<id>, else its English label.
mode_switcher
The mode switcher: a segmented control for up to SEGMENTED_MAX modes, a menu beyond. Each mode’s label is translated (mode_label), its icon drawn from the icon registry when it resolves, its keys in its tip. Answers the mode pressed, if one was (the one shown too: a press may move the keyboard elsewhere).
paint_cell
A cell’s thumbnail (or what stands in for it) and its name, in rect.
paint_marks
A cell’s marks over its thumbnail: dimmed, its badges stacked from the image’s bottom left corner, its chips in their corners. Gives where each chip was drawn, in their order.
request_mode
Asks the file browser holding the keyboard for its n-th mode (from 1, in the switcher’s order): what the file.view.mode<n> commands do. Taken by the browser’s next frame.
take_focused
Whether a file browser held the keyboard in the frame drawn last; read once (the flag is cleared), for the mode keys’ when clause.

Type Aliases§

MarkEntries
What gives an entry’s marks (FileBrowser::with_marks).
ThumbnailCache
Thumbnails per path, for a mode’s own use.