/*
 * 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;

		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 noexcept final;

		const ox::String &itemDisplayName() const noexcept final;

		void draw(core::Context*) noexcept final;

	protected:
		ox::Error saveItem() noexcept final;

};

}
