|
|
|
@ -128,7 +128,7 @@ local methods = { |
|
|
|
|
end, |
|
|
|
|
|
|
|
|
|
---@param self Diesal.GUI.Object.DropDown |
|
|
|
|
---@param list table |
|
|
|
|
---@param list table<integer, Diesal.GUI.DropDownItem.Settings> |
|
|
|
|
SetList = function(self, list) |
|
|
|
|
self:ReleaseChildren() |
|
|
|
|
self:SetText("") |
|
|
|
@ -148,6 +148,7 @@ local methods = { |
|
|
|
|
position = position, |
|
|
|
|
clickable = item.clickable, |
|
|
|
|
indent = item.indent or 0, |
|
|
|
|
icon2 = item.icon2, |
|
|
|
|
}, true) |
|
|
|
|
dropdownItem.text:SetPoint("TOPLEFT", 12 + (item.indent * 6), -2) |
|
|
|
|
if item.indent and item.indent > 0 then |
|
|
|
@ -205,6 +206,11 @@ local methods = { |
|
|
|
|
for i = 1, #self.children do |
|
|
|
|
local child = self.children[i] |
|
|
|
|
child:SetSelected(false) |
|
|
|
|
if child.settings.icon2 then |
|
|
|
|
child.icon2:Show() |
|
|
|
|
else |
|
|
|
|
child.icon2:Hide() |
|
|
|
|
end |
|
|
|
|
if child.settings.key == key then |
|
|
|
|
child:SetSelected(true) |
|
|
|
|
dropdownText = child.settings.value |
|
|
|
@ -337,9 +343,21 @@ local methods = { |
|
|
|
|
self:ShowDropDown() |
|
|
|
|
end |
|
|
|
|
end, |
|
|
|
|
---@param self Diesal.GUI.Object.DropDown |
|
|
|
|
---@param strata FrameStrata |
|
|
|
|
---@param parent Frame |
|
|
|
|
---@param children Frame[] |
|
|
|
|
FixStrata = function(self, strata, parent, children) |
|
|
|
|
parent:SetFrameStrata(strata) |
|
|
|
|
for i, child in ipairs(children) do |
|
|
|
|
self:FixStrata(strata, child, { |
|
|
|
|
child:GetChildren() --[[@as Frame]], |
|
|
|
|
}) |
|
|
|
|
end |
|
|
|
|
end, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
---@class Diesal.GUI.Object.DropDown.Settings |
|
|
|
|
---@class Diesal.GUI.Object.DropDown.Settings : Diesal.GUI.ObjectBase.Settings |
|
|
|
|
---@field dropdownPadLeft number |
|
|
|
|
---@field dropdownPadRight number |
|
|
|
|
---@field dropdownPadTop number |
|
|
|
@ -369,6 +387,7 @@ local function Constructor() |
|
|
|
|
|
|
|
|
|
local frame = CreateFrame("Button", nil, UIParent) |
|
|
|
|
frame:SetFrameStrata("TOOLTIP") |
|
|
|
|
frame:SetClampedToScreen(true) |
|
|
|
|
self.frame = frame |
|
|
|
|
|
|
|
|
|
self.isContainer = true |
|
|
|
@ -391,7 +410,10 @@ local function Constructor() |
|
|
|
|
if self.dropdown:IsVisible() then |
|
|
|
|
self.dropdown:Hide() |
|
|
|
|
else |
|
|
|
|
DiesalGUI:OnMouse(this, button) |
|
|
|
|
DiesalGUI:OnMouse(self.dropdown, button) |
|
|
|
|
self:FixStrata("TOOLTIP", self.dropdown, { |
|
|
|
|
self.dropdown:GetChildren() --[[@as Frame]], |
|
|
|
|
}) |
|
|
|
|
self.dropdown:Show() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -413,8 +435,7 @@ local function Constructor() |
|
|
|
|
|
|
|
|
|
local dropdown = self:CreateRegion("Frame", "dropdown", frame) |
|
|
|
|
dropdown:SetFrameStrata("TOOLTIP") |
|
|
|
|
dropdown:SetFrameLevel(998) |
|
|
|
|
dropdown:SetToplevel(true) |
|
|
|
|
dropdown:SetFrameLevel(dropdown:GetFrameLevel() + 2) |
|
|
|
|
dropdown:SetPoint("TOPRIGHT", frame, "BOTTOMRIGHT", 0, -2) |
|
|
|
|
dropdown:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", 0, -2) |
|
|
|
|
dropdown:SetScript("OnShow", function(this) |
|
|
|
|