More development

This commit is contained in:
Tercio Jose
2023-04-13 21:43:04 -03:00
parent 20dcfb3866
commit f370ce3dee
2 changed files with 77 additions and 36 deletions
+15 -18
View File
@@ -5158,38 +5158,43 @@ detailsFramework.HeaderFunctions = {
end,
---comment
---@param self button
---@param columnHeader headercolumnframe
---@param buttonClicked string
OnClick = function(self, buttonClicked)
OnClick = function(columnHeader, buttonClicked)
--get the header main frame
---@type headerframe
local headerFrame = self:GetParent()
local headerFrame = columnHeader:GetParent()
--if this header does not have a clickable header, just ignore
if (not headerFrame.columnSelected) then
return
end
--check if this column has 'canSort' key, otherwise ignore the click
if (not columnHeader.columnData.canSort) then
return
end
--get the latest column header selected
---@type headercolumnframe
local previousColumnHeader = headerFrame.columnHeadersCreated[headerFrame.columnSelected]
previousColumnHeader.Arrow:Hide()
headerFrame:ResetColumnHeaderBackdrop(previousColumnHeader)
headerFrame:SetBackdropColorForSelectedColumnHeader(self)
headerFrame:SetBackdropColorForSelectedColumnHeader(columnHeader)
if (headerFrame.columnSelected == self.columnIndex) then
self.order = self.order ~= "ASC" and "ASC" or "DESC"
if (headerFrame.columnSelected == columnHeader.columnIndex) then
columnHeader.order = columnHeader.order ~= "ASC" and "ASC" or "DESC"
end
headerFrame.columnOrder = self.order
headerFrame.columnOrder = columnHeader.order
--set the new column header selected
headerFrame.columnSelected = self.columnIndex
headerFrame.columnSelected = columnHeader.columnIndex
headerFrame:UpdateSortArrow(self)
headerFrame:UpdateSortArrow(columnHeader)
if (headerFrame.options.header_click_callback) then
--callback with the main header frame, column header, column index and column order as payload
local okay, errortext = pcall(headerFrame.options.header_click_callback, headerFrame, self, self.columnIndex, self.order)
local okay, errortext = pcall(headerFrame.options.header_click_callback, headerFrame, columnHeader, columnHeader.columnIndex, columnHeader.order)
if (not okay) then
print("DF: Header onClick callback error:", errortext)
end
@@ -5514,14 +5519,6 @@ detailsFramework.HeaderCoreFunctions = {
columnHeader:SetMovable(true)
columnHeader:SetResizable(true)
columnHeader:SetScript("OnMouseDown", function()
print(11)
end)
columnHeader:SetScript("OnMouseUp", function()
print(22) --doesn't work either
end)
--header icon
detailsFramework:CreateImage(columnHeader, "", self.options.header_height, self.options.header_height, "ARTWORK", nil, "Icon", "$parentIcon")
--header separator