All pastes #82412 Raw Edit

Something

public text v1 · immutable
·published 2006-07-08 13:32 UTC
rendered paste body
MyAddOn_Design = {
    { 
        type="Frame",
        name="$parent_Frame", 
        parent="UIParent", 
        inherits=nil,
        methods = {
            SetHeight = { 100 },
            SetWidth = { 100 },
            SetPoint = { "TOPRIGHT", -50, -50 },
        }
        frames = {
            {
                type="Button",
                name="$parent_SomethingButton", 
                parent="MyFrame", 
                inherits="UIPanelButtonTemplate",
                methods = {
                    SetPoint = { "TOPLEFT", 20,-20 },
                    SetWidth = { 100 },
                    SetHeight = { 20 },
                }
            }
        }
    },
    {
        type="Frame",
        name="$parent_Frame2", parent="MyFrame", inherits=nil, 
        methods = {
            SetPoint = { }
        }
    },
}

MyAddOn_UI = {
    Design = MyAddOn_Design,
    Cache = {}
    Worker = function(self, frames, root, parent, lastname)
        for _,f in ipairs(frames) do
            local p = f.parent and getglobal(f.parent) or nil;
            if(parent) then
                string.
                o = CreateFrame(f.type, f.name, p, f.inherits);
                for m,v in pairs(f.methods) do
                    o[m](o, unpack(v));
                end
                if(f.frames) then
                    Worker(self,f.frames,root,f);
                end
            end
        end
        Init = function(self)
            Worker(self, self.Design, self.Design, nil, "MyAddOn");
        end
    }
    
    
    MyAddOn_UI:Init();