diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-05-02 19:12:26 +1000 |
| commit | 1573a8c4cde1cd9528b422b2dcc598e37ffe94a7 (patch) | |
| tree | d162822b8fd7054f81bace0c7a65ab4d5e6f93ef /src/tangara/ui/screen_lua.hpp | |
| parent | a231fd1c8afedbeb14b0bc77d76bad61db986059 (diff) | |
| download | tangara-fw-1573a8c4cde1cd9528b422b2dcc598e37ffe94a7.tar.gz | |
WIP merge cyclically dependent components into one big component
Diffstat (limited to 'src/tangara/ui/screen_lua.hpp')
| -rw-r--r-- | src/tangara/ui/screen_lua.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/tangara/ui/screen_lua.hpp b/src/tangara/ui/screen_lua.hpp new file mode 100644 index 00000000..8a463bad --- /dev/null +++ b/src/tangara/ui/screen_lua.hpp @@ -0,0 +1,40 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#pragma once + +#include "lua.hpp" + +#include "property.hpp" +#include "screen.hpp" + +namespace ui { +namespace screens { + +class Lua : public Screen { + public: + Lua(); + ~Lua(); + + auto onShown() -> void override; + auto onHidden() -> void override; + + auto canPop() -> bool override; + + auto SetObjRef(lua_State*) -> void; + + private: + /* Invokes a method on this screen's Lua counterpart. */ + auto callMethod(std::string name) -> void; + /* Applies fn to each binding in this screen's `bindings` field. */ + auto forEachBinding(std::function<void(lua::Binding*)> fn) -> void; + + lua_State* s_; + std::optional<int> obj_ref_; +}; + +} // namespace screens +} // namespace ui |
