From 998f7ecc803c1be975bc40a0b761dfec79b00158 Mon Sep 17 00:00:00 2001 From: nox7 <36878742-nox7@users.noreply.gitlab.com> Date: Thu, 1 Oct 2026 15:53:03 -0500 Subject: [PATCH] Add missing cursor prop to widgets. Fix ui cursor docs and broken mlink --- .../reference/lua-scripting/widgets/container.rst | 3 +++ docs/source/reference/lua-scripting/widgets/flex.rst | 3 +++ docs/source/reference/lua-scripting/widgets/image.rst | 3 +++ docs/source/reference/lua-scripting/widgets/text.rst | 3 +++ .../reference/lua-scripting/widgets/textedit.rst | 3 +++ docs/source/reference/lua-scripting/widgets/widget.rst | 5 +++-- files/lua_api/openmw/ui.lua | 10 +++++----- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/source/reference/lua-scripting/widgets/container.rst b/docs/source/reference/lua-scripting/widgets/container.rst index b0f6126347..e4ddf09093 100644 --- a/docs/source/reference/lua-scripting/widgets/container.rst +++ b/docs/source/reference/lua-scripting/widgets/container.rst @@ -52,6 +52,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. Events ------ diff --git a/docs/source/reference/lua-scripting/widgets/flex.rst b/docs/source/reference/lua-scripting/widgets/flex.rst index a79ccb272b..3aa174fdc9 100644 --- a/docs/source/reference/lua-scripting/widgets/flex.rst +++ b/docs/source/reference/lua-scripting/widgets/flex.rst @@ -48,6 +48,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. * - horizontal - bool (false) - | Flex aligns its children in a row (main axis is horizontal) if true, diff --git a/docs/source/reference/lua-scripting/widgets/image.rst b/docs/source/reference/lua-scripting/widgets/image.rst index 90692580c9..89aae244c5 100644 --- a/docs/source/reference/lua-scripting/widgets/image.rst +++ b/docs/source/reference/lua-scripting/widgets/image.rst @@ -48,6 +48,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. * - resource - ui.texture - The texture resource to display diff --git a/docs/source/reference/lua-scripting/widgets/text.rst b/docs/source/reference/lua-scripting/widgets/text.rst index 167487192a..f720645870 100644 --- a/docs/source/reference/lua-scripting/widgets/text.rst +++ b/docs/source/reference/lua-scripting/widgets/text.rst @@ -48,6 +48,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. * - autoSize - boolean (true) - | Adjusts this widget's size to fit the text exactly. diff --git a/docs/source/reference/lua-scripting/widgets/textedit.rst b/docs/source/reference/lua-scripting/widgets/textedit.rst index 9383830c88..c76ef0c337 100644 --- a/docs/source/reference/lua-scripting/widgets/textedit.rst +++ b/docs/source/reference/lua-scripting/widgets/textedit.rst @@ -48,6 +48,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. * - text - string ('') - The text to display. diff --git a/docs/source/reference/lua-scripting/widgets/widget.rst b/docs/source/reference/lua-scripting/widgets/widget.rst index 11c4b73050..d208cf4795 100644 --- a/docs/source/reference/lua-scripting/widgets/widget.rst +++ b/docs/source/reference/lua-scripting/widgets/widget.rst @@ -52,8 +52,9 @@ Properties - boolean (true) - | Modulate `alpha` with parents `alpha`. | If the parent has `inheritAlpha` set to `true`, the value after modulating is passed to the child. - -.. TODO: document the mouse pointer property, when API for reading / adding pointer types is available + * - cursor + - `CursorResource <../openmw_ui.html##(CursorResource)>`_ + - Sets the cursor to be displayed when hovering over this widget. Events ------ diff --git a/files/lua_api/openmw/ui.lua b/files/lua_api/openmw/ui.lua index 842af20523..b8446083f1 100644 --- a/files/lua_api/openmw/ui.lua +++ b/files/lua_api/openmw/ui.lua @@ -22,11 +22,11 @@ -- @function [parent=#ui] getCursorMode -- @return #CursorMode ---- Set the cursor position in UI pixels. The position is clamped to the OpenMW window. +--- Set the cursor position in pixels. The position is clamped to the OpenMW window. -- @function [parent=#ui] setCursorPosition -- @param openmw.util#Vector2 position ---- Return the cursor position in UI pixels. +--- Return the cursor position in pixels. -- @function [parent=#ui] getCursorPosition -- @return openmw.util#Vector2 @@ -38,11 +38,11 @@ -- @function [parent=#ui] getCursorVisible -- @return #boolean ---- Override the cursor used by UI widgets. Pass `nil` to restore the cursor selected by the widget under the pointer. +--- Override the engine cursor. Pass `nil` to restore the cursor back to engine-controlled. -- @function [parent=#ui] setCursor -- @param #CursorResource cursor ---- Return the currently displayed Lua cursor resource, or `nil` when a native MyGUI cursor is displayed. +--- Return the currently displayed Lua cursor resource, or `nil` when a native engine-controlled cursor is displayed. -- @function [parent=#ui] getCursor -- @return #CursorResource cursor @@ -383,7 +383,7 @@ -- @field openmw.util#Vector2 size Size of the resource in the texture. (0, 0) by default. 0 means the whole texture size is used. --- --- Register a hardware cursor backed by a texture in the virtual filesystem. Use the result as a widget's `props.cursor`, or pass it to @{openmw.ui#ui.setCursor} to override all widget cursors. +-- Register a hardware cursor backed by a texture in the virtual filesystem. Use the result as a widget's `props.cursor`, or pass it to @{#(ui).setCursor} to override all widget cursors. -- Repeated calls with the same options will return the same CursorResource if it already has been registered. -- @function [parent=#ui] cursor -- @param #CursorResourceOptions options