right click menu for saved searches
This commit is contained in:
+8
-20
@@ -95,27 +95,15 @@ do
|
||||
end
|
||||
|
||||
do
|
||||
local menu = CreateFrame('Frame', unique_name, UIParent, 'UIMenuTemplate')
|
||||
local orig = menu:GetScript'OnShow'
|
||||
local structure = T
|
||||
menu:SetScript('OnShow', function()
|
||||
UIMenu_Initialize()
|
||||
for i = 1, getn(structure), 2 do
|
||||
UIMenu_AddButton(
|
||||
structure[i],
|
||||
nil,
|
||||
structure[i + 1]
|
||||
)
|
||||
end
|
||||
return orig()
|
||||
end)
|
||||
local menu = CreateFrame('Frame', unique_name, UIParent, 'UIDropDownMenuTemplate')
|
||||
M.menu = vararg-function(arg)
|
||||
static(arg)
|
||||
structure = arg
|
||||
local x, y = GetCursorPosition()
|
||||
menu:ClearAllPoints()
|
||||
menu:SetPoint('BOTTOMLEFT', x + 75, y)
|
||||
menu:Show()
|
||||
HideDropDownMenu(1)
|
||||
UIDropDownMenu_Initialize(menu, function()
|
||||
for i = 1, getn(arg), 2 do
|
||||
UIDropDownMenu_AddButton(O('text', arg[i], 'notCheckable', true, 'func', arg[i + 1]))
|
||||
end
|
||||
end, 'MENU')
|
||||
ToggleDropDownMenu(1, nil, menu, 'cursor')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+21
-26
@@ -1,6 +1,7 @@
|
||||
module 'aux.tabs.search'
|
||||
|
||||
local filter_util = require 'aux.util.filter'
|
||||
local gui = require 'aux.gui'
|
||||
|
||||
_G.aux_auto_buy_filters = T
|
||||
_G.aux_favorite_searches = T
|
||||
@@ -59,37 +60,31 @@ handlers = {
|
||||
search_box:SetText(data.search.filter_string)
|
||||
elseif button == 'RightButton' and IsShiftKeyDown() then
|
||||
add_filter(data.search.filter_string)
|
||||
elseif button == 'LeftButton' and IsControlKeyDown() then
|
||||
if st == favorite_searches_listing then
|
||||
move_up(aux_favorite_searches, data.index)
|
||||
elseif st == auto_buy_listing then
|
||||
move_up(aux_auto_buy_filters, data.index)
|
||||
end
|
||||
update_search_listings()
|
||||
elseif button == 'RightButton' and IsControlKeyDown() then
|
||||
if st == favorite_searches_listing then
|
||||
move_down(aux_favorite_searches, data.index)
|
||||
elseif st == auto_buy_listing then
|
||||
move_down(aux_auto_buy_filters, data.index)
|
||||
end
|
||||
update_search_listings()
|
||||
elseif button == 'RightButton' and IsAltKeyDown() then
|
||||
if st == auto_buy_listing then
|
||||
tremove(aux_auto_buy_filters, data.index)
|
||||
else
|
||||
add_auto_buy(data.search.filter_string)
|
||||
end
|
||||
update_search_listings()
|
||||
elseif button == 'LeftButton' then
|
||||
search_box:SetText(data.search.filter_string)
|
||||
execute()
|
||||
elseif button == 'RightButton' then
|
||||
if st == favorite_searches_listing then
|
||||
tremove(aux_favorite_searches, data.index)
|
||||
else
|
||||
tinsert(aux_favorite_searches, 1, data.search)
|
||||
local u = update_search_listings
|
||||
if st == recent_searches_listing then
|
||||
gui.menu(
|
||||
'Favorite', function() tinsert(aux_favorite_searches, 1, data.search); u() end,
|
||||
'Auto Buy', function() add_auto_buy(data.search.filter_string); u() end
|
||||
)
|
||||
elseif st == favorite_searches_listing then
|
||||
gui.menu(
|
||||
'Auto Buy', function() add_auto_buy(data.search.filter_string); u() end,
|
||||
'Move Up', function() move_up(aux_favorite_searches, data.index); u() end,
|
||||
'Move Down', function() move_down(aux_favorite_searches, data.index); u() end,
|
||||
'Delete', function() tremove(aux_favorite_searches, data.index); u() end
|
||||
)
|
||||
elseif st == auto_buy_listing then
|
||||
gui.menu(
|
||||
'Favorite', function() tinsert(aux_favorite_searches, 1, data.search); u() end,
|
||||
'Move Up', function() move_up(aux_auto_buy_filters, data.index); u() end,
|
||||
'Move Down', function() move_down(aux_auto_buy_filters, data.index); u() end,
|
||||
'Delete', function() tremove(aux_auto_buy_filters, data.index); u() end
|
||||
)
|
||||
end
|
||||
update_search_listings()
|
||||
end
|
||||
end,
|
||||
OnEnter = function(st, data, self)
|
||||
|
||||
Reference in New Issue
Block a user