added the last missing ui elements to the tsm style: dropdown and checkbox. also many other style changes and lots of things made larger

This commit is contained in:
Manuel Simon Hirsig
2016-08-07 02:00:49 +02:00
parent b94cabfc08
commit c0db070798
10 changed files with 249 additions and 254 deletions
+18 -9
View File
@@ -630,11 +630,14 @@ end
function private.initialize_class_dropdown()
local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(m.class_dropdown) then
local old_value = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
if this.value ~= old_value then
UIDropDownMenu_ClearAll(m.subclass_dropdown)
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown)
UIDropDownMenu_ClearAll(m.slot_dropdown)
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
end
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
end
UIDropDownMenu_AddButton{
@@ -655,15 +658,19 @@ end
function private.initialize_subclass_dropdown()
local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) then
local old_value = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
if this.value ~= old_value then
UIDropDownMenu_ClearAll(m.slot_dropdown)
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
end
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
end
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
if class_index and GetAuctionItemSubClasses(class_index) then
m.subclass_dropdown.button:Enable()
UIDropDownMenu_AddButton{
text = ALL,
value = 0,
@@ -677,6 +684,8 @@ function private.initialize_subclass_dropdown()
func = on_click,
}
end
else
m.subclass_dropdown.button:Disable()
end
end
@@ -690,6 +699,8 @@ function private.initialize_slot_dropdown()
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
if class_index and subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
m.slot_dropdown.button:Enable()
UIDropDownMenu_AddButton{
text = ALL,
value = 0,
@@ -704,6 +715,8 @@ function private.initialize_slot_dropdown()
func = on_click,
}
end
else
m.slot_dropdown.button:Disable()
end
end
@@ -825,17 +838,13 @@ function private.set_form(components)
m.usable_checkbox:SetChecked(true)
elseif filter[1] == 'class' then
class_index = aux.info.item_class_index(filter[2])
UIDropDownMenu_Initialize(m.class_dropdown, m.initialize_class_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index)
elseif filter[1] == 'subclass' then
subclass_index = aux.info.item_subclass_index(class_index, filter[2])
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index)
elseif filter[1] == 'slot' then
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, ({GetAuctionInvTypes(class_index, subclass_index)})[aux.info.item_slot_index(class_index, subclass_index, filter[2])])
elseif filter[1] == 'quality' then
UIDropDownMenu_Initialize(m.quality_dropdown, m.initialize_quality_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, aux.info.item_quality_index(filter[2]))
end
end
@@ -903,7 +912,7 @@ end
function private.update_filter_display()
local lines = aux.util.size(aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end))
local width_scale = max(200/m.filter_display:GetStringWidth())
local width_scale = max(260/m.filter_display:GetStringWidth())
local height_scale = min((200 / lines) / 18)
m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale))
m.filter_display:SetText(aux.filter.indented_post_query_string(m.post_components))
+16 -21
View File
@@ -84,7 +84,7 @@ aux.search_tab.FRAMES(function(m, public, private)
this:SetBackdropColor(unpack(aux.gui.color.state.disabled))
end
end)
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
local label = aux.gui.label(editbox, 14)
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(unpack(aux.gui.color.text.enabled))
@@ -365,7 +365,7 @@ aux.search_tab.FRAMES(function(m, public, private)
do
local editbox = aux.gui.editbox(m.frame.filter)
editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -26)
editbox:SetPoint('TOPLEFT', 14, -25)
editbox:SetWidth(260)
editbox:SetScript('OnChar', function()
if m.exact_checkbox:GetChecked() then
@@ -395,7 +395,7 @@ aux.search_tab.FRAMES(function(m, public, private)
end
do
local editbox = aux.gui.editbox(m.frame.filter)
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -28)
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -26)
editbox:SetWidth(125)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
@@ -441,11 +441,10 @@ aux.search_tab.FRAMES(function(m, public, private)
end
do
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26)
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -24)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
dropdown:SetScript('OnShow', function()
@@ -455,52 +454,49 @@ aux.search_tab.FRAMES(function(m, public, private)
end
do
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22)
private.subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown)
end)
private.subclass_dropdown = dropdown
end
do
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22)
private.slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown)
end)
private.slot_dropdown = dropdown
end
do
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22)
private.quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Min Rarity')
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Min Quality')
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown)
end)
private.quality_dropdown = dropdown
end
aux.gui.vertical_line(m.frame.filter, 332)
do
local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPRIGHT', -177, -10)
dropdown:SetWidth(150)
dropdown:SetHeight(10)
UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown)
@@ -530,7 +526,6 @@ aux.search_tab.FRAMES(function(m, public, private)
local input = aux.gui.editbox(m.frame.filter)
input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150)
input:SetHeight(25)
input:SetScript('OnChar', function()
this:complete()
end)