osb/source/frontend/StarBaseScriptPane.hpp

47 lines
1.0 KiB
C++
Raw Normal View History

2023-07-02 07:19:54 +00:00
#ifndef STAR_BASE_SCRIPT_PANE_HPP
#define STAR_BASE_SCRIPT_PANE_HPP
#include "StarPane.hpp"
#include "StarLuaComponents.hpp"
#include "StarGuiReader.hpp"
namespace Star {
STAR_CLASS(CanvasWidget);
STAR_CLASS(BaseScriptPane);
// A more 'raw' script pane that doesn't depend on a world being present.
// Requires a derived class to provide a Lua root.
2023-07-04 12:36:27 +00:00
// Should maybe move into windowing?
2023-07-02 07:19:54 +00:00
class BaseScriptPane : public Pane {
public:
BaseScriptPane(Json config);
virtual void show() override;
void displayed() override;
void dismissed() override;
void tick(float dt) override;
2023-07-02 07:19:54 +00:00
bool sendEvent(InputEvent const& event) override;
PanePtr createTooltip(Vec2I const& screenPosition) override;
Maybe<String> cursorOverride(Vec2I const& screenPosition) override;
protected:
2023-07-04 12:36:27 +00:00
virtual GuiReaderPtr reader();
2023-07-02 07:19:54 +00:00
Json m_config;
2023-07-04 12:36:27 +00:00
GuiReaderPtr m_reader;
2023-07-02 07:19:54 +00:00
Map<CanvasWidgetPtr, String> m_canvasClickCallbacks;
Map<CanvasWidgetPtr, String> m_canvasKeyCallbacks;
bool m_callbacksAdded;
LuaUpdatableComponent<LuaBaseComponent> m_script;
};
}
#endif