42 lines
1.2 KiB
Lua
42 lines
1.2 KiB
Lua
function SearchBoxTemplate_OnLoad(self)
|
|
InputBoxInstructions_OnLoad(self);
|
|
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
|
|
self:SetTextInsets(16, 20, 0, 0);
|
|
self.Instructions:SetText(SEARCH);
|
|
self.Instructions:ClearAllPoints();
|
|
self.Instructions:SetPoint("TOPLEFT", self, "TOPLEFT", 16, 0);
|
|
self.Instructions:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -20, 0);
|
|
self.clearButton:SetFrameLevel(self:GetFrameLevel() + 1);
|
|
end
|
|
|
|
function SearchBoxTemplate_OnEditFocusLost(self)
|
|
if ( self:GetText() == "" ) then
|
|
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
|
|
self.clearButton:Hide();
|
|
end
|
|
end
|
|
|
|
function SearchBoxTemplate_OnEditFocusGained(self)
|
|
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
|
|
self.clearButton:Show();
|
|
InputBoxInstructions_OnEditFocusGained(self);
|
|
end
|
|
|
|
function SearchBoxTemplate_OnTextChanged(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
|
|
InputBoxInstructions_OnTextChanged(self);
|
|
end
|
|
|
|
function SearchBoxTemplateClearButton_OnClick(self)
|
|
PlaySound("igMainMenuOptionCheckBoxOn");
|
|
local editBox = self:GetParent();
|
|
editBox:SetText("");
|
|
editBox:ClearFocus();
|
|
end
|