Skip to content

Commit

Permalink
Use table layout for talent rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Jul 10, 2023
1 parent e86f722 commit a790b3e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
28 changes: 21 additions & 7 deletions Clicked/Config/Bindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -893,18 +893,35 @@ local function DrawTalentSelectPanel(container, talents, data)
container:AddChild(widget)
end

local function CreateTableGroup()
local group = AceGUI:Create("ClickedSimpleGroup") --[[@as ClickedSimpleGroup]]
--- @diagnostic disable-next-line: param-type-mismatch
group:SetLayout("Table")
group:SetFullWidth(true)
group:SetUserData("table", {
columns = { 75, 1, 50 },
spaceH = 1
})

container:AddChild(group)
return group
end

do
local widget = AceGUI:Create("Label")
widget:SetFullWidth(true)

container:AddChild(widget)
end

local tableContainer = CreateTableGroup()

for i = 1, #data.entries do
local entry = data.entries[i]

if entry.operation == "OR" then
AddSeparator()
tableContainer = CreateTableGroup()
end

do
Expand All @@ -916,19 +933,17 @@ local function DrawTalentSelectPanel(container, talents, data)
local widget = AceGUI:Create("Button") --[[@as AceGUIButton]]
widget:SetText(entry.negated and Addon.L["Not"] or "")
widget:SetCallback("OnClick", OnClick)
widget:SetRelativeWidth(0.2)

container:AddChild(widget)
tableContainer:AddChild(widget)
end

do
local widget = Addon:GUI_AutoFillEditBox(entry, "value", binding)
widget:SetInputError(not DoesTalentExist(entry.value))
widget:SetValues(talents)
widget:SetFullWidth(true)

widget:SetRelativeWidth(0.65)

container:AddChild(widget)
tableContainer:AddChild(widget)
end

do
Expand Down Expand Up @@ -960,9 +975,8 @@ local function DrawTalentSelectPanel(container, talents, data)
widget:SetText(Addon.L["X"])
widget:SetCallback("OnClick", OnClick)
widget:SetDisabled(#data.entries == 1)
widget:SetRelativeWidth(0.14)

container:AddChild(widget)
tableContainer:AddChild(widget)
end

if i == #data.entries or data.entries[i + 1].operation == "OR" then
Expand Down
5 changes: 1 addition & 4 deletions Clicked/Widgets/AceGUIWidget-ClickedAutoFillEditBox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ function Methods:ClearFocus()
end

--- @param width integer
function Methods:SetWidth(width)
self:BaseSetWidth(width)
function Methods:OnWidthSet(width)
self.pullout:SetWidth(width)
end

Expand Down Expand Up @@ -694,8 +693,6 @@ local function Constructor()
--- @private
widget.BaseOnRelease = widget.OnRelease
--- @private
widget.BaseSetWidth = widget.SetWidth
--- @private
widget.BaseSetText = widget.SetText
--- @private
widget.BaseOnFocusGained = widget.editbox:GetScript("OnEditFocusGained")
Expand Down

0 comments on commit a790b3e

Please sign in to comment.