Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,558 additions
and
1,311 deletions.
There are no files selected for viewing
479 changes: 240 additions & 239 deletions
479
Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua
100755 → 100644
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
Libs/CallbackHandler-1.0/CallbackHandler-1.0.xml
100755 → 100644
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ | ||
..\FrameXML\UI.xsd"> | ||
<Script file="CallbackHandler-1.0.lua"/> | ||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ | ||
..\FrameXML\UI.xsd"> | ||
<Script file="CallbackHandler-1.0.lua"/> | ||
</Ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
function TopFit:RegisterPlugin(pluginName, tooltipText) | ||
-- create / register plugin-tab | ||
local pluginInfo = { | ||
name = pluginName, | ||
tooltipText = tooltipText, | ||
} | ||
|
||
tinsert(TopFit.plugins, pluginInfo) | ||
pluginInfo.id = #(TopFit.plugins) | ||
|
||
-- return frame for plugin UI | ||
pluginInfo.frame = CreateFrame("Frame", "TopFit_ProgressFrame_PluginFrame_"..(pluginInfo.id), nil) | ||
if pluginInfo.id > 1 then | ||
pluginInfo.frame:Hide() | ||
end | ||
|
||
TopFit:UpdatePlugins() | ||
|
||
return pluginInfo.frame, pluginInfo.id | ||
end | ||
|
||
function TopFit:UpdatePlugins() | ||
if TopFit.ProgressFrame then | ||
local i | ||
for i = 1, #(TopFit.plugins) do | ||
local pluginInfo = TopFit.plugins[i] | ||
-- update parents and anchors for plugin frames | ||
pluginInfo.frame:SetParent(TopFit.ProgressFrame.pluginContainer) | ||
pluginInfo.frame:SetAllPoints() | ||
|
||
-- create tabs if necessary | ||
if not pluginInfo.tabButton then | ||
-- create plugin button and size / anchor it | ||
pluginInfo.tabButton = TopFit.ProgressFrame:CreateHeaderButton(TopFit.ProgressFrame.pluginContainer, "TopFit_ProgressFrame_PluginButton_"..(pluginInfo.id)) | ||
pluginInfo.tabButton:SetPoint("BOTTOM", TopFit.ProgressFrame, "TOP", 0, -7) | ||
if (pluginInfo.id == 1) then | ||
pluginInfo.tabButton:SetPoint("LEFT", TopFit.ProgressFrame.pluginContainer, "LEFT") | ||
else | ||
pluginInfo.tabButton:SetPoint("LEFT", TopFit.plugins[pluginInfo.id - 1].tabButton, "RIGHT", 3, 0) | ||
end | ||
|
||
-- set event handlers | ||
pluginInfo.tabButton:SetScript("OnClick", function() | ||
TopFit:SelectPluginTab(pluginInfo.id) | ||
end) | ||
end | ||
pluginInfo.tabButton:SetText(pluginInfo.name) | ||
pluginInfo.tabButton:SetWidth(pluginInfo.tabButton:GetFontString():GetStringWidth() + 10) | ||
pluginInfo.tabButton.tipText = pluginInfo.tooltipText | ||
end | ||
end | ||
end | ||
|
||
function TopFit:SelectPluginTab(id) | ||
local i | ||
for i = 1, #(TopFit.plugins) do | ||
if i == id then | ||
TopFit.plugins[i].frame:Show() | ||
TopFit.eventHandler:Fire("OnShow", id) | ||
else | ||
TopFit.plugins[i].frame:Hide() | ||
end | ||
end | ||
end |
Oops, something went wrong.