Class FilePicker

Inheritance Relationships

Base Type

Class Documentation

class SmartPeak::FilePicker : public SmartPeak::Widget

Public Types

enum Mode

Values:

enumerator EFileRead
enumerator EFileCreate
enumerator EDirectory

Public Functions

inline FilePicker()
virtual void draw() override

Interface to show the widget

NOTE: free to override in inherited implmementations

std::string getPickedPathname() const
void open(const std::string &title, std::shared_ptr<IFilePickerHandler> file_picker_handler, FilePicker::Mode mode, ApplicationHandler &application_handler, const std::string &default_file_name = "")
void runProcessor()
inline bool fileLoadingIsDone()
inline bool errorLoadingFile()

Protected Functions

void run_and_join(IFilePickerHandler *file_picker_handler, const std::string &pathname, bool &loading_is_done)
void updateContents(std::vector<ImEntry> &content_items)

! rescan pathname_content_ into content_items when needed

void drawConfirmationPopup()
void doOpenFile()
bool isReadyToOpen(const std::string &full_path)
void clearProcessor()

Protected Attributes

std::array<std::vector<std::string>, 4> pathname_content_
std::filesystem::path current_pathname_ = std::filesystem::current_path()
std::string picked_pathname_
std::shared_ptr<IFilePickerHandler> file_picker_handler_ = nullptr
ApplicationHandler *application_handler_ = nullptr
bool loading_is_done_ = true
bool error_loading_file_ = false
FilePicker::Mode mode_
std::atomic_bool files_scanned_ = {false}
const ImGuiTableSortSpecs *s_current_sort_specs = NULL
std::string selected_filename_
int selected_entry_ = -1
ImGuiTextFilter filter_
std::string open_button_text_ = "Open"