Split Indicator and SquareIndicator into their own files, add annotations

This commit is contained in:
2023-04-04 06:55:04 +02:00
parent 8c4cc405aa
commit 26c7ce091e
3 changed files with 52 additions and 22 deletions

View File

@@ -13,7 +13,8 @@ types/triggers/trigger.lua
types/triggers/auratrigger.lua
types/statusbar.lua
types/auralist.lua
types/indicator.lua
types/indicators/indicator.lua
types/indicators/squareindicator.lua
types/unitgroup.lua
types/unitframe.lua

View File

@@ -0,0 +1,39 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- This file is part of Omicron Frames
--
-- Omicron Frames is free software: you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option)
-- any later version.
--
-- Omicron Frames is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-- more details.
--
-- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
local AuraTrigger = types.AuraTrigger
--- Indicator is a type for any kind of visual indicator. This type has no
-- function and should not be created. All functional indicators derive from
-- this type.
---@class Indicator: Object
local Indicator = types.CreateClass("Indicator")
types.Indicator = Indicator
--- Show the indicator and supply it with data
function Indicator:Show(data)
end
--- Update the indicator with new data
function Indicator:Update(data)
end
--- Hide the indicator
function Indicator:Hide()
end

View File

@@ -16,30 +16,20 @@
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
local AuraTrigger = types.AuraTrigger
--- Indicator is a type for any kind of visual indicator. This type has no
-- function and should not be created. All functional indicators derive from
-- this type.
local Indicator = types.CreateClass("Indicator")
types.Indicator = Indicator
--- Show the indicator and supply it with data
function Indicator:Show(data)
end
--- Update the indicator with new data
function Indicator:Update(data)
end
--- Hide the indicator
function Indicator:Hide()
end
---SquareIndicator is an indicator that displays a colored square texture
---@class SquareIndicator: Indicator
local SquareIndicator = types.CreateClass("SquareIndicator", Indicator)
types.SquareIndicator = SquareIndicator
---@return SquareIndicator
function SquareIndicator.new(cls, ...)
--- I really dislike duplicating this everywhere but it makes
--lua-language-server able to deduce the type of Object:new calls and that
--is honestly worth it
return types.Object.new(cls, ...)
end
--- Initialize a new SquareIndicator
-- unitframe Unitframe it is attached to
-- size Size of the indicator square
@@ -67,7 +57,7 @@ function SquareIndicator:SetColor(color)
end
--- Show the square indicator.
-- data: ignored for now
---@param data table|nil
function SquareIndicator:Show(data)
self.texture:Show()
end