update options
This commit is contained in:
@@ -48,13 +48,95 @@ local function GetAll(baseObject, path, property, default)
|
||||
end
|
||||
|
||||
local function ConstructModelPicker(frame)
|
||||
local function RecurseSetFilter(tree, filter)
|
||||
for k, v in ipairs(tree) do
|
||||
if v.children == nil and v.text then
|
||||
v.visible = not filter or filter == "" or v.text:find(filter, 1, true) ~= nil
|
||||
else
|
||||
RecurseSetFilter(v.children, filter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local group = AceGUI:Create("InlineGroup");
|
||||
group.frame:SetParent(frame);
|
||||
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 87);
|
||||
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10);
|
||||
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -15);
|
||||
group.frame:Hide();
|
||||
group:SetLayout("flow");
|
||||
|
||||
local filterInput = CreateFrame("editbox", "WeakAurasModelFilterInput", group.frame, "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 filterText = filterInput:GetText()
|
||||
RecurseSetFilter(group.modelTree.tree, filterText)
|
||||
group.modelTree.filter = filterText ~= nil and filterText ~= ""
|
||||
group.modelTree:RefreshTree()
|
||||
end)
|
||||
filterInput:SetHeight(15)
|
||||
filterInput:SetPoint("TOP", group.frame, "TOP", 0, 1)
|
||||
filterInput:SetPoint("LEFT", group.frame, "LEFT", 7, 0)
|
||||
filterInput:SetWidth(200)
|
||||
filterInput:SetFont(STANDARD_TEXT_FONT, 10)
|
||||
group.frame.filterInput = filterInput
|
||||
|
||||
local modelPickerZ = AceGUI:Create("Slider");
|
||||
modelPickerZ:SetSliderValues(-20, 20, 0.05);
|
||||
modelPickerZ:SetLabel(L["Z Offset"]);
|
||||
|
||||
Reference in New Issue
Block a user