Skip to content

Commit

Permalink
Merge pull request #23 from wowsims/feature/add-character-panel-button
Browse files Browse the repository at this point in the history
Add button on character panel
  • Loading branch information
1337LutZ authored Aug 3, 2024
2 parents 5867976 + 34a3e57 commit 625c4ea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,20 @@ into the provided box and click "Import"
_jsonbox = jsonbox
end

---Create a button on the character panel that will call the provided function
---@param onClick fun()
function UI:CreateCharacterPanelButton(onClick)
local openButton = CreateFrame("Button", nil, CharacterFrame, "UIPanelButtonTemplate")
openButton:SetPoint("TOPRIGHT", CharacterFrame, "BOTTOMRIGHT", 0, 0)
openButton:Show()
openButton:SetText("WowSims")
openButton:SetSize(openButton:GetTextWidth() + 15, openButton:GetTextHeight() + 10)
openButton:SetScript("OnClick", openButton:SetScript("OnClick", function(self)
onClick()
end))
openButton:RegisterForClicks("AnyUp")
end

---Sets string in textbox.
---@param outputString string
function UI:SetOutput(outputString)
Expand Down
1 change: 1 addition & 0 deletions WowSimsExporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function WowSimsExporter:OnInitialize()
self:RegisterChatCommand("wse", "OpenWindow")
self:RegisterChatCommand("wowsimsexporter", "OpenWindow")
self:RegisterChatCommand("wsexporter", "OpenWindow")
Env.UI:CreateCharacterPanelButton(options.args.openExporterButton.func)

self:Print(addonName .. " " .. Env.VERSION .. " Initialized. use /wse For Window.")

Expand Down

0 comments on commit 625c4ea

Please sign in to comment.