Port XML templates to Lua, update AceGUI/AceConfig, fix $parent nil frame issues on our game version
This commit is contained in:
@@ -57,66 +57,11 @@ local function ConstructModelPicker(frame)
|
||||
group.frame:Hide();
|
||||
group:SetLayout("flow");
|
||||
|
||||
local filterInput = CreateFrame("EditBox", "WeakAurasModelFilterInput", group.frame, "WA_InputBoxTemplate")
|
||||
filterInput:SetAutoFocus(false)
|
||||
filterInput:SetTextInsets(16, 20, 0, 0)
|
||||
|
||||
filterInput.Instructions = filterInput:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall")
|
||||
filterInput.Instructions:SetText(SEARCH)
|
||||
filterInput.Instructions:SetPoint("TOPLEFT", filterInput, "TOPLEFT", 16, 0)
|
||||
filterInput.Instructions:SetPoint("BOTTOMRIGHT", filterInput, "BOTTOMRIGHT", -20, 0)
|
||||
filterInput.Instructions:SetTextColor(0.35, 0.35, 0.35)
|
||||
filterInput.Instructions:SetJustifyH("LEFT")
|
||||
filterInput.Instructions:SetJustifyV("MIDDLE")
|
||||
|
||||
filterInput.searchIcon = filterInput:CreateTexture(nil, "OVERLAY")
|
||||
filterInput.searchIcon:SetTexture("Interface\\Common\\UI-Searchbox-Icon")
|
||||
filterInput.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
|
||||
filterInput.searchIcon:SetSize(14, 14)
|
||||
filterInput.searchIcon:SetPoint("LEFT", 0, -2)
|
||||
|
||||
filterInput.clearButton = CreateFrame("Button", nil, filterInput)
|
||||
filterInput.clearButton:SetSize(14, 14)
|
||||
filterInput.clearButton:SetPoint("RIGHT", -3, 0)
|
||||
|
||||
filterInput.clearButton.texture = filterInput.clearButton:CreateTexture()
|
||||
filterInput.clearButton.texture:SetTexture("Interface\\FriendsFrame\\ClearBroadcastIcon")
|
||||
filterInput.clearButton.texture:SetAlpha(0.5)
|
||||
filterInput.clearButton.texture:SetSize(17, 17)
|
||||
filterInput.clearButton.texture:SetPoint("CENTER", 0, 0)
|
||||
|
||||
filterInput.clearButton:SetScript("OnEnter", function(self) self.texture:SetAlpha(1.0) end)
|
||||
filterInput.clearButton:SetScript("OnLeave", function(self) self.texture:SetAlpha(0.5) end)
|
||||
filterInput.clearButton:SetScript("OnMouseDown", function(self) if self:IsEnabled() then self.texture:SetPoint("CENTER", 1, -1) end end)
|
||||
filterInput.clearButton:SetScript("OnMouseUp", function(self) self.texture:SetPoint("CENTER") end)
|
||||
filterInput.clearButton:SetScript("OnClick", function(self)
|
||||
local editBox = self:GetParent()
|
||||
editBox:SetText("")
|
||||
editBox:ClearFocus()
|
||||
end)
|
||||
filterInput:SetScript("OnEditFocusLost", function(self)
|
||||
if self:GetText() == "" then
|
||||
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
|
||||
self.clearButton:Hide()
|
||||
end
|
||||
end)
|
||||
filterInput:SetScript("OnEditFocusGained", function(self)
|
||||
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
|
||||
self.clearButton:Show()
|
||||
end)
|
||||
filterInput:HookScript("OnTextChanged", function(self)
|
||||
if not self:HasFocus() and self:GetText() == "" then
|
||||
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
|
||||
self.clearButton:Hide()
|
||||
else
|
||||
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
|
||||
self.clearButton:Show()
|
||||
end
|
||||
if self:GetText() == "" then
|
||||
self.Instructions:Show()
|
||||
else
|
||||
self.Instructions:Hide()
|
||||
end
|
||||
local filterInput = CreateFrame("EditBox", "WeakAurasFilterInput", nil)
|
||||
WeakAuras.XMLTemplates["SearchBoxTemplate"](filterInput)
|
||||
filterInput:SetParent(group.frame)
|
||||
filterInput:SetScript("OnTextChanged", function(self)
|
||||
WA_SearchBoxTemplate_OnTextChanged(self)
|
||||
local filterText = filterInput:GetText()
|
||||
RecurseSetFilter(group.modelTree.tree, filterText)
|
||||
group.modelTree.filter = filterText ~= nil and filterText ~= ""
|
||||
|
||||
Reference in New Issue
Block a user