mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
Ace gui tab and mover
This commit is contained in:
@@ -239,7 +239,7 @@ function E:CreateMoverPopup()
|
|||||||
desc:SetText(L["DESC_MOVERCONFIG"])
|
desc:SetText(L["DESC_MOVERCONFIG"])
|
||||||
|
|
||||||
local snapping = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
|
local snapping = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
|
||||||
_G[snapping:GetName() .. "Text"]:SetText(L["Sticky Frames"])
|
_G[snapping:GetName().."Text"]:SetText(L["Sticky Frames"])
|
||||||
|
|
||||||
snapping:SetScript("OnShow", function()
|
snapping:SetScript("OnShow", function()
|
||||||
this:SetChecked(E.db.general.stickyFrames)
|
this:SetChecked(E.db.general.stickyFrames)
|
||||||
@@ -250,7 +250,7 @@ function E:CreateMoverPopup()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
local lock = CreateFrame("Button", f:GetName().."CloseButton", f, "OptionsButtonTemplate")
|
local lock = CreateFrame("Button", f:GetName().."CloseButton", f, "OptionsButtonTemplate")
|
||||||
_G[lock:GetName() .. "Text"]:SetText(L["Lock"])
|
_G[lock:GetName().."Text"]:SetText(L["Lock"])
|
||||||
|
|
||||||
lock:SetScript("OnClick", function()
|
lock:SetScript("OnClick", function()
|
||||||
E:ToggleConfigMode(true)
|
E:ToggleConfigMode(true)
|
||||||
@@ -269,7 +269,7 @@ function E:CreateMoverPopup()
|
|||||||
align:SetAutoFocus(false)
|
align:SetAutoFocus(false)
|
||||||
align:SetScript("OnEscapePressed", function()
|
align:SetScript("OnEscapePressed", function()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
align:SetScript("OnEnterPressed", function()
|
align:SetScript("OnEnterPressed", function()
|
||||||
local text = this:GetText()
|
local text = this:GetText()
|
||||||
@@ -283,14 +283,14 @@ function E:CreateMoverPopup()
|
|||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
end
|
end
|
||||||
E:Grid_Show()
|
E:Grid_Show()
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
align:SetScript("OnEditFocusLost", function()
|
align:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
end)
|
end)
|
||||||
align:SetScript("OnEditFocusGained", align.HighlightText)
|
align:SetScript("OnEditFocusGained", align.HighlightText)
|
||||||
align:SetScript("OnShow", function()
|
align:SetScript("OnShow", function()
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
this:SetText(E.db.gridSize)
|
this:SetText(E.db.gridSize)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ function E:CreateMoverPopup()
|
|||||||
xOffset.currentValue = 0
|
xOffset.currentValue = 0
|
||||||
xOffset:SetScript("OnEscapePressed", function()
|
xOffset:SetScript("OnEscapePressed", function()
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
xOffset:SetScript("OnEnterPressed", function()
|
xOffset:SetScript("OnEnterPressed", function()
|
||||||
local num = this:GetText()
|
local num = this:GetText()
|
||||||
@@ -366,14 +366,14 @@ function E:CreateMoverPopup()
|
|||||||
E:NudgeMover(diff)
|
E:NudgeMover(diff)
|
||||||
end
|
end
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
xOffset:SetScript("OnEditFocusLost", function()
|
xOffset:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
xOffset:SetScript("OnEditFocusGained", xOffset.HighlightText)
|
xOffset:SetScript("OnEditFocusGained", xOffset.HighlightText)
|
||||||
xOffset:SetScript("OnShow", function()
|
xOffset:SetScript("OnShow", function()
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
this:SetText(E:Round(xOffset.currentValue))
|
this:SetText(E:Round(xOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ function E:CreateMoverPopup()
|
|||||||
yOffset.currentValue = 0
|
yOffset.currentValue = 0
|
||||||
yOffset:SetScript("OnEscapePressed", function()
|
yOffset:SetScript("OnEscapePressed", function()
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
yOffset:SetScript("OnEnterPressed", function()
|
yOffset:SetScript("OnEnterPressed", function()
|
||||||
local num = this:GetText()
|
local num = this:GetText()
|
||||||
@@ -401,14 +401,14 @@ function E:CreateMoverPopup()
|
|||||||
E:NudgeMover(nil, diff)
|
E:NudgeMover(nil, diff)
|
||||||
end
|
end
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
end)
|
end)
|
||||||
yOffset:SetScript("OnEditFocusLost", function()
|
yOffset:SetScript("OnEditFocusLost", function()
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
yOffset:SetScript("OnEditFocusGained", yOffset.HighlightText)
|
yOffset:SetScript("OnEditFocusGained", yOffset.HighlightText)
|
||||||
yOffset:SetScript("OnShow", function()
|
yOffset:SetScript("OnShow", function()
|
||||||
EditBox_ClearFocus(this)
|
this:ClearFocus()
|
||||||
this:SetText(E:Round(yOffset.currentValue))
|
this:SetText(E:Round(yOffset.currentValue))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -24,19 +24,19 @@ local function GetPoint(obj)
|
|||||||
return format("%s,%s,%s,%d,%d", point, anchor:GetName(), secondaryPoint, E:Round(x), E:Round(y))
|
return format("%s,%s,%s,%d,%d", point, anchor:GetName(), secondaryPoint, E:Round(x), E:Round(y))
|
||||||
end
|
end
|
||||||
|
|
||||||
local function UpdateCoords()
|
local function UpdateCoords(self)
|
||||||
local mover = this.child
|
local mover = self.child;
|
||||||
local x, y, _, nudgePoint, nudgeInversePoint = E:CalculateMoverPoints(mover)
|
local x, y, _, nudgePoint, nudgeInversePoint = E:CalculateMoverPoints(mover);
|
||||||
|
|
||||||
local coordX, coordY = E:GetXYOffset(nudgeInversePoint, 1)
|
local coordX, coordY = E:GetXYOffset(nudgeInversePoint, 1);
|
||||||
ElvUIMoverNudgeWindow:ClearAllPoints()
|
ElvUIMoverNudgeWindow:ClearAllPoints();
|
||||||
ElvUIMoverNudgeWindow:SetPoint(nudgePoint, mover, nudgeInversePoint, coordX, coordY)
|
ElvUIMoverNudgeWindow:SetPoint(nudgePoint, mover, nudgeInversePoint, coordX, coordY);
|
||||||
E:UpdateNudgeFrame(mover, x, y)
|
E:UpdateNudgeFrame(mover, x, y);
|
||||||
end
|
end
|
||||||
|
|
||||||
local isDragging = false
|
local isDragging = false
|
||||||
local coordFrame = CreateFrame("Frame")
|
local coordFrame = CreateFrame("Frame")
|
||||||
coordFrame:SetScript("OnUpdate", UpdateCoords)
|
coordFrame:SetScript("OnUpdate", function() UpdateCoords(this) end)
|
||||||
coordFrame:Hide()
|
coordFrame:Hide()
|
||||||
|
|
||||||
local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, shouldDisable)
|
local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, shouldDisable)
|
||||||
@@ -164,7 +164,8 @@ local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, sh
|
|||||||
ElvUIMoverNudgeWindow:Show()
|
ElvUIMoverNudgeWindow:Show()
|
||||||
E.AssignFrameToNudge(this)
|
E.AssignFrameToNudge(this)
|
||||||
coordFrame.child = this
|
coordFrame.child = this
|
||||||
coordFrame:GetScript("OnUpdate")(coordFrame)
|
UpdateCoords(coordFrame)
|
||||||
|
--coordFrame:GetScript("OnUpdate")(coordFrame)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OnMouseDown(button)
|
local function OnMouseDown(button)
|
||||||
@@ -332,7 +333,7 @@ function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverT
|
|||||||
E.CreatedMovers[name]["text"] = text
|
E.CreatedMovers[name]["text"] = text
|
||||||
E.CreatedMovers[name]["overlay"] = overlay
|
E.CreatedMovers[name]["overlay"] = overlay
|
||||||
E.CreatedMovers[name]["postdrag"] = postdrag
|
E.CreatedMovers[name]["postdrag"] = postdrag
|
||||||
E.CreatedMovers[name]["snapoffset"] = snapOffset
|
E.CreatedMovers[name]["snapoffset"] = snapoffset
|
||||||
E.CreatedMovers[name]["point"] = GetPoint(parent)
|
E.CreatedMovers[name]["point"] = GetPoint(parent)
|
||||||
E.CreatedMovers[name]["shouldDisable"] = shouldDisable
|
E.CreatedMovers[name]["shouldDisable"] = shouldDisable
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,9 @@ local Callbacks = {["onplay"] = {}, ["onpause"] = {}, ["onresume"] = {}, ["onsto
|
|||||||
|
|
||||||
-- Update all current animations
|
-- Update all current animations
|
||||||
local AnimationOnUpdate = function()
|
local AnimationOnUpdate = function()
|
||||||
local elapsed = arg1
|
|
||||||
for i = 1, getn(this) do
|
for i = 1, getn(this) do
|
||||||
if this[i] then -- Double check the the index still exists, due to pauses/stops removing them on the fly
|
if this[i] then -- Double check the the index still exists, due to pauses/stops removing them on the fly
|
||||||
this[i]:Update(elapsed, i)
|
this[i]:Update(arg1, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ local ToggleDropDownMenu = ToggleDropDownMenu
|
|||||||
local Minimap_OnClick = Minimap_OnClick
|
local Minimap_OnClick = Minimap_OnClick
|
||||||
local GetMinimapZoneText = GetMinimapZoneText
|
local GetMinimapZoneText = GetMinimapZoneText
|
||||||
|
|
||||||
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", E.UIParent, "UIDropDownMenuTemplate")
|
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
|
||||||
local menuList = {
|
local menuList = {
|
||||||
{text = "CHARACTER_BUTTON",
|
{text = "CHARACTER_BUTTON",
|
||||||
func = function() ToggleCharacter("PaperDollFrame") end},
|
func = function() ToggleCharacter("PaperDollFrame") end},
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ function S:SkinAce3()
|
|||||||
if TYPE == "ScrollFrame" then
|
if TYPE == "ScrollFrame" then
|
||||||
local frame = widget.scrollbar
|
local frame = widget.scrollbar
|
||||||
SkinScrollBar(frame)
|
SkinScrollBar(frame)
|
||||||
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
|
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup-ElvUI" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
|
||||||
local frame = widget.content:GetParent()
|
local frame = widget.content:GetParent()
|
||||||
if TYPE == "Frame" then
|
if TYPE == "Frame" then
|
||||||
E:StripTextures(frame)
|
E:StripTextures(frame)
|
||||||
@@ -379,7 +379,7 @@ function S:SkinAce3()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if TYPE == "TabGroup" then
|
if TYPE == "TabGroup-ElvUI" then
|
||||||
local oldCreateTab = widget.CreateTab
|
local oldCreateTab = widget.CreateTab
|
||||||
widget.CreateTab = function(self, id)
|
widget.CreateTab = function(self, id)
|
||||||
local tab = oldCreateTab(self, id)
|
local tab = oldCreateTab(self, id)
|
||||||
|
|||||||
@@ -9,4 +9,7 @@
|
|||||||
Libraries\Load_Libraries.xml
|
Libraries\Load_Libraries.xml
|
||||||
locales\load_locales.xml
|
locales\load_locales.xml
|
||||||
core.lua
|
core.lua
|
||||||
|
actionbars.lua
|
||||||
|
General.lua
|
||||||
|
DataBars.lua
|
||||||
UnitFrames.lua
|
UnitFrames.lua
|
||||||
+4
-4
@@ -369,7 +369,7 @@ local function CleanUserData(widget, event)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if widget.type == "TabGroup" then
|
if widget.type == "TabGroup-ElvUI" then
|
||||||
widget:SetTabs(nil)
|
widget:SetTabs(nil)
|
||||||
if user.tablist then
|
if user.tablist then
|
||||||
del(user.tablist)
|
del(user.tablist)
|
||||||
@@ -1440,7 +1440,7 @@ local function TreeOnButtonEnter(widget, event, _, uniquevalue, button)
|
|||||||
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
||||||
|
|
||||||
GameTooltip:SetOwner(button, "ANCHOR_NONE")
|
GameTooltip:SetOwner(button, "ANCHOR_NONE")
|
||||||
if widget.type == "TabGroup" then
|
if widget.type == "TabGroup-ElvUI" then
|
||||||
GameTooltip:SetPoint("BOTTOM",button,"TOP")
|
GameTooltip:SetPoint("BOTTOM",button,"TOP")
|
||||||
else
|
else
|
||||||
GameTooltip:SetPoint("LEFT",button,"RIGHT")
|
GameTooltip:SetPoint("LEFT",button,"RIGHT")
|
||||||
@@ -1604,7 +1604,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
|||||||
local name = GetOptionsMemberValue("name", group, options, path, appName)
|
local name = GetOptionsMemberValue("name", group, options, path, appName)
|
||||||
if grouptype == "tab" then
|
if grouptype == "tab" then
|
||||||
|
|
||||||
local tab = gui:Create("TabGroup")
|
local tab = gui:Create("TabGroup-ElvUI")
|
||||||
InjectInfo(tab, options, group, path, rootframe, appName)
|
InjectInfo(tab, options, group, path, rootframe, appName)
|
||||||
tab:SetCallback("OnGroupSelected", GroupSelected)
|
tab:SetCallback("OnGroupSelected", GroupSelected)
|
||||||
tab:SetCallback("OnTabEnter", TreeOnButtonEnter)
|
tab:SetCallback("OnTabEnter", TreeOnButtonEnter)
|
||||||
@@ -1650,7 +1650,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
|||||||
|
|
||||||
local firstgroup = orderlist[1]
|
local firstgroup = orderlist[1]
|
||||||
if firstgroup then
|
if firstgroup then
|
||||||
select:SetGroup((GroupExists(appName, options, path, status.groups.selected) and status.groups.selected) or firstgroup)
|
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
|
||||||
end
|
end
|
||||||
|
|
||||||
select.width = "fill"
|
select.width = "fill"
|
||||||
|
|||||||
+29
-54
@@ -2,22 +2,19 @@
|
|||||||
TabGroup Container
|
TabGroup Container
|
||||||
Container that uses tabs on top to switch between groups.
|
Container that uses tabs on top to switch between groups.
|
||||||
-------------------------------------------------------------------------------]]
|
-------------------------------------------------------------------------------]]
|
||||||
local Type, Version = "TabGroup", 35
|
local Type, Version = "TabGroup-ElvUI", 31
|
||||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||||
|
|
||||||
local AceCore = LibStub("AceCore-3.0")
|
|
||||||
local wipe = AceCore.wipe
|
|
||||||
|
|
||||||
-- Lua APIs
|
-- Lua APIs
|
||||||
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
|
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
|
||||||
local tgetn = table.getn
|
local getn = table.getn
|
||||||
local strfmt = string.format
|
local format = string.format
|
||||||
|
|
||||||
-- WoW APIs
|
-- WoW APIs
|
||||||
local PlaySound = PlaySound
|
local PlaySound = PlaySound
|
||||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||||
local _G = AceCore._G
|
local _G = _G
|
||||||
|
|
||||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||||
-- List them here for Mikk's FindGlobals script
|
-- List them here for Mikk's FindGlobals script
|
||||||
@@ -34,30 +31,27 @@ Support functions
|
|||||||
local function UpdateTabLook(frame)
|
local function UpdateTabLook(frame)
|
||||||
if frame.disabled then
|
if frame.disabled then
|
||||||
PanelTemplates_SetDisabledTabState(frame)
|
PanelTemplates_SetDisabledTabState(frame)
|
||||||
frame:SetAlpha(0.5)
|
|
||||||
elseif frame.selected then
|
elseif frame.selected then
|
||||||
PanelTemplates_SelectTab(frame)
|
PanelTemplates_SelectTab(frame)
|
||||||
frame:SetAlpha(1)
|
|
||||||
else
|
else
|
||||||
PanelTemplates_DeselectTab(frame)
|
PanelTemplates_DeselectTab(frame)
|
||||||
frame:SetAlpha(0.5)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Tab_SetText(tab, text)
|
local function Tab_SetText(frame, text)
|
||||||
tab:_SetText(text)
|
frame:_SetText(text)
|
||||||
local width = tab.obj.frame.width or tab.obj.frame:GetWidth() or 0
|
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
|
||||||
PanelTemplates_TabResize(0, tab, nil, width)
|
PanelTemplates_TabResize(0, frame, nil, width)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Tab_SetSelected(tab, selected)
|
local function Tab_SetSelected(frame, selected)
|
||||||
tab.selected = selected
|
frame.selected = selected
|
||||||
UpdateTabLook(tab)
|
UpdateTabLook(frame)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function Tab_SetDisabled(tab, disabled)
|
local function Tab_SetDisabled(frame, disabled)
|
||||||
tab.disabled = disabled
|
frame.disabled = disabled
|
||||||
UpdateTabLook(tab)
|
UpdateTabLook(frame)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function BuildTabsOnUpdate()
|
local function BuildTabsOnUpdate()
|
||||||
@@ -110,30 +104,16 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
["CreateTab"] = function(self, id)
|
["CreateTab"] = function(self, id)
|
||||||
local tabname = strfmt("AceGUITabGroup%dTab%d", self.num, id)
|
local tabname = format("AceGUITabGroup%dTab%d", self.num, id)
|
||||||
local tab = CreateFrame("Button", tabname, self.border, "TabButtonTemplate")
|
local tab = CreateFrame("Button", tabname, self.border, "TabButtonTemplate")
|
||||||
-- Normal texture
|
|
||||||
local texture = getglobal(tabname.."Left")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
texture:ClearAllPoints()
|
|
||||||
texture:SetPoint("BOTTOMLEFT", tab,"BOTTOMLEFT")
|
|
||||||
texture:SetPoint("TOPLEFT", tab,"TOPLEFT")
|
|
||||||
texture = getglobal(tabname.."Middle")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
texture = getglobal(tabname.."Right")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
-- Disabled texture
|
|
||||||
texture = getglobal(tabname.."LeftDisabled")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
texture:SetPoint("BOTTOMLEFT", tab,"BOTTOMLEFT")
|
|
||||||
texture:SetPoint("TOPLEFT", tab,"TOPLEFT")
|
|
||||||
texture = getglobal(tabname.."MiddleDisabled")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
texture = getglobal(tabname.."RightDisabled")
|
|
||||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
|
||||||
|
|
||||||
tab.obj = self
|
tab.obj = self
|
||||||
tab.id = id
|
tab.id = id
|
||||||
|
tab:SetHeight(24)
|
||||||
|
|
||||||
|
tab.text = _G[tabname .. "Text"]
|
||||||
|
tab.text:ClearAllPoints()
|
||||||
|
tab.text:SetPoint("LEFT", 14, -3)
|
||||||
|
tab.text:SetPoint("RIGHT", -12, -3)
|
||||||
|
|
||||||
tab:SetScript("OnClick", Tab_OnClick)
|
tab:SetScript("OnClick", Tab_OnClick)
|
||||||
tab:SetScript("OnEnter", Tab_OnEnter)
|
tab:SetScript("OnEnter", Tab_OnEnter)
|
||||||
@@ -209,28 +189,23 @@ local methods = {
|
|||||||
end
|
end
|
||||||
|
|
||||||
tab:Show()
|
tab:Show()
|
||||||
if type(v) == "table" then
|
tab:SetText(v.text)
|
||||||
tab:SetText(v.text)
|
tab:SetDisabled(v.disabled)
|
||||||
tab:SetDisabled(v.disabled)
|
tab.value = v.value
|
||||||
tab.value = v.value
|
|
||||||
elseif type(v) == "string" then
|
|
||||||
tab:SetText(v)
|
|
||||||
tab.value = v
|
|
||||||
end
|
|
||||||
|
|
||||||
widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
|
widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = tgetn(tablist)+1, tgetn(tabs), 1 do
|
local numtabs = getn(tablist)
|
||||||
|
for i = numtabs+1, numtabs, 1 do
|
||||||
tabs[i]:Hide()
|
tabs[i]:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
|
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
|
||||||
local numtabs = tgetn(tablist)
|
|
||||||
local numrows = 1
|
local numrows = 1
|
||||||
local usedwidth = 0
|
local usedwidth = 0
|
||||||
|
|
||||||
for i = 1, tgetn(tablist) do
|
for i = 1, numtabs do
|
||||||
--If this is not the first tab of a row and there isn't room for it
|
--If this is not the first tab of a row and there isn't room for it
|
||||||
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
|
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
|
||||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||||
@@ -241,7 +216,7 @@ local methods = {
|
|||||||
usedwidth = usedwidth + widths[i]
|
usedwidth = usedwidth + widths[i]
|
||||||
end
|
end
|
||||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||||
rowends[numrows] = tgetn(tablist)
|
rowends[numrows] = numtabs
|
||||||
|
|
||||||
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
|
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
|
||||||
if numrows > 1 then
|
if numrows > 1 then
|
||||||
@@ -289,7 +264,7 @@ local methods = {
|
|||||||
starttab = endtab + 1
|
starttab = endtab + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)+7
|
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
|
||||||
self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
|
self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||||
local AB = E:GetModule("ActionBars");
|
local AB = E:GetModule("ActionBars");
|
||||||
local ACD = LibStub("AceConfigDialog-3.0-ElvUI");
|
local ACD = LibStub("AceConfigDialog-3.0");
|
||||||
local group
|
local group
|
||||||
|
|
||||||
--Cache global variables
|
--Cache global variables
|
||||||
|
|||||||
Reference in New Issue
Block a user