UXFileChooser
UXFileChooser is the model behind an open/save file panel: the
current directory as a UXPath, a
backend-supplied listing of its entries, an extension filter, and the
prompt string. The backend provides the panel view and reads the
directory; this class holds the testable state it drives.
The filter rule: directories always show; files show only when they
match an allowed extension (an empty filter accepts all). Navigation is
pure UXPath editing: entering a folder appends a component, and going up
deletes one. The whole model can be tested with no filesystem.
#use <UXKit>Where you see it
Section titled “Where you see it”The chooser has no view of its own. It is the state behind whichever panel
runs. Call UXOpenPanel.run() and
you get the platform’s own dialog where one exists, or the toolkit-drawn
UXFilePanel driving this model where
none does. Two captures of that panel follow:

The toolkit-drawn UXFilePanel (GEM has no OS file selector): mask +
Find, the sortable Name/Size listing with folders first, Recent, and
the Manage group. Every control is a neutral widget over this model.

The same panel through GDI (Wine’s comdlg32 dialog hangs on macOS, so
the driver prefers the toolkit panel there; real Windows can switch to
the native GetOpenFileName).
A native NSOpenPanel. It is an out-of-process system service, so it
has no headless capture.
Overview
Section titled “Overview”UXFileChooser* fc = new UXFileChooser();fc.setDirectory(UXPath.parse((u8*)"/home/user"));fc.allowExtension((u8*)"png");fc.allowExtension((u8*)"jpg");fc.setEntries(listingFromBackend);Array* show = fc.visibleEntries(); // dirs + matching files onlyTopics
Section titled “Topics”Navigation · directory · setDirectory · enter · goUp Listing · setEntries · visibleEntries · visibleCount · acceptsFile · allowExtension Open vs save · setSaveMode · setSaveName · setPrompt · resultPath
directory / setDirectory
Section titled “directory / setDirectory”UXPath* directory(void)void setDirectory(UXPath* p)Where the chooser is browsing.
void enter(u8* dirname)Appends the folder to the path and clears the entries. The backend then re-lists the new directory.
void goUp(void)Deletes the last component and clears the entries.
setEntries
Section titled “setEntries”void setEntries(Array* e)The backend hands over the raw directory listing
(UXFileEntry items).
visibleEntries
Section titled “visibleEntries”Array<UXFileEntry>* visibleEntries(void)The filtered listing: every directory, plus the files that pass the extension filter.
visibleCount
Section titled “visibleCount”i32 visibleCount(void)How many entries pass the filter.
acceptsFile
Section titled “acceptsFile”bool acceptsFile(u8* name)The filter itself: case-insensitive extension match, or every file when the filter is empty.
allowExtension
Section titled “allowExtension”void allowExtension(u8* ext)Adds an accepted extension (without the dot).
setSaveMode
Section titled “setSaveMode”void setSaveMode(bool on)Switches to save semantics. The default “Open” prompt becomes “Save” (a custom prompt is kept).
setSaveName
Section titled “setSaveName”void setSaveName(u8* n)The proposed file name a save panel returns.
setPrompt
Section titled “setPrompt”void setPrompt(u8* p)The customisable button/title string.
resultPath
Section titled “resultPath”u8* resultPath(u8* chosenName)The full path the panel returns: the directory plus the chosen name, or plus the save name in save mode.