47 lines
962 B
C++
47 lines
962 B
C++
/*
|
|
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <nostalgia/core/gfx.hpp>
|
|
#include <nostalgia/studio/studio.hpp>
|
|
|
|
namespace nostalgia::core {
|
|
|
|
class PaletteEditorImGui: public studio::Editor {
|
|
|
|
private:
|
|
Context *m_ctx = nullptr;
|
|
ox::String m_itemName;
|
|
ox::String m_itemPath;
|
|
Palette m_pal;
|
|
std::size_t m_selectedRow = 0;
|
|
studio::UndoStack m_undoStack;
|
|
|
|
PaletteEditorImGui() noexcept = default;
|
|
|
|
public:
|
|
static ox::Result<PaletteEditorImGui*> make(Context *ctx, const ox::String &path) noexcept;
|
|
|
|
/**
|
|
* Returns the name of item being edited.
|
|
*/
|
|
const ox::String &itemName() const override;
|
|
|
|
const ox::String &itemDisplayName() const noexcept override;
|
|
|
|
void draw(core::Context*) noexcept override;
|
|
|
|
protected:
|
|
studio::UndoStack *undoStack() noexcept final;
|
|
|
|
ox::Error saveItem() noexcept override;
|
|
|
|
private:
|
|
ox::Error markUnsavedChanges(int) noexcept;
|
|
|
|
};
|
|
|
|
}
|