mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-09 12:25:17 -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
|
// Used in Lua bindings
|
||||||
virtual const std::vector<MWGui::GuiMode>& getGuiModeStack() const = 0;
|
virtual const std::vector<MWGui::GuiMode>& getGuiModeStack() const = 0;
|
||||||
virtual void setDisabledByLua(std::string_view windowId, bool disabled) = 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> getAllWindowIds() const = 0;
|
||||||
virtual std::vector<std::string_view> getAllowedWindowIds(MWGui::GuiMode mode) const = 0;
|
virtual std::vector<std::string_view> getAllowedWindowIds(MWGui::GuiMode mode) const = 0;
|
||||||
};
|
};
|
||||||
|
@ -2406,6 +2406,11 @@ namespace MWGui
|
|||||||
updateVisible();
|
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> WindowManager::getAllWindowIds() const
|
||||||
{
|
{
|
||||||
std::vector<std::string_view> res;
|
std::vector<std::string_view> res;
|
||||||
|
@ -390,6 +390,7 @@ namespace MWGui
|
|||||||
// Used in Lua bindings
|
// Used in Lua bindings
|
||||||
const std::vector<GuiMode>& getGuiModeStack() const override { return mGuiModes; }
|
const std::vector<GuiMode>& getGuiModeStack() const override { return mGuiModes; }
|
||||||
void setDisabledByLua(std::string_view windowId, bool disabled) override;
|
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> getAllWindowIds() const override;
|
||||||
std::vector<std::string_view> getAllowedWindowIds(GuiMode mode) const override;
|
std::vector<std::string_view> getAllowedWindowIds(GuiMode mode) const override;
|
||||||
|
|
||||||
|
@ -296,6 +296,8 @@ namespace MWLua
|
|||||||
luaManager->addAction(
|
luaManager->addAction(
|
||||||
[=, window = std::move(window)]() { windowManager->setDisabledByLua(window, disabled); });
|
[=, window = std::move(window)]() { windowManager->setDisabledByLua(window, disabled); });
|
||||||
};
|
};
|
||||||
|
api["_isWindowVisible"]
|
||||||
|
= [windowManager](std::string_view window) { return windowManager->isWindowVisible(window); };
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// api["_showMouseCursor"] = [](bool) {};
|
// api["_showMouseCursor"] = [](bool) {};
|
||||||
|
@ -240,6 +240,13 @@ return {
|
|||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
isHudVisible = function() return ui._isHudVisible() end,
|
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
|
-- TODO
|
||||||
-- registerHudElement = function(name, showFn, hideFn) end,
|
-- registerHudElement = function(name, showFn, hideFn) end,
|
||||||
-- showHudElement = function(name, bool) end,
|
-- showHudElement = function(name, bool) end,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user