File dialog#
Source: lib/ui/filedlg.rs
filedlg -- Open / Save file dialog (ContentDialog with a folder list), both OS
[src/ui/ui_filedlg.s]
filedlg(id, flags, open, path, cap, exts) -> EV_ACT when a file was chosen
flags FD_OPEN / FD_SAVE / FD_FOLDER | index << FD_EXT_SHIFT (initially selected
extension); FD_FOLDER chooses a folder (the own dialog lists folders only and returns
the selected one, else the one shown).
path (at most cap - 1 bytes, UTF-8) gives the initial file or folder (empty = the
folder used last, else the home folder) and receives the chosen path ('/'
separators on every OS; Windows accepts them). exts = the extension list, one
entry per type: "png=PNG-Bild", "jpg;jpeg;jfif=JPEG-Bild" (lower case; several
extensions of one type separated by ';', the first is the one appended; optional
"=description"; empty = every file); FD_SAVE appends the selected type's extension
when the name has none. Call it every frame like any dialog; open = 1 shows it.
Where the system has a file dialog (Windows, the Linux portal) that one is shown
(modal); Android's picker answers later: nothing is drawn while it is open, the
chosen document arrives as its content:// name in a later frame. Otherwise,
headless, with FD_BUILTIN or with jfgui_FILEDLG=builtin, the library's own dialog.
FD_BUILTIN: the app chooses the own dialog for this call on every platform (its look,
its keys, the same in every style and on every system); it lists what plat's file
functions see (in the browser and on Android the app's own folders, not the system's
documents).
FD_MULTI (E8, with FD_OPEN): several files -- the system's dialog where it chooses
several (Windows, Linux's portal), the own dialog with Ctrl+click / Shift+click (or
Shift+arrows) on the rows ("a" "b" in the name box, quoted names typed there too);
path gets the first, ui.filedlg_paths() every chosen file.
Widget ids used: id .. id + 0x3FFF (list rows id + 17 + i).
filedlg_paths() -> the files of the last confirmed dialog (one without FD_MULTI, the folder
of an FD_FOLDER dialog)
Every window has its dialog's state (WinParts::fd): a dialog of the same id in two windows
lists, selects and names by itself, and one window's closed dialog leaves the other's open one
alone. The folder used last and the paths of the last confirmed dialog are the app's.
impl Ui
fn filedlg(&mut self, id: u32, flags: u32, open: &Shared<i32>, path: &mut String, cap: u32, exts: &[&str]) -> u32ui_filedlg(id, flags, open, path, cap, exts) -> EV_ACT when confirmedfn filedlg_paths(&self) -> Vec<String>(E8) the files the last confirmed file dialog chose: with FD_MULTI every one (the first is the dialog's path), else the one (FD_FOLDER: the folder); empty before any