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 = [[Fonts\ARIALN.TTF]]
M.font_size = { M.font_size = immutable-{
small = 13, small = 13,
medium = 15, medium = 15,
large = 18, large = 18,
} }
function LOAD() --function LOAD()
do -- do
local blizzard_backdrop, aux_background, aux_border -- local blizzard_backdrop, aux_background, aux_border
--
aux_border = DropDownList1:CreateTexture() -- aux_border = DropDownList1:CreateTexture()
aux_border:SetTexture(1, 1, 1, .02) -- aux_border:SetTexture(1, 1, 1, .02)
aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2) -- aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2)
aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5) -- aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5)
aux_border:SetBlendMode('ADD') -- aux_border:SetBlendMode('ADD')
aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY') -- aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY')
aux_background:SetTexture(color.content.background()) -- aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop) -- aux_background:SetAllPoints(DropDownList1Backdrop)
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop() -- blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
hook('ToggleDropDownMenu', function(...) -- hook('ToggleDropDownMenu', function(...)
temp(arg) -- temp(arg)
local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg))) -- local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
local dropdown = _G[arg[4] or ''] or this:GetParent() -- local dropdown = _G[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then -- if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
set_aux_dropdown_style(dropdown) -- set_aux_dropdown_style(dropdown)
else -- else
set_blizzard_dropdown_style() -- set_blizzard_dropdown_style()
end -- end
return unpack(ret) -- return unpack(ret)
end) -- end)
--
function set_aux_dropdown_style(dropdown) -- function set_aux_dropdown_style(dropdown)
DropDownList1Backdrop:SetBackdrop(empty) -- DropDownList1Backdrop:SetBackdrop(empty)
aux_border:Show() -- aux_border:Show()
aux_background:Show() -- aux_background:Show()
DropDownList1:SetWidth(dropdown:GetWidth() * .9) -- DropDownList1:SetWidth(dropdown:GetWidth() * .9)
DropDownList1:SetHeight(DropDownList1:GetHeight() - 10) -- DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
DropDownList1:ClearAllPoints() -- DropDownList1:ClearAllPoints()
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2) -- DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do -- for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button' .. i] -- local button = _G['DropDownList1Button' .. i]
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7) -- button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7) -- button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString() -- local text = button:GetFontString()
text:SetFont(font, 14) -- text:SetFont(font, 14)
text:SetPoint('TOPLEFT', 18, 0) -- text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0) -- text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = _G['DropDownList1Button' .. i .. 'Highlight'] -- local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
highlight:ClearAllPoints() -- highlight:ClearAllPoints()
highlight:SetDrawLayer('OVERLAY') -- highlight:SetDrawLayer('OVERLAY')
highlight:SetHeight(14) -- highlight:SetHeight(14)
highlight:SetPoint('LEFT', 5, 0) -- highlight:SetPoint('LEFT', 5, 0)
highlight:SetPoint('RIGHT', -3, 0) -- highlight:SetPoint('RIGHT', -3, 0)
local check = _G['DropDownList1Button' .. i .. 'Check'] -- local check = _G['DropDownList1Button' .. i .. 'Check']
check:SetWidth(16) -- check:SetWidth(16)
check:SetHeight(16) -- check:SetHeight(16)
check:SetPoint('LEFT', 3, -1) -- check:SetPoint('LEFT', 3, -1)
end -- end
end -- end
--
function set_blizzard_dropdown_style() -- function set_blizzard_dropdown_style()
DropDownList1Backdrop:SetBackdrop(blizzard_backdrop) -- DropDownList1Backdrop:SetBackdrop(blizzard_backdrop)
aux_border:Hide() -- aux_border:Hide()
aux_background:Hide() -- aux_background:Hide()
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do -- for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button' .. i] -- local button = _G['DropDownList1Button' .. i]
local text = button:GetFontString() -- local text = button:GetFontString()
text:SetFont([[Fonts\FRIZQT__.ttf]], 10) -- text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
text:SetShadowOffset(1, -1) -- text:SetShadowOffset(1, -1)
local highlight = _G['DropDownList1Button' .. i .. 'Highlight'] -- local highlight = _G['DropDownList1Button' .. i .. 'Highlight']
highlight:SetAllPoints() -- highlight:SetAllPoints()
highlight:SetDrawLayer('BACKGROUND') -- highlight:SetDrawLayer('BACKGROUND')
local check = _G['DropDownList1Button' .. i .. 'Check'] -- local check = _G['DropDownList1Button' .. i .. 'Check']
check:SetWidth(24) -- check:SetWidth(24)
check:SetHeight(24) -- check:SetHeight(24)
check:SetPoint('LEFT', 0, 0) -- check:SetPoint('LEFT', 0, 0)
end -- end
end -- end
end -- end
end --end
do do
local id = 1 local id = 1
+8
View File
@@ -12,6 +12,14 @@ do
end end
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) M.select = vararg-function(arg)
for _ = 1, arg[1] do for _ = 1, arg[1] do
tremove(arg, 1) tremove(arg, 1)