mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
26 lines
612 B
Lua
26 lines
612 B
Lua
--[[
|
|
Classy.lua
|
|
A wrapper for defining classes that inherit from widgets
|
|
--]]
|
|
|
|
local Classy = LibStub:NewLibrary('Classy-1.0', 0)
|
|
if not Classy then return end
|
|
|
|
function Classy:New(frameType, parentClass)
|
|
local class = CreateFrame(frameType)
|
|
class.mt = {__index = class}
|
|
|
|
if parentClass then
|
|
class = setmetatable(class, {__index = parentClass})
|
|
|
|
class.super = function(self, method, ...)
|
|
parentClass[method](self, unpack(arg))
|
|
end
|
|
end
|
|
|
|
class.Bind = function(self, obj)
|
|
return setmetatable(obj, self.mt)
|
|
end
|
|
|
|
return class
|
|
end |