Add Blizzard theme
Due to how aux loads its frames, the theme currently cannot be toggleable in-game and must be toggled by changing USE_BLIZZARD_THEME in aux-addon.lua
This commit is contained in:
+289
-105
@@ -107,15 +107,39 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function M.is_blizzard()
|
||||
return aux.USE_BLIZZARD_THEME
|
||||
end
|
||||
|
||||
function M.set_size(frame, width, height)
|
||||
frame:SetWidth(width)
|
||||
frame:SetHeight(height or width)
|
||||
end
|
||||
|
||||
function M.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom)
|
||||
frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
|
||||
frame:SetBackdropColor(backdrop_color())
|
||||
frame:SetBackdropBorderColor(border_color())
|
||||
if not is_blizzard() then
|
||||
frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
|
||||
frame:SetBackdropColor(backdrop_color())
|
||||
frame:SetBackdropBorderColor(border_color())
|
||||
else
|
||||
frame:SetBackdrop({
|
||||
bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
|
||||
edgeSize = 11,
|
||||
tile = true
|
||||
})
|
||||
frame:SetBackdropColor(0.09, 0.09, 0.19)
|
||||
|
||||
local border = CreateFrame('Frame', nil, frame)
|
||||
border:SetPoint('TOPLEFT', frame, 'TOPLEFT', -3, 3)
|
||||
border:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 3, -3)
|
||||
border:SetBackdrop({
|
||||
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
||||
edgeSize = 11,
|
||||
tileSize = 11,
|
||||
tile = true
|
||||
})
|
||||
border:SetBackdropBorderColor(0.6, 0.6, 0.6)
|
||||
end
|
||||
end
|
||||
|
||||
function M.set_window_style(frame, left, right, top, bottom)
|
||||
@@ -130,6 +154,66 @@ function M.set_content_style(frame, left, right, top, bottom)
|
||||
set_frame_style(frame, aux.color.content.background, aux.color.content.border, left, right, top, bottom)
|
||||
end
|
||||
|
||||
function M.set_scrollbar_style(scrollFrame, points)
|
||||
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
|
||||
|
||||
scrollBar:ClearAllPoints()
|
||||
for _, pt in ipairs(points) do
|
||||
scrollBar:SetPoint(unpack(pt))
|
||||
end
|
||||
|
||||
if not is_blizzard() then
|
||||
scrollBar:SetWidth(10)
|
||||
local thumbTex = scrollBar:GetThumbTexture()
|
||||
thumbTex:SetPoint('CENTER', 0, 0)
|
||||
thumbTex:SetTexture(aux.color.content.background())
|
||||
thumbTex:SetHeight(150)
|
||||
thumbTex:SetWidth(scrollBar:GetWidth())
|
||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||
else
|
||||
-- A hacky dynamicly sized scrollbar background
|
||||
|
||||
local scrollUpButton = _G[scrollBar:GetName() .. 'ScrollUpButton']
|
||||
local scrollDownButton = _G[scrollBar:GetName() .. 'ScrollDownButton']
|
||||
|
||||
local backgroundTop = scrollFrame:CreateTexture(nil, 'BACKGROUND')
|
||||
backgroundTop:SetTexture([[Interface\PaperDollInfoFrame\UI-Character-ScrollBar]])
|
||||
backgroundTop:SetWidth(31)
|
||||
backgroundTop:SetHeight(128)
|
||||
backgroundTop:SetPoint('BOTTOM', scrollUpButton, 'TOP', 0, -128 + 4)
|
||||
backgroundTop:SetTexCoord(0, 0.484375, 0, 0.5)
|
||||
|
||||
local backgroundBottom = scrollFrame:CreateTexture(nil, 'BACKGROUND')
|
||||
backgroundBottom:SetTexture([[Interface\PaperDollInfoFrame\UI-Character-ScrollBar]])
|
||||
backgroundBottom:SetWidth(31)
|
||||
backgroundBottom:SetHeight(106)
|
||||
backgroundBottom:SetPoint('TOP', scrollDownButton, 'BOTTOM', 0, 106 - 2)
|
||||
backgroundBottom:SetTexCoord(0.515625, 1.0, 0, 0.4140625)
|
||||
|
||||
local backgroundMiddle = scrollFrame:CreateTexture(nil, 'BACKGROUND')
|
||||
backgroundMiddle:SetTexture([[Interface\PaperDollInfoFrame\UI-Character-ScrollBar]])
|
||||
backgroundMiddle:SetWidth(31)
|
||||
backgroundMiddle:SetPoint('TOP', backgroundTop, 'BOTTOM', 0, 0)
|
||||
backgroundMiddle:SetTexCoord(0, 0.484375, 0.125, 0.875)
|
||||
backgroundMiddle:Hide()
|
||||
|
||||
scrollBar:SetScript('OnSizeChanged', function()
|
||||
-- Scrollbar height value is scaled, but the button heights aren't..
|
||||
local missingSpace = (scrollBar:GetHeight() / scrollBar:GetEffectiveScale()) +
|
||||
scrollUpButton:GetHeight() + scrollDownButton:GetHeight() + 10 -
|
||||
(backgroundTop:GetHeight() + backgroundBottom:GetHeight())
|
||||
if missingSpace > 0 then
|
||||
backgroundMiddle:SetHeight(missingSpace)
|
||||
backgroundMiddle:SetTexCoord(0, 0.484375, 0.125, 0.125 + (missingSpace / 256))
|
||||
backgroundMiddle:Show()
|
||||
else
|
||||
backgroundMiddle:Hide()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function M.panel(parent)
|
||||
local panel = CreateFrame('Frame', nil, parent)
|
||||
set_panel_style(panel)
|
||||
@@ -139,13 +223,19 @@ end
|
||||
function M.checkbutton(parent, text_height)
|
||||
local button = button(parent, text_height)
|
||||
button.state = false
|
||||
button:SetBackdropColor(aux.color.state.disabled())
|
||||
if not is_blizzard() then
|
||||
button:SetBackdropColor(aux.color.state.disabled())
|
||||
end
|
||||
function button:SetChecked(state)
|
||||
if state then
|
||||
self:SetBackdropColor(aux.color.state.enabled())
|
||||
if not is_blizzard() then
|
||||
self:SetBackdropColor(aux.color.state.enabled())
|
||||
end
|
||||
self.state = true
|
||||
else
|
||||
self:SetBackdropColor(aux.color.state.disabled())
|
||||
if not is_blizzard() then
|
||||
self:SetBackdropColor(aux.color.state.disabled())
|
||||
end
|
||||
self.state = false
|
||||
end
|
||||
end
|
||||
@@ -157,32 +247,56 @@ end
|
||||
|
||||
function M.button(parent, text_height)
|
||||
text_height = text_height or font_size.large
|
||||
local button = CreateFrame('Button', nil, parent)
|
||||
local button = CreateFrame('Button', unique_name(), parent, is_blizzard() and "UIPanelButtonTemplate2" or nil)
|
||||
set_size(button, 80, 24)
|
||||
set_content_style(button)
|
||||
local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetTexture(1, 1, 1, .2)
|
||||
button.highlight = highlight
|
||||
do
|
||||
local label = button:CreateFontString()
|
||||
label:SetFont(font, text_height)
|
||||
label:SetAllPoints(button)
|
||||
label:SetJustifyH('CENTER')
|
||||
label:SetJustifyV('CENTER')
|
||||
label:SetTextColor(aux.color.text.enabled())
|
||||
button:SetFontString(label)
|
||||
|
||||
if not is_blizzard() then
|
||||
set_content_style(button)
|
||||
local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetTexture(1, 1, 1, .2)
|
||||
button.highlight = highlight
|
||||
do
|
||||
local label = button:CreateFontString()
|
||||
label:SetFont(font, text_height)
|
||||
label:SetAllPoints(button)
|
||||
label:SetJustifyH('CENTER')
|
||||
label:SetJustifyV('CENTER')
|
||||
label:SetTextColor(aux.color.text.enabled())
|
||||
button:SetFontString(label)
|
||||
end
|
||||
end
|
||||
|
||||
local buttonParts = is_blizzard() and {_G[button:GetName() .. "Left"],
|
||||
_G[button:GetName() .. "Middle"], _G[button:GetName() .. "Right"]}
|
||||
-- Shenanigans to make UIPanelButtonTemplate2 use the disabled texture when disabled
|
||||
local realSetTexture = is_blizzard() and buttonParts[1].SetTexture
|
||||
local textureLock = function() end
|
||||
|
||||
button.default_Enable = button.Enable
|
||||
function button:Enable()
|
||||
if self:IsEnabled() == 1 then return end
|
||||
self:GetFontString():SetTextColor(aux.color.text.enabled())
|
||||
if not is_blizzard() then
|
||||
self:GetFontString():SetTextColor(aux.color.text.enabled())
|
||||
else
|
||||
for _, part in ipairs(buttonParts) do
|
||||
part.SetTexture = realSetTexture
|
||||
part:SetTexture([[Interface\Buttons\UI-Panel-Button-Up]])
|
||||
end
|
||||
end
|
||||
return self:default_Enable()
|
||||
end
|
||||
button.default_Disable = button.Disable
|
||||
function button:Disable()
|
||||
if self:IsEnabled() == 0 then return end
|
||||
self:GetFontString():SetTextColor(aux.color.text.disabled())
|
||||
if not is_blizzard() then
|
||||
self:GetFontString():SetTextColor(aux.color.text.disabled())
|
||||
else
|
||||
for _, part in ipairs(buttonParts) do
|
||||
part:SetTexture([[Interface\Buttons\UI-Panel-Button-Disabled]])
|
||||
part.SetTexture = textureLock
|
||||
end
|
||||
end
|
||||
return self:default_Disable()
|
||||
end
|
||||
|
||||
@@ -194,33 +308,38 @@ do
|
||||
function mt.__index:create_tab(text)
|
||||
local id = getn(self._tabs) + 1
|
||||
|
||||
local tab = CreateFrame('Button', unique_name(), self._frame)
|
||||
local tab = CreateFrame('Button', "$parentTab"..id, self._frame, is_blizzard() and "CharacterFrameTabButtonTemplate" or nil)
|
||||
tab.id = id
|
||||
tab.group = self
|
||||
tab:SetHeight(24)
|
||||
set_panel_style(tab)
|
||||
local dock = tab:CreateTexture(nil, 'OVERLAY')
|
||||
dock:SetHeight(3)
|
||||
if self._orientation == 'UP' then
|
||||
dock:SetPoint('BOTTOMLEFT', 1, -1)
|
||||
dock:SetPoint('BOTTOMRIGHT', -1, -1)
|
||||
elseif self._orientation == 'DOWN' then
|
||||
dock:SetPoint('TOPLEFT', 1, 1)
|
||||
dock:SetPoint('TOPRIGHT', -1, 1)
|
||||
end
|
||||
dock:SetTexture(aux.color.panel.background())
|
||||
tab.dock = dock
|
||||
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetTexture(1, 1, 1, .2)
|
||||
tab.highlight = highlight
|
||||
|
||||
tab.text = tab:CreateFontString()
|
||||
tab.text:SetAllPoints()
|
||||
tab.text:SetJustifyH('CENTER')
|
||||
tab.text:SetJustifyV('CENTER')
|
||||
tab.text:SetFont(font, font_size.large)
|
||||
tab:SetFontString(tab.text)
|
||||
if not is_blizzard() then
|
||||
tab:SetHeight(24)
|
||||
set_panel_style(tab)
|
||||
local dock = tab:CreateTexture(nil, 'OVERLAY')
|
||||
dock:SetHeight(3)
|
||||
if self._orientation == 'UP' then
|
||||
dock:SetPoint('BOTTOMLEFT', 1, -1)
|
||||
dock:SetPoint('BOTTOMRIGHT', -1, -1)
|
||||
elseif self._orientation == 'DOWN' then
|
||||
dock:SetPoint('TOPLEFT', 1, 1)
|
||||
dock:SetPoint('TOPRIGHT', -1, 1)
|
||||
end
|
||||
dock:SetTexture(aux.color.panel.background())
|
||||
tab.dock = dock
|
||||
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetTexture(1, 1, 1, .2)
|
||||
tab.highlight = highlight
|
||||
|
||||
tab.text = tab:CreateFontString()
|
||||
tab.text:SetAllPoints()
|
||||
tab.text:SetJustifyH('CENTER')
|
||||
tab.text:SetJustifyV('CENTER')
|
||||
tab.text:SetFont(font, font_size.large)
|
||||
tab:SetFontString(tab.text)
|
||||
else
|
||||
tab:RegisterForClicks("LeftButtonUp")
|
||||
end
|
||||
|
||||
tab:SetText(text)
|
||||
|
||||
@@ -228,48 +347,63 @@ do
|
||||
if this.id ~= this.group.selected then
|
||||
PlaySound('igCharacterInfoTab')
|
||||
this.group:select(this.id)
|
||||
if is_blizzard() then
|
||||
PanelTemplates_SetTab(self._frame, this.id)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
if getn(self._tabs) == 0 then
|
||||
if self._orientation == 'UP' then
|
||||
tab:SetPoint('BOTTOMLEFT', self._frame, 'TOPLEFT', 4, -1)
|
||||
tab:SetPoint('BOTTOMLEFT', self._frame, 'TOPLEFT', 4, is_blizzard() and -8 or -1)
|
||||
elseif self._orientation == 'DOWN' then
|
||||
tab:SetPoint('TOPLEFT', self._frame, 'BOTTOMLEFT', 4, 1)
|
||||
end
|
||||
tab:SetPoint('TOPLEFT', self._frame, 'BOTTOMLEFT', 4, is_blizzard() and -8 or 1)
|
||||
end
|
||||
else
|
||||
if self._orientation == 'UP' then
|
||||
tab:SetPoint('BOTTOMLEFT', self._tabs[getn(self._tabs)], 'BOTTOMRIGHT', 4, 0)
|
||||
tab:SetPoint('BOTTOMLEFT', self._tabs[getn(self._tabs)], 'BOTTOMRIGHT', is_blizzard() and 0 or 4, 0)
|
||||
elseif self._orientation == 'DOWN' then
|
||||
tab:SetPoint('TOPLEFT', self._tabs[getn(self._tabs)], 'TOPRIGHT', 4, 0)
|
||||
tab:SetPoint('TOPLEFT', self._tabs[getn(self._tabs)], 'TOPRIGHT', is_blizzard() and 0 or 4, 0)
|
||||
end
|
||||
end
|
||||
|
||||
tab:SetWidth(tab:GetFontString():GetStringWidth() + 14)
|
||||
if not is_blizzard() then
|
||||
tab:SetWidth(tab:GetFontString():GetStringWidth() + 14)
|
||||
end
|
||||
|
||||
tinsert(self._tabs, tab)
|
||||
|
||||
if is_blizzard() then
|
||||
PanelTemplates_SetNumTabs(self._frame, getn(self._tabs))
|
||||
PanelTemplates_SetTab(self._frame, 1)
|
||||
end
|
||||
end
|
||||
function mt.__index:select(id)
|
||||
self._selected = id
|
||||
self:update()
|
||||
if is_blizzard() then
|
||||
PanelTemplates_SetTab(self._frame, id)
|
||||
end
|
||||
do (self._on_select or pass)(id) end
|
||||
end
|
||||
function mt.__index:update()
|
||||
for _, tab in self._tabs do
|
||||
if tab.group._selected == tab.id then
|
||||
tab.text:SetTextColor(aux.color.label.enabled())
|
||||
tab:Disable()
|
||||
tab:SetBackdropColor(aux.color.panel.background())
|
||||
tab.dock:Show()
|
||||
tab:SetHeight(29)
|
||||
else
|
||||
tab.text:SetTextColor(aux.color.text.enabled())
|
||||
tab:Enable()
|
||||
tab:SetBackdropColor(aux.color.content.background())
|
||||
tab.dock:Hide()
|
||||
tab:SetHeight(24)
|
||||
end
|
||||
end
|
||||
if not is_blizzard() then
|
||||
for _, tab in self._tabs do
|
||||
if tab.group._selected == tab.id then
|
||||
tab.text:SetTextColor(aux.color.label.enabled())
|
||||
tab:Disable()
|
||||
tab:SetBackdropColor(aux.color.panel.background())
|
||||
tab.dock:Show()
|
||||
tab:SetHeight(29)
|
||||
else
|
||||
tab.text:SetTextColor(aux.color.text.enabled())
|
||||
tab:Enable()
|
||||
tab:SetBackdropColor(aux.color.content.background())
|
||||
tab.dock:Hide()
|
||||
tab:SetHeight(24)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function M.tabs(parent, orientation)
|
||||
local self = {
|
||||
@@ -282,13 +416,15 @@ do
|
||||
end
|
||||
|
||||
function M.editbox(parent)
|
||||
local editbox = CreateFrame('EditBox', nil, parent)
|
||||
local editbox = CreateFrame('EditBox', unique_name(), parent, is_blizzard() and "InputBoxTemplate" or nil)
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetTextInsets(1.5, 1.5, 3, 3)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetHeight(24)
|
||||
editbox:SetTextColor(0, 0, 0, 0)
|
||||
set_content_style(editbox)
|
||||
if not is_blizzard() then
|
||||
set_content_style(editbox)
|
||||
end
|
||||
editbox:SetScript('OnEscapePressed', function()
|
||||
this:ClearFocus()
|
||||
do (this.escape or pass)() end
|
||||
@@ -375,8 +511,11 @@ do
|
||||
status_bar:SetOrientation('HORIZONTAL')
|
||||
status_bar:SetMinMaxValues(0, 1)
|
||||
status_bar:SetAllPoints()
|
||||
status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]])
|
||||
status_bar:SetStatusBarColor(.42, .42, .42, .7)
|
||||
status_bar:SetStatusBarTexture(is_blizzard() and [[Interface\Glues\LoadingBar\Loading-BarFill]] or
|
||||
[[Interface\Buttons\WHITE8X8]])
|
||||
if not is_blizzard() then
|
||||
status_bar:SetStatusBarColor(.42, .42, .42, 1)
|
||||
end
|
||||
status_bar:SetFrameLevel(level + 2)
|
||||
status_bar:SetScript('OnUpdate', update_bar)
|
||||
self.secondary_status_bar = status_bar
|
||||
@@ -386,8 +525,11 @@ do
|
||||
status_bar:SetOrientation('HORIZONTAL')
|
||||
status_bar:SetMinMaxValues(0, 1)
|
||||
status_bar:SetAllPoints()
|
||||
status_bar:SetStatusBarTexture([[Interface\Buttons\WHITE8X8]])
|
||||
status_bar:SetStatusBarColor(.19, .22, .33, .9)
|
||||
status_bar:SetStatusBarTexture(is_blizzard() and [[Interface\Glues\LoadingBar\Loading-BarFill]] or
|
||||
[[Interface\Buttons\WHITE8X8]])
|
||||
if not is_blizzard() then
|
||||
status_bar:SetStatusBarColor(.19, .22, .33, 1)
|
||||
end
|
||||
status_bar:SetFrameLevel(level + 3)
|
||||
status_bar:SetScript('OnUpdate', update_bar)
|
||||
self.primary_status_bar = status_bar
|
||||
@@ -401,6 +543,17 @@ do
|
||||
text:SetPoint('CENTER', 0, 0)
|
||||
self.text = text
|
||||
end
|
||||
|
||||
if is_blizzard() then
|
||||
local statusBarBorder = CreateFrame("Frame", nil, self)
|
||||
statusBarBorder:SetPoint("TOPLEFT", self, "TOPLEFT", -4, 4)
|
||||
statusBarBorder:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 4, -4)
|
||||
|
||||
statusBarBorder:SetFrameLevel(level + 5)
|
||||
statusBarBorder:SetBackdrop({edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border", edgeSize = 20,
|
||||
tile = true, tileSize = 20})
|
||||
end
|
||||
|
||||
function self:update_status(primary_status, secondary_status)
|
||||
if primary_status then
|
||||
self.primary_status_bar:SetValue(primary_status)
|
||||
@@ -470,44 +623,72 @@ end
|
||||
|
||||
function M.dropdown(parent)
|
||||
local dropdown = CreateFrame('Frame', unique_name(), parent, 'UIDropDownMenuTemplate')
|
||||
set_content_style(dropdown, 0, 0, 4, 4)
|
||||
|
||||
_G[dropdown:GetName() .. 'Left']:Hide()
|
||||
_G[dropdown:GetName() .. 'Middle']:Hide()
|
||||
_G[dropdown:GetName() .. 'Right']:Hide()
|
||||
if not is_blizzard() then
|
||||
set_content_style(dropdown, 0, 0, 4, 4)
|
||||
|
||||
_G[dropdown:GetName() .. 'Left']:Hide()
|
||||
_G[dropdown:GetName() .. 'Middle']:Hide()
|
||||
_G[dropdown:GetName() .. 'Right']:Hide()
|
||||
else
|
||||
local left = _G[dropdown:GetName() .. 'Left']
|
||||
local a,b,c,d,e = left:GetPoint(1)
|
||||
left:ClearAllPoints()
|
||||
left:SetPoint(a,b,c, -20, e - 1)
|
||||
end
|
||||
|
||||
local dropdownSetWidth = dropdown.SetWidth
|
||||
dropdown.SetWidth = function(self, width)
|
||||
_G[dropdown:GetName() .. 'Middle']:SetWidth(width - 15)
|
||||
dropdownSetWidth(self, width)
|
||||
_G[dropdown:GetName() .. 'Text']:SetWidth(width - 25)
|
||||
dropdown.noResize = 1
|
||||
end
|
||||
|
||||
local button = _G[dropdown:GetName() .. 'Button']
|
||||
button:ClearAllPoints()
|
||||
button:SetScale(.9)
|
||||
button:SetPoint('RIGHT', dropdown, 0, 0)
|
||||
dropdown.button = button
|
||||
|
||||
local text = _G[dropdown:GetName() .. 'Text']
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
|
||||
text:SetPoint('LEFT', 8, 0)
|
||||
text:SetFont(font, font_size.medium)
|
||||
text:SetShadowColor(0, 0, 0, 0)
|
||||
if not is_blizzard() then
|
||||
button:ClearAllPoints()
|
||||
button:SetScale(.9)
|
||||
button:SetPoint('RIGHT', dropdown, 0, 0)
|
||||
|
||||
local text = _G[dropdown:GetName() .. 'Text']
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
|
||||
text:SetPoint('LEFT', 8, 0)
|
||||
text:SetFont(font, font_size.medium)
|
||||
text:SetShadowColor(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
return dropdown
|
||||
end
|
||||
|
||||
function M.slider(parent)
|
||||
|
||||
local slider = CreateFrame('Slider', nil, parent)
|
||||
local slider = CreateFrame('Slider', unique_name(), parent, is_blizzard() and "OptionsSliderTemplate" or nil)
|
||||
slider:SetOrientation('HORIZONTAL')
|
||||
slider:SetHeight(6)
|
||||
if not is_blizzard() then
|
||||
slider:SetHeight(6)
|
||||
end
|
||||
slider:SetHitRectInsets(0, 0, -12, -12)
|
||||
slider:SetValue(0)
|
||||
|
||||
set_panel_style(slider)
|
||||
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
|
||||
thumb_texture:SetPoint('CENTER', 0, 0)
|
||||
thumb_texture:SetTexture(aux.color.content.background())
|
||||
thumb_texture:SetHeight(18)
|
||||
thumb_texture:SetWidth(8)
|
||||
set_size(thumb_texture, 8, 18)
|
||||
slider:SetThumbTexture(thumb_texture)
|
||||
if not is_blizzard() then
|
||||
set_panel_style(slider)
|
||||
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
|
||||
thumb_texture:SetPoint('CENTER', 0, 0)
|
||||
thumb_texture:SetTexture(aux.color.content.background())
|
||||
thumb_texture:SetHeight(18)
|
||||
thumb_texture:SetWidth(8)
|
||||
set_size(thumb_texture, 8, 18)
|
||||
slider:SetThumbTexture(thumb_texture)
|
||||
else
|
||||
slider.low = _G[slider:GetName() .. 'Low']
|
||||
slider.low:SetText("")
|
||||
slider.high = _G[slider:GetName() .. 'High']
|
||||
slider.high:SetText("")
|
||||
end
|
||||
|
||||
local label = slider:CreateFontString(nil, 'OVERLAY')
|
||||
label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 8)
|
||||
@@ -530,15 +711,18 @@ end
|
||||
|
||||
function M.checkbox(parent)
|
||||
local checkbox = CreateFrame('CheckButton', nil, parent, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(16)
|
||||
checkbox:SetHeight(16)
|
||||
set_content_style(checkbox)
|
||||
checkbox:SetNormalTexture(nil)
|
||||
checkbox:SetPushedTexture(nil)
|
||||
checkbox:GetHighlightTexture():SetAllPoints()
|
||||
checkbox:GetHighlightTexture():SetTexture(1, 1, 1, .2)
|
||||
checkbox:GetCheckedTexture():SetTexCoord(.12, .88, .12, .88)
|
||||
checkbox:GetHighlightTexture('BLEND')
|
||||
local size = is_blizzard() and 24 or 16
|
||||
checkbox:SetWidth(size)
|
||||
checkbox:SetHeight(size)
|
||||
if not is_blizzard() then
|
||||
set_content_style(checkbox)
|
||||
checkbox:SetNormalTexture(nil)
|
||||
checkbox:SetPushedTexture(nil)
|
||||
checkbox:GetHighlightTexture():SetAllPoints()
|
||||
checkbox:GetHighlightTexture():SetTexture(1, 1, 1, .2)
|
||||
checkbox:GetCheckedTexture():SetTexCoord(.12, .88, .12, .88)
|
||||
checkbox:GetHighlightTexture('BLEND')
|
||||
end
|
||||
return checkbox
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user