diff --git a/src/OmicronFrames.toc b/src/OmicronFrames.toc index 024ac65..cbc7486 100644 --- a/src/OmicronFrames.toc +++ b/src/OmicronFrames.toc @@ -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 diff --git a/src/types/indicators/indicator.lua b/src/types/indicators/indicator.lua new file mode 100644 index 0000000..e8dc382 --- /dev/null +++ b/src/types/indicators/indicator.lua @@ -0,0 +1,39 @@ +-- Copyright 2023 +-- +-- 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 . +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 + diff --git a/src/types/indicator.lua b/src/types/indicators/squareindicator.lua similarity index 77% rename from src/types/indicator.lua rename to src/types/indicators/squareindicator.lua index 223843f..ffea271 100644 --- a/src/types/indicator.lua +++ b/src/types/indicators/squareindicator.lua @@ -16,30 +16,20 @@ -- Omicron Frames. If not, see . 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 +---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