Quantcast

Ackis Recipe List:

Ackis [11-04-08 - 22:46]
Ackis Recipe List:
- Started search gui integration
- Dry-coded (Compiles with luac -p)
Filename
ARLFrame.lua
Locals/ARLLocals-enUS.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index c76e993..fb185f8 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -3158,10 +3158,47 @@ function addon:CreateFrame(
 		local ARL_SearchButton = addon:GenericCreateButton("ARL_SearchButton", addon.Frame,
 			25, 74, "TOPLEFT", ARL_SortButton, "BOTTOMRIGHT", 41, -2, "GameFontNormalSmall",
 			"GameFontHighlightSmall", L["Search"], "CENTER", L["SEARCH_DESC"], 1)
+			ARL_SearchButton:SetScript("OnClick",
+				function(this)
+
+					local searchtext = ARL_SearchText:GetText()
+					searchtext = searchtext:trim()
+
+					if (searchtext ~= "") then
+
+						addon:SearchRecipeDB(recipeDB, searchtext)
+						RecipeList_Update()
+
+					end
+
+				end
+			)
+
+		local ARL_SearchText = CreateFrame("ARL_SearchText", nil, addon.Frame, "InputBoxTemplate")
+			ARL_CloseButton:SetText(L["SEARCH_BOX_DESC"])
+			ARL_CloseButton:SetScript("OnClick",
+				function(this)
+					if (this:GetText() == L["SEARCH_BOX_DESC"]) then
+
+						this:SetText("")
+
+					end
+
+				end
+			)

 		local ARL_ClearButton = addon:GenericCreateButton("ARL_ClearButton", addon.Frame,
 			28, 28, "RIGHT", ARL_SearchButton, "LEFT", 3, -1, "GameFontNormalSmall",
 			"GameFontHighlightSmall", "", "CENTER", L["CLEAR_DESC"], 3)
+			ARL_ClearButton:SetScript("OnClick",
+				function()
+
+					addon:ResetSearch(recipeDB)
+					ARL_ClearButton:SetText(L["SEARCH_BOX_DESC"])
+					RecipeList_Update()
+
+				end
+			)

 		local ARL_CloseButton = addon:GenericCreateButton("ARL_CloseButton", addon.Frame,
 			22, 69, "BOTTOMRIGHT", addon.Frame, "BOTTOMRIGHT", -4, 3, "GameFontNormalSmall",
diff --git a/Locals/ARLLocals-enUS.lua b/Locals/ARLLocals-enUS.lua
index 6bca786..4f7335f 100644
--- a/Locals/ARLLocals-enUS.lua
+++ b/Locals/ARLLocals-enUS.lua
@@ -245,6 +245,7 @@ L["CONTRACTALL"]			= "- All"
 L["CONTRACTALL_DESC"]		= "Minimize all recipes listed below."
 L["Search"]					= true
 L["SEARCH_DESC"]			= "Filter to recipes that contain text at left."
+L["SEARCH_BOX_DESC"]		= "Enter text to search"
 L["CLEAR_DESC"]				= "Clear the search textbox."
 L["Close"]					= "Exit"
 L["CLOSE_DESC"]				= "Close the Ackis Recipe List Window."