10#ifndef ECHOMAP_FILESYSTEMCOMBO_HPP
11#define ECHOMAP_FILESYSTEMCOMBO_HPP
13#if !defined(__EMSCRIPTEN__) || defined(__DOXYGEN__)
71 bool is_directory_hint);
78 [[nodiscard]]
bool draw()
const noexcept;
93 if (lhs.is_directory != rhs.is_directory)
94 return lhs.is_directory ? std::strong_ordering::less : std::strong_ordering::greater;
96 return lhs.name <=> rhs.name;
173 bool draw_child_entries(
The EchoMap maintains state for the application including WebGPU and Dear ImGui context,...
void invalidate_cache()
Invalidates the EntryCache.
bool operator()(std::filesystem::path &selected_path)
Draws the FilesystemCombo control.
FilesystemCombo(EchoMap *app)
Sets up a new FilesystemCombo with the given EchoMap application context.
std::optional< EntryCache > cache
Cache of entries visible in the combo box.
BrowseTarget current_target
The current target specified in the filter window.
EchoMap * app
Pointer to the owning application instance.
void update_current_state(const std::filesystem::path &path)
Copies and formats the given path into the fixed-size current directory state member variable.
static constexpr unsigned int max_path_length
Maximum number of characters in a filesystem path.
std::array< char, max_path_length > current_root
The current raw string entered by the user.
The main EchoMap outermost namespace for all non-exported symbols.
A root target selected by the user to focus on.
std::filesystem::path parent_directory
The parent directory of the target path.
std::filesystem::path target_path
The selected path.
std::string filter
Cached string of the target path filename.
EntryCache(const std::filesystem::path &directory)
Creates a new EntryCache and populates it for the given root directory.
std::filesystem::path directory
The root directory on the file-system.
std::vector< Entry > entries
The first-level children of the root.
bool is_directory
Directory sentinel flag.
friend bool operator==(const Entry &, const Entry &)=default
Determines equality between two Entry objects.
std::string name
The cached display name of the path.
friend std::strong_ordering operator<=>(const Entry &lhs, const Entry &rhs) noexcept
Determines the ordering between two Entry objects.
std::string imgui_id
Dear ImGui display name, including ID disambiguator.
std::filesystem::path path
The path represented by the Entry.
Entry(const std::filesystem::path &path, bool is_directory_hint)
Create a new Entry for a regular file or directory.
ImGuiSelectableFlags flags
Dear ImGui flags for rendering the Selectable.
bool draw() const noexcept
Draws the Entry as a Dear ImGui Selectable.