mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-08-03 15:27:13 -04:00
lua interface for window visibility
This commit is contained in:
parent
0aca34c02b
commit
7f34e52a11
@ -384,6 +384,7 @@ namespace MWBase
|
||||
// Used in Lua bindings
|
||||
virtual const std::vector<MWGui::GuiMode>& getGuiModeStack() const = 0;
|
||||
virtual void setDisabledByLua(std::string_view windowId, bool disabled) = 0;
|
||||
virtual bool isWindowVisible(std::string_view windowId) const = 0;
|
||||
virtual std::vector<std::string_view> getAllWindowIds() const = 0;
|
||||
virtual std::vector<std::string_view> getAllowedWindowIds(MWGui::GuiMode mode) const = 0;
|
||||
};
|
||||
|
@ -2406,6 +2406,11 @@ namespace MWGui
|
||||
updateVisible();
|
||||
}
|
||||
|
||||
bool WindowManager::isWindowVisible(std::string_view windowId) const
|
||||
{
|
||||
return mLuaIdToWindow.at(windowId)->isVisible();
|
||||
}
|
||||
|
||||
std::vector<std::string_view> WindowManager::getAllWindowIds() const
|
||||
{
|
||||
std::vector<std::string_view> res;
|
||||
|
@ -390,6 +390,7 @@ namespace MWGui
|
||||
// Used in Lua bindings
|
||||
const std::vector<GuiMode>& getGuiModeStack() const override { return mGuiModes; }
|
||||
void setDisabledByLua(std::string_view windowId, bool disabled) override;
|
||||
bool isWindowVisible(std::string_view windowId) const override;
|
||||
std::vector<std::string_view> getAllWindowIds() const override;
|
||||
std::vector<std::string_view> getAllowedWindowIds(GuiMode mode) const override;
|
||||
|
||||
|
@ -296,6 +296,8 @@ namespace MWLua
|
||||
luaManager->addAction(
|
||||
[=, window = std::move(window)]() { windowManager->setDisabledByLua(window, disabled); });
|
||||
};
|
||||
api["_isWindowVisible"]
|
||||
= [windowManager](std::string_view window) { return windowManager->isWindowVisible(window); };
|
||||
|
||||
// TODO
|
||||
// api["_showMouseCursor"] = [](bool) {};
|
||||
|
@ -240,6 +240,13 @@ return {
|
||||
-- @return #boolean
|
||||
isHudVisible = function() return ui._isHudVisible() end,
|
||||
|
||||
---
|
||||
-- Returns if the given window is visible or not
|
||||
-- @function [parent=#UI] isWindowVisible
|
||||
-- @param #string windowName
|
||||
-- @return #boolean
|
||||
isWindowVisible = ui._isWindowVisible,
|
||||
|
||||
-- TODO
|
||||
-- registerHudElement = function(name, showFn, hideFn) end,
|
||||
-- showHudElement = function(name, bool) end,
|
||||
|
Loading…
x
Reference in New Issue
Block a user