interim commit to get something up on svn, totally untested and definitely not working drycode
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
--[[ $Id: Bartender3.lua 49922 2007-09-26 20:15:15Z nevcairiel $ ]]
|
||||
|
||||
local BT4ActionBars = Bartender4:NewModule("ActionBars")
|
||||
|
||||
local Bar = Bartender4.Bar
|
||||
local ActionBar = setmetatable({}, {__index = Bar})
|
||||
|
||||
local ActionBar_MT = {__index = ActionBar}
|
||||
|
||||
local actionbars = {}
|
||||
function BT4ActionBars:OnInitialize()
|
||||
for i=1,10 do
|
||||
actionbars[i] = ActionBar:Create(i)
|
||||
end
|
||||
end
|
||||
|
||||
function ActionBar:Create(id)
|
||||
local bar = setmetatable(Bar:Create(id, "SecureStateDriverTemplate"), ActionBar_MT)
|
||||
end
|
||||
@@ -0,0 +1,108 @@
|
||||
--[[
|
||||
Generic Bar Frame Template
|
||||
]]
|
||||
|
||||
--[[ $Id$ ]]
|
||||
|
||||
local Bar = CreateFrame("Frame")
|
||||
local Bar_MT = {__index = Bar}
|
||||
|
||||
local function createOptions(id)
|
||||
|
||||
end
|
||||
|
||||
Bartender4.Bar = {}
|
||||
function Bartender4.Bar:Create(id, template)
|
||||
local bar = setmetatable(CreateFrame("Frame", ("BT4Bar%s"):format(id), UIParent, template), Bar_MT)
|
||||
|
||||
bar:EnableMouse(false)
|
||||
bar:SetMovable(true)
|
||||
bar:RegisterForDrag("LeftButton")
|
||||
bar:RegisterForClicks("RightButtonDown", "LeftButtonUp")
|
||||
bar:SetBackdrop({
|
||||
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
|
||||
tile = true,
|
||||
tileSize = 16,
|
||||
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
|
||||
edgeSize = 16,
|
||||
insets = {left = 5, right = 3, top = 3, bottom = 5}
|
||||
})
|
||||
bar:SetBackdropColor(0, 0, 0, 0)
|
||||
bar:SetBackdropBorderColor(0.5, 0.5, 0, 0)
|
||||
bar.Text = frame:CreateFontString(nil, "ARTWORK")
|
||||
bar.Text:SetFontObject(GameFontNormal)
|
||||
bar.Text:SetText("Bar "..id)
|
||||
bar.Text:Hide()
|
||||
bar.Text:ClearAllPoints()
|
||||
bar.Text:SetPoint("CENTER", bar, "CENTER")
|
||||
|
||||
bar.options = createOptions(id)
|
||||
|
||||
return bar
|
||||
end
|
||||
|
||||
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop
|
||||
do
|
||||
function barOnEnter(self)
|
||||
self:SetBackdropBorderColor(0.5, 0.5, 0, 1)
|
||||
end
|
||||
|
||||
function barOnLeave(self)
|
||||
self:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
function barOnDragStart(self)
|
||||
self:StartMoving()
|
||||
self:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
function barOnDragStop(self)
|
||||
self:StopMovingOrSizing()
|
||||
self:SavePosition()
|
||||
end
|
||||
end
|
||||
|
||||
function Bar:Unlock()
|
||||
self:EnableMouse(true)
|
||||
self:SetScript("OnEnter", barOnEnter)
|
||||
self:SetScript("OnLeave", barOnLeave)
|
||||
self:SetScript("OnDragStart", barOnDragStart)
|
||||
self:SetScript("OnDragStop", barOnDragStop)
|
||||
self:SetScript("OnClick", nil)
|
||||
self.Text:Show()
|
||||
|
||||
self:SetFrameLevel(5)
|
||||
if self.config.Hide then
|
||||
self:SetBackdropColor(1, 0, 0, 0.5)
|
||||
else
|
||||
self:SetBackdropColor(0, 1, 0, 0.5)
|
||||
end
|
||||
end
|
||||
|
||||
function Bar:Lock()
|
||||
self:EnableMouse(false)
|
||||
self:SetScript("OnEnter", nil)
|
||||
self:SetScript("OnLeave", nil)
|
||||
self:SetScript("OnDragStart", nil)
|
||||
self:SetScript("OnDragStop", nil)
|
||||
self:SetScript("OnClick", nil)
|
||||
self.Text:Hide()
|
||||
|
||||
self:SetBackdropColor(0, 0, 0, 0)
|
||||
self:SetBackdropBorderColor(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
function Bar:LoadPosition()
|
||||
local x, y, s = self.config.PosX, self.config.PosY, self:GetEffectiveScale()
|
||||
x, y = x/s, y/s
|
||||
self:ClearAllPoints()
|
||||
self:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x, y)
|
||||
end
|
||||
|
||||
function Bar:SavePosition()
|
||||
local x, y = self:GetLeft(), self:GetBottom()
|
||||
local s = self:GetEffectiveScale()
|
||||
x, y = x*s, y*s
|
||||
self.config.PosX = x
|
||||
self.config.PosY = y
|
||||
end
|
||||
@@ -0,0 +1,6 @@
|
||||
--[[ $Id$ ]]
|
||||
Bartender4 = LibStub("AceAddon-3.0"):NewAddon("Bartender4", "AceConsole-3.0", "AceEvent-3.0")
|
||||
|
||||
function Bartender4:OnInitialize()
|
||||
self.db = LibStub("AceDB-3.0"):New("Bartender4DB")
|
||||
end
|
||||
|
||||
+2
-1
@@ -3,8 +3,9 @@
|
||||
## Title: Bartender4
|
||||
## Author: Nevcairiel
|
||||
## SavedVariables: Bartender4DB
|
||||
## OptionalDeps: Ace3
|
||||
## X-Category: Action Bars
|
||||
## X-License: BSD
|
||||
## Version: 4.0
|
||||
|
||||
Bartender4.lua
|
||||
Bartender4.lua
|
||||
|
||||
Reference in New Issue
Block a user