12 #include <RADCore/RADCore.h>
25 #include <RADUi/RADDesktopShell.h>
35 explicit Binding(std::shared_ptr<RADCore::RADObject> owner);
43 std::shared_ptr<RADCore::RADObject> owner_;
53 virtual void run() = 0;
57 virtual void postToUi(std::function<
void()> task) = 0;
96 std::shared_ptr<Impl> pImpl_;
159 static std::filesystem::path
stablePath(
const std::filesystem::path& path);
167 static std::vector<DirectoryBrowserEntry>
snapshot(
const std::filesystem::path& root,
168 const std::set<std::filesystem::path>& expandedDirectories,
175 loop.
post(std::forward<F>(task));
RADCore task event loop with locked and low-latency scheduling strategies.
Definition: RADCore.h:988
void post(Priority priority, Task task)
Posts task with explicit priority.
Abstract UI backend used to post tasks to a toolkit UI thread.
Definition: RADUi.h:47
virtual void run()=0
Runs the toolkit event loop.
virtual ~Backend()=default
Destroys the backend through the interface.
virtual void postToUi(std::function< void()> task)=0
Posts task for execution on the UI thread.
virtual void quit()=0
Requests that the toolkit event loop exit.
virtual bool isUiThread() const =0
Returns true when called from the UI thread.
RAII-style binding handle that keeps a bridge object alive until disconnected.
Definition: RADUi.h:30
bool isConnected() const
Returns true when this binding still owns a bridge object.
void disconnect()
Releases the owned bridge object and disconnects future delivery.
Binding()=default
Creates an empty, disconnected binding.
Binding(std::shared_ptr< RADCore::RADObject > owner)
Creates a binding that owns owner for the lifetime of the binding.
Backend-neutral expandable directory browser model.
Definition: RADUi.h:156
static std::string iconForKind(DirectoryBrowserEntryKind kind)
Returns the toolkit-neutral icon key for kind.
static std::filesystem::path stablePath(const std::filesystem::path &path)
Returns a stable absolute path when possible.
static std::vector< DirectoryBrowserEntry > snapshot(const std::filesystem::path &root, const std::set< std::filesystem::path > &expandedDirectories, const DirectoryBrowserOptions &options={})
Builds a flattened tree snapshot from root and expanded directory paths.
static bool extensionAllowed(const std::filesystem::path &path, const DirectoryBrowserOptions &options)
Returns true when extension matches options.allowedExtensions, or the list is empty.
static DirectoryBrowserEntryKind classify(const std::filesystem::directory_entry &entry)
Classifies a filesystem entry for display and behavior.
Coalesces UI updates so expensive redraws occur at a target frame rate.
Definition: RADUi.h:79
FrameScheduler & operator=(const FrameScheduler &)=delete
Schedulers are owned by one bridge/model and are not copied.
FrameScheduler(double framesPerSecond=60.0)
Creates a scheduler capped at framesPerSecond.
~FrameScheduler()
Stops the scheduler worker.
void requestUpdate(std::function< void()> task)
Requests that task run on the UI thread at the next scheduled frame.
FrameScheduler(const FrameScheduler &)=delete
Schedulers are owned by one bridge/model and are not copied.
Definition: RADAppKit.h:20
void postToUi(std::function< void()> task)
Posts task to the installed UI backend.
bool hasBackend()
Returns true when a UI backend is installed.
void setBackend(std::shared_ptr< Backend > backend)
Installs the process-wide UI backend used by RADUi helpers.
bool isUiThread()
Returns true when the current thread is the installed UI backend thread.
void postToRad(RADCore::EventLoop &loop, F &&task)
Posts task to a RADCore event loop from UI-side code.
Definition: RADUi.h:174
Backend & backend()
Returns the installed backend or throws when none is installed.
void run()
Runs the installed backend's UI event loop.
DirectoryBrowserEntryKind
File type category for DirectoryBrowserEntry.
Definition: RADUi.h:100
@ Parent
Synthetic parent-folder row.
@ Project
RADBard or RADLib-style project file.
@ Folder
Filesystem directory.
@ Application
Executable or desktop application entry.
void quit()
Requests the installed backend to quit.
One flattened row in a native-style expandable directory browser.
Definition: RADUi.h:118
int depth
Tree depth relative to the browser root.
Definition: RADUi.h:128
bool isDirectory
True for filesystem directories and the synthetic parent row.
Definition: RADUi.h:130
std::filesystem::path path
Stable absolute path for the row.
Definition: RADUi.h:120
std::string subtitle
Secondary display text.
Definition: RADUi.h:124
bool expanded
True when this directory is expanded.
Definition: RADUi.h:134
std::string name
Display name.
Definition: RADUi.h:122
bool isApplication
True when this row represents an executable/app-like file.
Definition: RADUi.h:136
std::string icon
Toolkit-neutral icon key: up, folder, score, midi, audio, app, or file.
Definition: RADUi.h:126
bool expandable
True when this directory currently has displayable children.
Definition: RADUi.h:132
DirectoryBrowserEntryKind kind
Classified file type.
Definition: RADUi.h:138
Options for DirectoryBrowserModel snapshots.
Definition: RADUi.h:142
std::vector< std::string > allowedExtensions
Optional lowercase extension allow-list. Empty means all files.
Definition: RADUi.h:152
bool includeFiles
Include files in addition to folders.
Definition: RADUi.h:144
bool includeHidden
Include dot-prefixed hidden files and folders.
Definition: RADUi.h:146
int maxDepth
Maximum expanded tree depth.
Definition: RADUi.h:150
bool includeParentEntry
Include synthetic parent row when the root has a parent.
Definition: RADUi.h:148