[studio] Add confirmation for closing file with unsaved changes

This commit is contained in:
2025-02-02 23:07:59 -06:00
parent 4728699585
commit cd1f4bdaa3
4 changed files with 116 additions and 11 deletions

View File

@@ -303,6 +303,34 @@ class FilePicker {
};
class QuestionPopup {
private:
enum class Stage {
Closed,
Opening,
Open,
};
Stage m_stage = Stage::Closed;
bool m_open{};
ox::String m_title;
ox::String m_question;
public:
ox::Signal<ox::Error(ig::PopupResponse)> response;
QuestionPopup(ox::StringParam title, ox::StringParam question) noexcept;
void open() noexcept;
void close() noexcept;
[[nodiscard]]
bool isOpen() const noexcept;
void draw(StudioContext &ctx, ImVec2 const &sz = {}) noexcept;
};
[[nodiscard]]
bool mainWinHasFocus() noexcept;