From d896008318176e514cf69856800c3102ef06e34d Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sun, 4 May 2025 23:30:38 +0200 Subject: [PATCH] Fix region --- ui/Region.lua | 317 +++++++++++++++++++++++++++----------------------- 1 file changed, 171 insertions(+), 146 deletions(-) diff --git a/ui/Region.lua b/ui/Region.lua index 5a733ee..350ecab 100644 --- a/ui/Region.lua +++ b/ui/Region.lua @@ -1,167 +1,192 @@ ---@meta ---@class Region : UIObject +--- This is an abstract object type which cannot actually be created. Defines a potentially visible area. Region = { - --- Gets the effective alpha (opacity) of the region. - --- @return number alpha The effective alpha value. - --- @example - --- local alpha = myRegion:GetEffectiveAlpha() - GetEffectiveAlpha = function(self) end, - - --- Gets the height of the region. - --- @return number height The height in pixels. - --- @example - --- local height = myRegion:GetHeight() - GetHeight = function(self) end, - - --- Gets the width of the region. - --- @return number width The width in pixels. - --- @example - --- local width = myRegion:GetWidth() - GetWidth = function(self) end, - - --- Gets the region's numeric identifier. - --- @return number id The region's ID. - --- @example - --- local id = myRegion:GetID() - GetID = function(self) end, - - --- Gets the number of points defined for the region. - --- @return number numPoints The number of points. - --- @example - --- local numPoints = myRegion:GetNumPoints() - GetNumPoints = function(self) end, - - --- Gets the position and anchoring of the region at the specified point index. - --- @param pointIndex number The index of the point to query. - --- @return string point, Region relativeTo, string relativePoint, number xOffset, number yOffset - --- @example - --- local point, relativeTo, relativePoint, xOffset, yOffset = myRegion:GetPoint(1) - GetPoint = function(self, pointIndex) end, - - --- Gets the scale factor of the region. - --- @return number scale The scale factor. - --- @example - --- local scale = myRegion:GetScale() - GetScale = function(self) end, - - --- Sets the alpha (opacity) of the region. - --- @param alpha number The alpha value (0.0 to 1.0). - --- @example - --- myRegion:SetAlpha(0.5) - SetAlpha = function(self, alpha) end, - - --- Sets the height of the region. - --- @param height number The height in pixels. - --- @example - --- myRegion:SetHeight(100) - SetHeight = function(self, height) end, - - --- Sets the width of the region. - --- @param width number The width in pixels. - --- @example - --- myRegion:SetWidth(200) - SetWidth = function(self, width) end, - - --- Sets both the width and height of the region. - --- @param width number The width in pixels. - --- @param height number The height in pixels. - --- @example - --- myRegion:SetSize(200, 100) - SetSize = function(self, width, height) end, - - --- Sets the scale factor of the region. - --- @param scale number The scale factor. - --- @example - --- myRegion:SetScale(1.5) - SetScale = function(self, scale) end, - - --- Clears all anchor points from the region. + --- Clears all attachment points for this object. + --- @param self Region --- @example --- myRegion:ClearAllPoints() ClearAllPoints = function(self) end, - --- Sets the position and anchoring of the region. - --- @param point string The point on this region to anchor from. + --- Creates and returns a new AnimationGroup as a child of this Region. + --- @param self Region + --- @param name string? Optional. The name of the AnimationGroup. + --- @param inheritsFrom string? Optional. The name of the AnimationGroup to inherit from. + --- @return AnimationGroup animationGroup The created AnimationGroup. + --- @example + --- local myAnimationGroup = myRegion:CreateAnimationGroup("MyAnimationGroup") + CreateAnimationGroup = function(self, name, inheritsFrom) end, + + --- Returns all AnimationGroups that are children of this Region. + --- @param self Region + --- @return table animationGroups A table of AnimationGroups. + --- @example + --- local animationGroups = myRegion:GetAnimationGroups() + GetAnimationGroups = function(self) end, + + --- Get the y location of the bottom edge of this frame. + --- @param self Region + --- @return number bottom The y location of the bottom edge. + --- @example + --- local bottom = myRegion:GetBottom() + GetBottom = function(self) end, + + --- Get the coordinates of the center of this frame. + --- @param self Region + --- @return number centerX The x coordinate of the center. + --- @return number centerY The y coordinate of the center. + --- @example + --- local centerX, centerY = myRegion:GetCenter() + GetCenter = function(self) end, + + --- Get the height of this object. + --- @param self Region + --- @return number height The height of the object. + --- @example + --- local height = myRegion:GetHeight() + GetHeight = function(self) end, + + --- Get the x location of the left edge of this frame. + --- @param self Region + --- @return number left The x location of the left edge. + --- @example + --- local left = myRegion:GetLeft() + GetLeft = function(self) end, + + --- Get the number of anchor points for this frame. + --- @param self Region + --- @return number numPoints The number of anchor points. + --- @example + --- local numPoints = myRegion:GetNumPoints() + GetNumPoints = function(self) end, + + --- Get details for an anchor point for this frame. + --- @param self Region + --- @param pointNum number The index of the point to query. + --- @return string point The anchor point. + --- @return Region relativeTo The region to which it is anchored. + --- @return string relativePoint The point on the other region to anchor to. + --- @return number xofs The x offset. + --- @return number yofs The y offset. + --- @example + --- local point, relativeTo, relativePoint, xofs, yofs = myRegion:GetPoint(1) + GetPoint = function(self, pointNum) end, + + --- Get frame's left, bottom, width, height. + --- @param self Region + --- @return number left The left position. + --- @return number bottom The bottom position. + --- @return number width The width of the frame. + --- @return number height The height of the frame. + --- @example + --- local left, bottom, width, height = myRegion:GetRect() + GetRect = function(self) end, + + --- Get the x location of the right edge of this frame. + --- @param self Region + --- @return number right The x location of the right edge. + --- @example + --- local right = myRegion:GetRight() + GetRight = function(self) end, + + --- Get the width of this object. + --- @param self Region + --- @return number width The width of the object. + --- @example + --- local width = myRegion:GetWidth() + GetWidth = function(self) end, + + --- Set this object to hidden (it and all of its children will disappear). + --- @param self Region + --- @example + --- myRegion:Hide() + Hide = function(self) end, + + --- True if this Region or its Parent is being dragged. + --- @param self Region + --- @return boolean isDragging True if the region is being dragged. + --- @example + --- local isDragging = myRegion:IsDragging() + IsDragging = function(self) end, + + --- Determine if this object can be manipulated in certain ways by tainted code in combat or not. + --- @param self Region + --- @return boolean isProtected True if the object is protected. + --- @example + --- local isProtected = myRegion:IsProtected() + IsProtected = function(self) end, + + --- Determine if this object is shown (would be visible if its parent was visible). + --- @param self Region + --- @return boolean isShown True if the object is shown. + --- @example + --- local isShown = myRegion:IsShown() + IsShown = function(self) end, + + --- Get whether the object is visible on screen. + --- @param self Region + --- @return boolean isVisible True if the object is visible. + --- @example + --- local isVisible = myRegion:IsVisible() + IsVisible = function(self) end, + + --- Set all anchors to match edges of specified frame. + --- @param self Region + --- @param frame Frame The frame to match. + --- @example + --- myRegion:SetAllPoints(otherFrame) + SetAllPoints = function(self, frame) end, + + --- Set the height of the object. + --- @param self Region + --- @param height number The height to set. + --- @example + --- myRegion:SetHeight(100) + SetHeight = function(self, height) end, + + --- Set the parent for this frame. + --- @param self Region + --- @param parent Frame The parent frame to set. + --- @example + --- myRegion:SetParent(otherFrame) + SetParent = function(self, parent) end, + + --- Set an attachment point of this object. + --- @param self Region + --- @param point string The point to anchor from. --- @param relativeTo Region|string The region or frameName to anchor to. --- @param relativePoint string The point on the other region to anchor to. - --- @param xOffset number? The x-axis offset. - --- @param yOffset number? The y-axis offset. + --- @param xOfs number? The x-axis offset. + --- @param yOfs number? The y-axis offset. --- @example --- myRegion:SetPoint("TOPLEFT", otherRegion, "BOTTOMRIGHT", 10, -10) - SetPoint = function(self, point, relativeTo, relativePoint, xOffset, yOffset) end, + SetPoint = function(self, point, relativeTo, relativePoint, xOfs, yOfs) end, - --- Returns the region's opacity. - --- @return number alpha The opacity of the region. + --- Set the region's width and height. + --- @param self Region + --- @param width number The width to set. + --- @param height number The height to set. --- @example - --- local alpha = myRegion:GetAlpha() - GetAlpha = function(self) end, + --- myRegion:SetSize(200, 100) + SetSize = function(self, width, height) end, - --- Returns the layer in which the region is drawn. - --- @return string layer The layer of the region. - --- @return number sublayer The sublayer of the region. + --- Set the width of this object. + --- @param self Region + --- @param width number The width to set. --- @example - --- local layer, sublayer = myRegion:GetDrawLayer() - GetDrawLayer = function(self) end, + --- myRegion:SetWidth(200) + SetWidth = function(self, width) end, - --- Returns the scale of the region after propagating from its parents. - --- @return number effectiveScale The effective scale of the region. + --- Set this object to shown (it will appear if its parent is visible). + --- @param self Region --- @example - --- local effectiveScale = myRegion:GetEffectiveScale() - GetEffectiveScale = function(self) end, + --- myRegion:Show() + Show = function(self) end, - --- Returns the vertex color shading of the region. - --- @return number colorR The red component of the vertex color. - --- @return number colorG The green component of the vertex color. - --- @return number colorB The blue component of the vertex color. - --- @return number colorA The alpha component of the vertex color. + --- Stops any active animations on the Region and its children. + --- @param self Region --- @example - --- local r, g, b, a = myRegion:GetVertexColor() - GetVertexColor = function(self) end, - - --- Returns true if the region is ignoring parent alpha. - --- @return boolean isIgnoring True if the region is ignoring parent alpha. - --- @example - --- local isIgnoring = myRegion:IsIgnoringParentAlpha() - IsIgnoringParentAlpha = function(self) end, - - --- Returns true if the region is ignoring parent scale. - --- @return boolean isIgnoring True if the region is ignoring parent scale. - --- @example - --- local isIgnoring = myRegion:IsIgnoringParentScale() - IsIgnoringParentScale = function(self) end, - - --- Returns true if the region is fully loaded. - --- @return boolean isLoaded True if the region is loaded. - --- @example - --- local isLoaded = myRegion:IsObjectLoaded() - IsObjectLoaded = function(self) end, - - --- Sets the layer in which the region is drawn. - --- @param layer string The layer to set. - --- @param sublevel number? Optional. The sublevel to set. - --- @example - --- myRegion:SetDrawLayer("ARTWORK", 1) - SetDrawLayer = function(self, layer, sublevel) end, - - --- Sets whether the region should ignore its parent's alpha. - --- @param ignore boolean True to ignore parent alpha. - --- @example - --- myRegion:SetIgnoreParentAlpha(true) - SetIgnoreParentAlpha = function(self, ignore) end, - - --- Sets whether the region should ignore its parent's scale. - --- @param ignore boolean True to ignore parent scale. - --- @example - --- myRegion:SetIgnoreParentScale(true) - SetIgnoreParentScale = function(self, ignore) end, - - --- Sets the vertex shading color of the region. - --- @param colorR number The red component of the color. - --- @param colorG number The green component of the color. - --- @param colorB number The blue component of the color. - --- @param a number? Optional. The alpha component of the color. - --- @example - --- myRegion:SetVertexColor(1, 0, 0) -- Set to red - SetVertexColor = function(self, colorR, colorG, colorB, a) end, + --- myRegion:StopAnimating() + StopAnimating = function(self) end, }