Thread Tools Display Modes
12-13-06, 08:45 PM   #1
Kiphere
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 17
Full code for Widger.

Here ya go :P be gentle.

Code:
--[Thanks go to Mairelon on the WoW UI forum and Ayradyss on wowinterface.com's forums!]--

local print, buildbar
local rows, cols, scale = 10, 12, 1
local eventframe = CreateFrame("Frame")
eventframe:RegisterEvent("VARIABLES_LOADED")
eventframe:RegisterEvent("PLAYER_LOGIN")
eventframe:SetScript("OnEvent", function(self, event, ...)
	if ( event == "PLAYER_LOGIN" ) then
		buildbar(); print("Test")
	end
end)
function print(str)
	DEFAULT_CHAT_FRAME:AddMessage(tostring(str))
end



function buildbar()
	local anchor = CreateFrame("Frame", "EasyBarAnchorFrame", UIParent)
	anchor:SetWidth(2) anchor:SetHeight(2)
	anchor:SetScale(scale)
	local height, width
	local action = 1
	for row = 1, rows do
		for col = 1, cols do
			local btn = CreateFrame("CheckButton", "EasyBarButton"..action, anchor, "ActionBarButtonTemplate")
			btn:SetScript("OnAttributeChanged", ActionButton_Update)
			btn:SetMovable(1)
			btn:SetClampedToScreen(1)
			btn:SetAttribute("type", "action")
			btn:SetAttribute("action", action)
			height = height or btn:GetHeight()
			width = width or btn:GetWidth()
			btn:SetPoint("TOPLEFT", (col-1)*width, -1 * (row-1)*height)
			action = action+1

			local cap = CreateFrame("Frame",btn:GetName().."Cap", btn)
			cap:EnableMouse(1)
			cap:SetClampedToScreen(1)
			cap:SetAllPoints()
			cap:Hide()
			cap:RegisterForDrag("LeftButton")
			cap:SetScript("OnDragStart", function(self) self:GetParent():StartMoving() end)
			cap:SetScript("OnDragStop", function(self) self:GetParent():StopMovingOrSizing() ValidateFramePosition(self)end)
			local tex = cap:CreateTexture(nil, "OVERLAY")
			tex:SetAllPoints()
			tex:SetTexture(1,1,0)
			tex:SetAlpha(.6)
		end
	end
	anchor:SetPoint("CENTER", -1 * (cols/2) * width, (rows/2) * height)
end

SlashCmdList["ColonelBarCOMMAND"] = 
function (msg)	
	local argT = {};
	gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
	if (argT[1]) == "move" then
		if tonumber(argT[2]) > 0 then
			getglobal("EasyBarButton"..argT[2].."Cap"):Show();
		end
	else if (argT[1]) == "lock" then
		if tonumber(argT[2]) > 0 then
			getglobal("EasyBarButton"..argT[2].."Cap"):Hide();
		end
	end
	local argT = {};
	gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
	if (argT[1]) == "hide" then
		if tonumber(argT[2]) > 0 then
			getglobal("EasyBarButton"..argT[2]):Hide();
		end
	else if (argT[1]) == "display" then
		if tonumber(argT[2]) > 0 then
			getglobal("EasyBarButton"..argT[2]):Show();
		end
	end
	local argT = {};
	gsub(msg, "(%S+)", function(w) tinsert(argT, w) end)
	if (argT[1]) == "scale" then
		if tonumber(argT[2]) > 0 then
			getglobal("EasyBarButton"..argT[2]):SetScale(argT[3]);
		end
	end
end
end
end	

SLASH_ColonelBarCOMMAND1 = "/eb"
SLASH_ColonelBarCOMMAND2 = "/easybar"
  Reply With Quote
12-14-06, 08:21 AM   #2
Kiphere
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 17
I guess I could post some info lol.

I posted the code above for Widger who I was talkin to in IRC.

I'm tryin to figure out the most effecient way to input my saved variables in that mod to record button location, hide/show status, and scale. I'm a Lua Newb so he/she (sorry, dunno your gender ) offered to help.

Sorry I've been spamming your forums with my newby rambling, I'm just hot and heavy in the learning phase now and when I start something like this I get a little... into it.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Full code for Widger.


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off