You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
65 lines
1.7 KiB
---@type Diesal.GUI
|
|
local DiesalGUI = LibStub("DiesalGUI-2.0")
|
|
|
|
local Type = "DiesalContainer"
|
|
local Version = 1
|
|
|
|
---@class Diesal.GUI.Container.Methods
|
|
local ContainerMethods = {
|
|
---@param self Diesal.GUI.Container
|
|
OnAcquire = function(self)
|
|
self:ResetSettings(true)
|
|
self:Show()
|
|
end,
|
|
|
|
---@param self Diesal.GUI.Container
|
|
OnRelease = function(self)
|
|
self:ReleaseChildren()
|
|
end,
|
|
|
|
---@param self Diesal.GUI.Container
|
|
ApplySettings = function(self)
|
|
local content = self.content
|
|
content:SetPoint("TOPLEFT")
|
|
content:SetPoint("BOTTOMRIGHT")
|
|
self.frame:SetToplevel(true)
|
|
end,
|
|
|
|
---@param self Diesal.GUI.Container
|
|
SetTopLevel = function(self)
|
|
self.frame:SetToplevel(true)
|
|
end,
|
|
|
|
---@param self Diesal.GUI.Container
|
|
---@param element Diesal.GUI.ObjectBase
|
|
SetElement = function(self, element)
|
|
element.container = self
|
|
element:SetParentObject(self)
|
|
self:AddChild(element)
|
|
self.element = element
|
|
end,
|
|
}
|
|
|
|
---@alias DiesalContainer Diesal.GUI.Container
|
|
|
|
local function Constructor()
|
|
---@class Diesal.GUI.Container : Diesal.GUI.ObjectBase, Diesal.GUI.Container.Methods
|
|
---@field content Frame
|
|
---@field element? Diesal.GUI.ObjectBase
|
|
local self = DiesalGUI:Create(Type, true)
|
|
self.isContainer = true
|
|
local frame = CreateFrame("Frame", nil, DiesalGUI.UIParent)
|
|
self.frame = frame
|
|
|
|
self.defaults = {}
|
|
|
|
local content = self:CreateRegion("Frame", "content", frame)
|
|
frame:SetToplevel(true)
|
|
for k, v in pairs(ContainerMethods) do
|
|
self[k] = v
|
|
end
|
|
self:SetObj(self.frame)
|
|
return self
|
|
end
|
|
|
|
DiesalGUI:RegisterObjectConstructor(Type, Constructor, Version)
|
|
|