400 lines
15 KiB
Lua
400 lines
15 KiB
Lua
---@meta
|
|
|
|
---@class ScriptRegion
|
|
ScriptRegion = {
|
|
--- Returns true if protected properties of the region can be changed by non-secure scripts.
|
|
--- @return boolean canChange True if properties can be changed.
|
|
--- @example
|
|
--- local canChange = myScriptRegion:CanChangeProtectedState()
|
|
CanChangeProtectedState = function(self) end,
|
|
|
|
--- Sets whether the region should receive mouse input.
|
|
--- @param enable boolean True to enable mouse input.
|
|
--- @example
|
|
--- myScriptRegion:EnableMouse(true)
|
|
EnableMouse = function(self, enable) end,
|
|
|
|
--- Sets whether the region should receive mouse hover events.
|
|
--- @param enable boolean True to enable mouse hover events.
|
|
--- @example
|
|
--- myScriptRegion:EnableMouseMotion(true)
|
|
EnableMouseMotion = function(self, enable) end,
|
|
|
|
--- Sets whether the region should receive mouse wheel input.
|
|
--- @param enable boolean True to enable mouse wheel input.
|
|
--- @example
|
|
--- myScriptRegion:EnableMouseWheel(true)
|
|
EnableMouseWheel = function(self, enable) end,
|
|
|
|
--- Returns the offset in pixels to the bottom edge of the region.
|
|
--- @return number bottom The offset to the bottom edge.
|
|
--- @example
|
|
--- local bottomOffset = myScriptRegion:GetBottom()
|
|
GetBottom = function(self) end,
|
|
|
|
--- Returns the offset in pixels to the center of the region.
|
|
--- @return number x The x-coordinate of the center.
|
|
--- @return number y The y-coordinate of the center.
|
|
--- @example
|
|
--- local centerX, centerY = myScriptRegion:GetCenter()
|
|
GetCenter = function(self) end,
|
|
|
|
--- Returns the height of the region.
|
|
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
|
|
--- @return number height The height of the region.
|
|
--- @example
|
|
--- local height = myScriptRegion:GetHeight()
|
|
GetHeight = function(self, ignoreRect) end,
|
|
|
|
--- Returns the offset in pixels to the left edge of the region.
|
|
--- @return number left The offset to the left edge.
|
|
--- @example
|
|
--- local leftOffset = myScriptRegion:GetLeft()
|
|
GetLeft = function(self) end,
|
|
|
|
--- Returns the coordinates and size of the region.
|
|
--- @return number left The left coordinate.
|
|
--- @return number bottom The bottom coordinate.
|
|
--- @return number width The width of the region.
|
|
--- @return number height The height of the region.
|
|
--- @example
|
|
--- local left, bottom, width, height = myScriptRegion:GetRect()
|
|
GetRect = function(self) end,
|
|
|
|
--- Returns the offset in pixels to the right edge of the region.
|
|
--- @return number right The offset to the right edge.
|
|
--- @example
|
|
--- local rightOffset = myScriptRegion:GetRight()
|
|
GetRight = function(self) end,
|
|
|
|
--- Returns the scaled coordinates and size of the region.
|
|
--- @return number left The left coordinate.
|
|
--- @return number bottom The bottom coordinate.
|
|
--- @return number width The width of the region.
|
|
--- @return number height The height of the region.
|
|
--- @example
|
|
--- local left, bottom, width, height = myScriptRegion:GetScaledRect()
|
|
GetScaledRect = function(self) end,
|
|
|
|
--- Returns the widget script handler.
|
|
--- @param scriptTypeName string The name of the script type.
|
|
--- @param bindingType string? Optional. The binding type.
|
|
--- @return function script The script handler.
|
|
--- @example
|
|
--- local scriptHandler = myScriptRegion:GetScript("OnClick")
|
|
GetScript = function(self, scriptTypeName, bindingType) end,
|
|
|
|
--- Returns the width and height of the region.
|
|
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
|
|
--- @return number width The width of the region.
|
|
--- @return number height The height of the region.
|
|
--- @example
|
|
--- local width, height = myScriptRegion:GetSize()
|
|
GetSize = function(self, ignoreRect) end,
|
|
|
|
--- Returns the script name and line number where the region was created.
|
|
--- @return string location The script location.
|
|
--- @example
|
|
--- local location = myScriptRegion:GetSourceLocation()
|
|
GetSourceLocation = function(self) end,
|
|
|
|
--- Returns the offset in pixels to the top edge of the region.
|
|
--- @return number top The offset to the top edge.
|
|
--- @example
|
|
--- local topOffset = myScriptRegion:GetTop()
|
|
GetTop = function(self) end,
|
|
|
|
--- Returns the width of the region.
|
|
--- @param ignoreRect boolean? Optional. If true, ignores the rectangle.
|
|
--- @return number width The width of the region.
|
|
--- @example
|
|
--- local width = myScriptRegion:GetWidth()
|
|
GetWidth = function(self, ignoreRect) end,
|
|
|
|
--- Returns true if the region supports the given script type.
|
|
--- @param scriptName string The name of the script.
|
|
--- @return boolean hasScript True if the script is supported.
|
|
--- @example
|
|
--- local hasScript = myScriptRegion:HasScript("OnClick")
|
|
HasScript = function(self, scriptName) end,
|
|
|
|
--- Hides the region.
|
|
--- @example
|
|
--- myScriptRegion:Hide()
|
|
Hide = function(self) end,
|
|
|
|
--- Securely post-hooks a widget script handler.
|
|
--- @param scriptTypeName string The name of the script type.
|
|
--- @param script function The script handler.
|
|
--- @param bindingType string? Optional. The binding type.
|
|
--- @example
|
|
--- myScriptRegion:HookScript("OnClick", function() print("Clicked!") end)
|
|
HookScript = function(self, scriptTypeName, script, bindingType) end,
|
|
|
|
--- Returns true if the region has cross-region anchoring restrictions applied.
|
|
--- @return boolean isRestricted True if anchoring is restricted.
|
|
--- @example
|
|
--- local isRestricted = myScriptRegion:IsAnchoringRestricted()
|
|
IsAnchoringRestricted = function(self) end,
|
|
|
|
--- Returns true if the region is being dragged.
|
|
--- @return boolean isDragging True if the region is being dragged.
|
|
--- @example
|
|
--- local isDragging = myScriptRegion:IsDragging()
|
|
IsDragging = function(self) end,
|
|
|
|
--- Returns true if the region can receive mouse clicks.
|
|
--- @return boolean enabled True if mouse clicks are enabled.
|
|
--- @example
|
|
--- local isEnabled = myScriptRegion:IsMouseClickEnabled()
|
|
IsMouseClickEnabled = function(self) end,
|
|
|
|
--- Returns true if the region can receive mouse input.
|
|
--- @return boolean enabled True if mouse input is enabled.
|
|
--- @example
|
|
--- local isEnabled = myScriptRegion:IsMouseEnabled()
|
|
IsMouseEnabled = function(self) end,
|
|
|
|
--- Returns true if the region can receive mouse hover events.
|
|
--- @return boolean enabled True if mouse hover events are enabled.
|
|
--- @example
|
|
--- local isEnabled = myScriptRegion:IsMouseMotionEnabled()
|
|
IsMouseMotionEnabled = function(self) end,
|
|
|
|
--- Returns true if the mouse cursor is hovering over the region.
|
|
--- @return boolean isMouseMotionFocus True if the mouse is over the region.
|
|
--- @example
|
|
--- local isMouseOver = myScriptRegion:IsMouseMotionFocus()
|
|
IsMouseMotionFocus = function(self) end,
|
|
|
|
--- Returns true if the mouse cursor is hovering over the region.
|
|
--- @param offsetTop number? Optional. The top offset.
|
|
--- @param offsetBottom number? Optional. The bottom offset.
|
|
--- @param offsetLeft number? Optional. The left offset.
|
|
--- @param offsetRight number? Optional. The right offset.
|
|
--- @return boolean isMouseOver True if the mouse is over the region.
|
|
--- @example
|
|
--- local isMouseOver = myScriptRegion:IsMouseOver()
|
|
IsMouseOver = function(self, offsetTop, offsetBottom, offsetLeft, offsetRight) end,
|
|
|
|
--- Returns true if the region can receive mouse wheel input.
|
|
--- @return boolean enabled True if mouse wheel input is enabled.
|
|
--- @example
|
|
--- local isEnabled = myScriptRegion:IsMouseWheelEnabled()
|
|
IsMouseWheelEnabled = function(self) end,
|
|
|
|
--- Returns whether the region is currently protected.
|
|
--- @return boolean isProtected True if the region is protected.
|
|
--- @return boolean isProtectedExplicitly True if the protection is explicit.
|
|
--- @example
|
|
--- local isProtected, isExplicit = myScriptRegion:IsProtected()
|
|
IsProtected = function(self) end,
|
|
|
|
--- Returns true if the region can be positioned on the screen.
|
|
--- @return boolean isValid True if the region is valid.
|
|
--- @example
|
|
--- local isValid = myScriptRegion:IsRectValid()
|
|
IsRectValid = function(self) end,
|
|
|
|
--- Returns true if the region should be shown.
|
|
--- @return boolean isShown True if the region is shown.
|
|
--- @example
|
|
--- local isShown = myScriptRegion:IsShown()
|
|
IsShown = function(self) end,
|
|
|
|
--- Returns true if the region and its parents are shown.
|
|
--- @return boolean isVisible True if the region is visible.
|
|
--- @example
|
|
--- local isVisible = myScriptRegion:IsVisible()
|
|
IsVisible = function(self) end,
|
|
|
|
--- Sets whether the region should receive mouse clicks.
|
|
--- @param enabled boolean True to enable mouse clicks.
|
|
--- @example
|
|
--- myScriptRegion:SetMouseClickEnabled(true)
|
|
SetMouseClickEnabled = function(self, enabled) end,
|
|
|
|
--- Sets whether the region should receive mouse hover events.
|
|
--- @param enabled boolean True to enable mouse hover events.
|
|
--- @example
|
|
--- myScriptRegion:SetMouseMotionEnabled(true)
|
|
SetMouseMotionEnabled = function(self, enabled) end,
|
|
|
|
--- Sets the parent of the region.
|
|
--- @param parent Frame? The parent frame.
|
|
--- @example
|
|
--- myScriptRegion:SetParent(UIParent)
|
|
SetParent = function(self, parent) end,
|
|
|
|
--- Allows the region to propagate mouse clicks to underlying regions or the world frame.
|
|
--- @param button1 string? The first button to pass through.
|
|
--- @example
|
|
--- myScriptRegion:SetPassThroughButtons("LeftButton")
|
|
SetPassThroughButtons = function(self, button1) end,
|
|
|
|
--- Sets the widget script handler.
|
|
--- @param scriptTypeName string The name of the script type.
|
|
--- @param script function? The script handler.
|
|
--- @example
|
|
--- myScriptRegion:SetScript("OnClick", function() print("Clicked!") end)
|
|
SetScript = function(self, scriptTypeName, script) end,
|
|
|
|
--- Shows or hides the region.
|
|
--- @param show boolean? Optional. True to show, false to hide.
|
|
--- @example
|
|
--- myScriptRegion:SetShown(true)
|
|
SetShown = function(self, show) end,
|
|
|
|
--- Shows the region.
|
|
--- @example
|
|
--- myScriptRegion:Show()
|
|
Show = function(self) end,
|
|
|
|
--- Adjusts the x and y offset of the region.
|
|
--- @param x number The x offset.
|
|
--- @param y number The y offset.
|
|
--- @example
|
|
--- myScriptRegion:AdjustPointsOffset(10, 20)
|
|
AdjustPointsOffset = function(self, x, y) end,
|
|
|
|
--- Removes all anchor points from the region.
|
|
--- @example
|
|
--- myScriptRegion:ClearAllPoints()
|
|
ClearAllPoints = function(self) end,
|
|
|
|
--- Removes an anchor point from the region by name.
|
|
--- @param point string The name of the anchor point.
|
|
--- @example
|
|
--- myScriptRegion:ClearPoint("TOP")
|
|
ClearPoint = function(self, point) end,
|
|
|
|
--- Resets the x and y offset on the region to zero.
|
|
--- @example
|
|
--- myScriptRegion:ClearPointsOffset()
|
|
ClearPointsOffset = function(self) end,
|
|
|
|
--- Returns the number of anchor points for the region.
|
|
--- @return number numPoints The number of anchor points.
|
|
--- @example
|
|
--- local numPoints = myScriptRegion:GetNumPoints()
|
|
GetNumPoints = function(self) end,
|
|
|
|
--- Returns an anchor point for the region.
|
|
--- @param anchorIndex number? Optional. The index of the anchor point.
|
|
--- @return string point The anchor point.
|
|
--- @return Frame relativeTo The frame to which the anchor is relative.
|
|
--- @return string relativePoint The relative point.
|
|
--- @return number offsetX The x offset.
|
|
--- @return number offsetY The y offset.
|
|
--- @example
|
|
--- local point, relativeTo, relativePoint, offsetX, offsetY = myScriptRegion:GetPoint()
|
|
GetPoint = function(self, anchorIndex) end,
|
|
|
|
--- Returns an anchor point by name for the region.
|
|
--- @param point string The name of the anchor point.
|
|
--- @return string point The anchor point.
|
|
--- @return Frame relativeTo The frame to which the anchor is relative.
|
|
--- @return string relativePoint The relative point.
|
|
--- @return number offsetX The x offset.
|
|
--- @return number offsetY The y offset.
|
|
--- @example
|
|
--- local point, relativeTo, relativePoint, offsetX, offsetY = myScriptRegion:GetPointByName("TOP")
|
|
GetPointByName = function(self, point) end,
|
|
|
|
--- Positions the region the same as another region.
|
|
--- @param relativeTo Frame The frame to position relative to.
|
|
--- @param doResize boolean? Optional. True to resize the region.
|
|
--- @example
|
|
--- myScriptRegion:SetAllPoints(otherFrame)
|
|
SetAllPoints = function(self, relativeTo, doResize) end,
|
|
|
|
--- Sets the height of the region.
|
|
--- @param height number The height to set.
|
|
--- @example
|
|
--- myScriptRegion:SetHeight(100)
|
|
SetHeight = function(self, height) end,
|
|
|
|
--- Sets an anchor point for the region.
|
|
--- @param point string The anchor point.
|
|
--- @param relativeTo Frame The frame to which the anchor is relative.
|
|
--- @param relativePoint string The relative point.
|
|
--- @param offsetX number The x offset.
|
|
--- @param offsetY number The y offset.
|
|
--- @example
|
|
--- myScriptRegion:SetPoint("TOP", otherFrame, "BOTTOM", 0, 0)
|
|
SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY) end,
|
|
|
|
--- Sets the width and height of the region.
|
|
--- @param x number The width to set.
|
|
--- @param y number The height to set.
|
|
--- @example
|
|
--- myScriptRegion:SetSize(200, 100)
|
|
SetSize = function(self, x, y) end,
|
|
|
|
--- Sets the width of the region.
|
|
--- @param width number The width to set.
|
|
--- @example
|
|
--- myScriptRegion:SetWidth(200)
|
|
SetWidth = function(self, width) end,
|
|
|
|
-- --- @alias OnEnter
|
|
-- --- Invoked when the mouse cursor enters the frame's interactive area.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param motion table The motion data.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnEnter", function(self, motion) print("Mouse entered") end)
|
|
--
|
|
-- --- @alias OnHide
|
|
-- --- Invoked when the frame's visibility changes to hidden.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnHide", function(self) print("Frame hidden") end)
|
|
--
|
|
-- --- @alias OnLeave
|
|
-- --- Invoked when the mouse cursor leaves the frame's interactive area.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param motion table The motion data.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnLeave", function(self, motion) print("Mouse left") end)
|
|
--
|
|
-- --- @alias OnMouseDown
|
|
-- --- Invoked when a mouse button is pressed while the cursor is over the frame.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param button string The button that was pressed.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnMouseDown", function(self, button) print("Mouse button pressed: " .. button) end)
|
|
--
|
|
-- --- @alias OnMouseUp
|
|
-- --- Invoked when the mouse button is released following a mouse down action in the frame.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param button string The button that was released.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnMouseUp", function(self, button) print("Mouse button released: " .. button) end)
|
|
--
|
|
-- --- @alias OnMouseWheel
|
|
-- --- Invoked when the frame receives a mouse wheel scrolling action.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param delta number The amount of scrolling.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnMouseWheel", function(self, delta) print("Mouse wheel scrolled: " .. delta) end)
|
|
--
|
|
-- --- @alias OnShow
|
|
-- --- Invoked when the frame becomes visible.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnShow", function(self) print("Frame shown") end)
|
|
--
|
|
-- --- @alias OnLoad
|
|
-- --- Invoked when the object is created.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnLoad", function(self) print("Object loaded") end)
|
|
--
|
|
-- --- @alias OnUpdate
|
|
-- --- Invoked on every frame.
|
|
-- --- @param self ScriptRegion
|
|
-- --- @param elapsed number The time elapsed since the last frame.
|
|
-- --- @example
|
|
-- --- myScriptRegion:SetScript("OnUpdate", function(self, elapsed) print("Frame updated: " .. elapsed) end)
|
|
}
|