big progress on the item search and manage tabs
This commit is contained in:
+108
-9
@@ -68,9 +68,7 @@ function Aux.completion.completor(edit_box)
|
||||
value = suggestion.value,
|
||||
notCheckable = true,
|
||||
func = function()
|
||||
-- self.set_quietly(text)
|
||||
Aux.item_search_frame.set_item(this.value)
|
||||
AuxItemSearchFrameItemItemInputBox:ClearFocus()
|
||||
self.set_quietly(text)
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -140,10 +138,9 @@ function Aux.completion.completor(edit_box)
|
||||
index = index > 0 and math.mod(index + 1, getn(suggestions) + 1) or 1
|
||||
update_highlighting()
|
||||
if index == 0 then
|
||||
-- self.set_quietly(input)
|
||||
self.set_quietly(input)
|
||||
else
|
||||
-- self.set_quietly(suggestions[index].text)
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
self.set_quietly(suggestions[index].text)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -154,13 +151,115 @@ function Aux.completion.completor(edit_box)
|
||||
index = index > 0 and index - 1 or getn(suggestions)
|
||||
update_highlighting()
|
||||
if index == 0 then
|
||||
-- self.set_quietly(input)
|
||||
self.set_quietly(input)
|
||||
else
|
||||
-- self.set_quietly(suggestions[index].text)
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
self.set_quietly(suggestions[index].text)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function Aux.completion.selector(edit_box)
|
||||
local self = {}
|
||||
|
||||
local suggestions = {}
|
||||
local index = 0
|
||||
local input
|
||||
|
||||
local fill_dropdown, update_dropdown, update_highlighting
|
||||
|
||||
function fill_dropdown()
|
||||
for i, suggestion in ipairs(suggestions) do
|
||||
local text = suggestion.text
|
||||
UIDropDownMenu_AddButton{
|
||||
text = suggestion.display_text,
|
||||
value = i,
|
||||
notCheckable = true,
|
||||
func = function()
|
||||
index = this.value
|
||||
AuxItemSearchFrameItemItemInputBox:ClearFocus()
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function update_dropdown()
|
||||
function toggle()
|
||||
ToggleDropDownMenu(1, nil, AuxCompletionDropDown, edit_box, -12, 4)
|
||||
end
|
||||
|
||||
if DropDownList1:IsVisible() then
|
||||
toggle()
|
||||
end
|
||||
toggle()
|
||||
end
|
||||
|
||||
function update_highlighting()
|
||||
for i=1,32 do
|
||||
local highlight = getglobal('DropDownList1Button' .. i .. 'Highlight')
|
||||
if i == index then
|
||||
highlight:Show()
|
||||
else
|
||||
highlight:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function self.close()
|
||||
CloseDropDownMenus(1)
|
||||
end
|
||||
|
||||
function self.open()
|
||||
local _, owner = DropDownList1:GetPoint()
|
||||
return DropDownList1:IsVisible() and owner == edit_box
|
||||
end
|
||||
|
||||
function self.suggest()
|
||||
local new_input = edit_box:GetText()
|
||||
|
||||
input = new_input
|
||||
|
||||
if input == '' then
|
||||
suggestions = {}
|
||||
else
|
||||
suggestions = generate_suggestions(input)
|
||||
UIDropDownMenu_Initialize(AuxCompletionDropDown, function() fill_dropdown() end)
|
||||
end
|
||||
|
||||
index = 1
|
||||
update_highlighting()
|
||||
|
||||
update_dropdown()
|
||||
end
|
||||
|
||||
function self.next()
|
||||
update_dropdown()
|
||||
if getn(suggestions) > 0 then
|
||||
index = math.mod(index, getn(suggestions)) + 1
|
||||
update_highlighting()
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
end
|
||||
end
|
||||
|
||||
function self.previous()
|
||||
update_dropdown()
|
||||
if getn(suggestions) > 0 then
|
||||
index = index > 1 and index - 1 or getn(suggestions)
|
||||
update_highlighting()
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
end
|
||||
end
|
||||
|
||||
function self.selected_value()
|
||||
return suggestions[index] and suggestions[index].value
|
||||
end
|
||||
|
||||
function self.clear()
|
||||
index = 1
|
||||
suggestions = {}
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user