tullamods / Dominos

A main actionbar replacement
https://tullamods.com/dominos
BSD 3-Clause "New" or "Revised" License
79 stars 26 forks source link

TONS OF FUNCTIONALITY!!! #42

Closed Goranaws closed 13 years ago

Goranaws commented 13 years ago

I just discovered a method of adding literally any UI element to Dominos. I have succeeded in making a Dominos module that makes the Minimap, the minimap buttons and zone text all work with Dominos. Took a short while, but I have learned ALOT... and I have learned that there are nearly unlimited uses for Dominos! Below is a framework that can allow any Dominos user to make his/her own Dominos Module.

Goranaws commented 13 years ago

----[[ All instances of the "XX?XX" must be relabeled with the same name.

XX0XX = the UI element you want to add to Dominos(look up the coding name of it online) XX1XX = This is the "frame title" put what you want here. should be a short name XX2XX = Random name of your choosing. should only use letters here and no spaces XX3XX = Make Dominos recognize yer module. Choose another random name of yer choosing --]]

local L = LibStub('AceLocale-3.0') CreateFrame("Frame", "XX1XX", XX2XXBar); XX0XX:SetParent(XX1XX); --[[copy this line for as many things as you want to add]]-- local menuButtons do local loadButtons = function(...) menuButtons = {}

    for i = 1, select('#', ...) do
        local b = select(i, ...)
        local name = b:GetName()
        table.insert(menuButtons, b)
    end
end
loadButtons(_G['XX1XX']:GetChildren())

end

--[[ CUSTOM ]]-- local DCUSTOM = Dominos:NewModule('XX3XX') local CUSTOM

function DCUSTOM:Load() self.frame = CUSTOM:New() self.frame:SetFrameStrata('LOW') end function DCUSTOM:Unload() self.frame:Free() end

CUSTOM = Dominos:CreateClass('Frame', Dominos.Frame)

function CUSTOM:New() local f = self.super.New(self, 'XX3XX') if not f.value then f:SetFrameStrata('BACKGROUND') f:LoadButtons() end

f:Layout()

return f

end

function CUSTOM:GetDefaults() return { scale = 1, point = 'TOPRIGHT', y = 0, x = 0, } end function CUSTOM:NumButtons() return #menuButtons end

function CUSTOM:AddButton(i) local b = menuButtons[i] if b then b:SetParent(self.header) b:Show()

    self.buttons[i] = b
end

end

function CUSTOM:RemoveButton(i) local b = self.buttons[i] if b then b:SetParent(nil) b:Hide()

    self.buttons[i] = nil
end

end

Tuller commented 13 years ago

Good job, again, you can release what you want :P Bongos had a similar setup, called cornucopia.

Goranaws commented 13 years ago

Using the framework posted above, I'm gonna make at least 3 new modules... Minimap, PlayerFrames, and possibly a Chat Frame mod....

Goranaws commented 13 years ago

Dominos_MINIMAP and Dominos_PLAYERFRAMES should available on Curse as soon as they are approved by the admins!

Tuller commented 13 years ago

hurray :)

Goranaws commented 13 years ago

So, I'm shocked. In less than 3 days, each module I uploaded to curse has over 140 downloads each. Just goes to show that Dominos is VERY popular.