refactoring, removed special dropdown look for now (for compatibility reasons with addons that change the default dropdown

This commit is contained in:
Manuel Simon Hirsig
2016-12-09 19:08:46 +01:00
parent 9bcfe6bbc4
commit aba0717cfa
2 changed files with 83 additions and 75 deletions
+75 -75
View File
@@ -5,86 +5,86 @@ include 'aux'
M.font = [[Fonts\ARIALN.TTF]]
M.font_size = {
M.font_size = immutable-{
small = 13,
medium = 15,
large = 18,
}
function LOAD()
do
local blizzard_backdrop, aux_background, aux_border
aux_border = DropDownList1:CreateTexture()
aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
aux_border:SetBlendMode('ADD')
aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop)
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
hook('ToggleDropDownMenu', function(...)
temp(arg)
local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
local dropdown = _G[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
set_aux_dropdown_style(dropdown)
else
set_blizzard_dropdown_style()
end
return unpack(ret)
end)
function set_aux_dropdown_style(dropdown)
DropDownList1Backdrop:SetBackdrop(empty)
aux_border:Show()
aux_background:Show()
DropDownList1:SetWidth(dropdown:GetWidth() * .9)
DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
DropDownList1:ClearAllPoints()
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button' .. i]
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString()
text:SetFont(font, 14)
text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
highlight:ClearAllPoints()
highlight:SetDrawLayer('OVERLAY')
highlight:SetHeight(14)
highlight:SetPoint('LEFT', 5, 0)
highlight:SetPoint('RIGHT', -3, 0)
local check = _G['DropDownList1Button' .. i .. 'Check']
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint('LEFT', 3, -1)
end
end
function set_blizzard_dropdown_style()
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
aux_border:Hide()
aux_background:Hide()
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button' .. i]
local text = button:GetFontString()
text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
text:SetShadowOffset(1, -1)
local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
highlight:SetAllPoints()
highlight:SetDrawLayer('BACKGROUND')
local check = _G['DropDownList1Button' .. i .. 'Check']
check:SetWidth(24)
check:SetHeight(24)
check:SetPoint('LEFT', 0, 0)
end
end
end
end
--function LOAD()
-- do
-- local blizzard_backdrop, aux_background, aux_border
--
-- aux_border = DropDownList1:CreateTexture()
-- aux_border:SetTexture(1, 1, 1, .02)
-- aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
-- aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
-- aux_border:SetBlendMode('ADD')
-- aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
-- aux_background:SetTexture(color.content.background())
-- aux_background:SetAllPoints(DropDownList1Backdrop)
-- blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
-- hook('ToggleDropDownMenu', function(...)
-- temp(arg)
-- local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
-- local dropdown = _G[arg[4] or ''] or this:GetParent()
-- if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
-- set_aux_dropdown_style(dropdown)
-- else
-- set_blizzard_dropdown_style()
-- end
-- return unpack(ret)
-- end)
--
-- function set_aux_dropdown_style(dropdown)
-- DropDownList1Backdrop:SetBackdrop(empty)
-- aux_border:Show()
-- aux_background:Show()
-- DropDownList1:SetWidth(dropdown:GetWidth() * .9)
-- DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
-- DropDownList1:ClearAllPoints()
-- DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
-- for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
-- local button = _G['DropDownList1Button' .. i]
-- button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
-- button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
-- local text = button:GetFontString()
-- text:SetFont(font, 14)
-- text:SetPoint('TOPLEFT', 18, 0)
-- text:SetPoint('BOTTOMRIGHT', -8, 0)
-- local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
-- highlight:ClearAllPoints()
-- highlight:SetDrawLayer('OVERLAY')
-- highlight:SetHeight(14)
-- highlight:SetPoint('LEFT', 5, 0)
-- highlight:SetPoint('RIGHT', -3, 0)
-- local check = _G['DropDownList1Button' .. i .. 'Check']
-- check:SetWidth(16)
-- check:SetHeight(16)
-- check:SetPoint('LEFT', 3, -1)
-- end
-- end
--
-- function set_blizzard_dropdown_style()
-- DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
-- aux_border:Hide()
-- aux_background:Hide()
-- for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
-- local button = _G['DropDownList1Button' .. i]
-- local text = button:GetFontString()
-- text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
-- text:SetShadowOffset(1, -1)
-- local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
-- highlight:SetAllPoints()
-- highlight:SetDrawLayer('BACKGROUND')
-- local check = _G['DropDownList1Button' .. i .. 'Check']
-- check:SetWidth(24)
-- check:SetHeight(24)
-- check:SetPoint('LEFT', 0, 0)
-- end
-- end
-- end
--end
do
local id = 1
+8
View File
@@ -12,6 +12,14 @@ do
end
end
M.immutable = setmetatable(T, {
__metatable = false,
__newindex = nop,
__sub = function(_, t)
return setmetatable(T, O('__metatable', false, '__newindex', nop, '__index', t))
end
})
M.select = vararg-function(arg)
for _ = 1, arg[1] do
tremove(arg, 1)