[nostalgia/core/studio] Add Palette page names to editor
All checks were successful
Build / build (push) Successful in 2m33s

This commit is contained in:
2024-09-06 21:35:09 -05:00
parent ba4540e43f
commit 52533c8c44
8 changed files with 136 additions and 37 deletions

View File

@@ -18,7 +18,7 @@ struct StudioContext {
StudioUI &ui;
Project *project = nullptr;
turbine::Context &tctx;
inline StudioContext(StudioUI &pUi, turbine::Context &pTctx) noexcept:
StudioContext(StudioUI &pUi, turbine::Context &pTctx) noexcept:
ui(pUi), tctx(pTctx) {}
};

View File

@@ -45,10 +45,10 @@ class DragDropSource {
private:
bool const m_active{};
public:
inline DragDropSource() noexcept:
DragDropSource() noexcept:
m_active(ImGui::BeginDragDropSource()) {
}
inline ~DragDropSource() noexcept {
~DragDropSource() noexcept {
if (m_active) {
ImGui::EndDragDropSource();
}
@@ -58,7 +58,7 @@ class DragDropSource {
}
};
inline auto dragDropSource(auto const&cb) noexcept {
auto dragDropSource(auto const&cb) noexcept {
if constexpr(ox::is_same_v<decltype(cb()), ox::Error>) {
if (ig::DragDropSource const tgt; tgt) [[unlikely]] {
return cb();
@@ -75,10 +75,10 @@ class DragDropTarget {
private:
bool const m_active{};
public:
inline DragDropTarget() noexcept:
DragDropTarget() noexcept:
m_active(ImGui::BeginDragDropTarget()) {
}
inline ~DragDropTarget() noexcept {
~DragDropTarget() noexcept {
if (m_active) {
ImGui::EndDragDropTarget();
}
@@ -128,6 +128,21 @@ void centerNextWindow(turbine::Context &ctx) noexcept;
bool PushButton(ox::CStringView lbl, ImVec2 const&btnSz = BtnSz) noexcept;
template<size_t StrCap>
bool InputText(
ox::CStringView label,
ox::IString<StrCap> &text,
ImGuiInputTextFlags const flags = 0,
ImGuiInputTextCallback const callback = nullptr,
void *user_data = nullptr) noexcept {
auto const out = ImGui::InputText(
label.c_str(), text.data(), StrCap + 1, flags, callback, user_data);
if (out) {
std::ignore = text.unsafeResize(ox::strlen(text.c_str()));
}
return out;
}
enum class PopupResponse {
None,
OK,
@@ -136,6 +151,8 @@ enum class PopupResponse {
PopupResponse PopupControlsOkCancel(float popupWidth, bool &popupOpen);
PopupResponse PopupControlsOkCancel(bool &popupOpen);
[[nodiscard]]
bool BeginPopup(turbine::Context &ctx, ox::CStringView popupName, bool &show, ImVec2 const&sz = {285, 0});