gui refactoring
This commit is contained in:
@@ -112,7 +112,7 @@ function public.on_load()
|
||||
end)
|
||||
|
||||
do
|
||||
local tab_group = m.gui.tab_group(AuxFrame, 'BOTTOM')
|
||||
local tab_group = m.gui.tab_group(AuxFrame, 'DOWN')
|
||||
tab_group:create_tab('Search')
|
||||
tab_group:create_tab('Post')
|
||||
tab_group:create_tab('Auctions')
|
||||
|
||||
@@ -7,7 +7,11 @@ public.config = {
|
||||
panel_color = { backdrop = {24/255, 24/255, 24/255, 1}, border = {1, 1, 1, .03} },
|
||||
content_color = { backdrop = {42/255, 42/255, 42/255, 1}, border = {0, 0, 0, 0} },
|
||||
font = [[Fonts\ARIALN.TTF]],
|
||||
normal_font_size = 15,
|
||||
tiny_font_size = 12,
|
||||
small_font_size = 13,
|
||||
medium_font_size = 15,
|
||||
large_font_size = 18,
|
||||
huge_font_size = 23,
|
||||
text_color = { enabled = { 255/255, 254/255, 250/255, 1 }, disabled = { 147/255, 151/255, 139/255, 1 } },
|
||||
label_color = { enabled = { 216/255, 225/255, 211/255, 1 }, disabled = { 150/255, 148/255, 140/255, 1 } },
|
||||
on_color = {0.3, 0.7, 0.3},
|
||||
@@ -105,7 +109,7 @@ end
|
||||
|
||||
do
|
||||
local id = 0
|
||||
function public.tab_group(parent, position)
|
||||
function public.tab_group(parent, orientation)
|
||||
id = id + 1
|
||||
|
||||
local frame = CreateFrame('Frame', nil, parent)
|
||||
@@ -130,10 +134,10 @@ do
|
||||
tab:SetBackdropBorderColor(unpack(m.config.panel_color.border))
|
||||
local dock = tab:CreateTexture(nil, 'OVERLAY')
|
||||
dock:SetHeight(3)
|
||||
if position == 'TOP' then
|
||||
if orientation == 'UP' then
|
||||
dock:SetPoint('BOTTOMLEFT', 1, -1)
|
||||
dock:SetPoint('BOTTOMRIGHT', -1, -1)
|
||||
else
|
||||
elseif orientation == 'DOWN' then
|
||||
dock:SetPoint('TOPLEFT', 1, 1)
|
||||
dock:SetPoint('TOPRIGHT', -1, 1)
|
||||
end
|
||||
@@ -150,7 +154,7 @@ do
|
||||
tab.text:SetPoint('RIGHT', -3, -1)
|
||||
tab.text:SetJustifyH('CENTER')
|
||||
tab.text:SetJustifyV('CENTER')
|
||||
tab.text:SetFont(m.config.font, 18)
|
||||
tab.text:SetFont(m.config.font, m.config.large_font_size)
|
||||
tab:SetFontString(tab.text)
|
||||
|
||||
tab:SetText(text)
|
||||
@@ -163,15 +167,15 @@ do
|
||||
end)
|
||||
|
||||
if getn(self.tabs) == 0 then
|
||||
if position == 'TOP' then
|
||||
if orientation == 'UP' then
|
||||
tab:SetPoint('BOTTOMLEFT', self.frame, 'TOPLEFT', 4, -1)
|
||||
else
|
||||
elseif orientation == 'DOWN' then
|
||||
tab:SetPoint('TOPLEFT', self.frame, 'BOTTOMLEFT', 4, 1)
|
||||
end
|
||||
else
|
||||
if position == 'TOP' then
|
||||
if orientation == 'UP' then
|
||||
tab:SetPoint('BOTTOMLEFT', self.tabs[getn(self.tabs)], 'BOTTOMRIGHT', 4, 0)
|
||||
else
|
||||
elseif orientation == 'DOWN' then
|
||||
tab:SetPoint('TOPLEFT', self.tabs[getn(self.tabs)], 'TOPRIGHT', 4, 0)
|
||||
end
|
||||
end
|
||||
@@ -217,7 +221,7 @@ function public.editbox(parent)
|
||||
editbox:SetTextInsets(0, 0, 3, 3)
|
||||
editbox:SetMaxLetters(256)
|
||||
editbox:SetHeight(19)
|
||||
editbox:SetFont(m.config.font, m.config.normal_font_size)
|
||||
editbox:SetFont(m.config.font, m.config.medium_font_size)
|
||||
editbox:SetShadowColor(0, 0, 0, 0)
|
||||
m.set_content_style(editbox)
|
||||
|
||||
@@ -339,7 +343,7 @@ end
|
||||
|
||||
function public.label(parent, size)
|
||||
local label = parent:CreateFontString()
|
||||
label:SetFont(m.config.font, size or m.config.normal_font_size)
|
||||
label:SetFont(m.config.font, size or m.config.medium_font_size)
|
||||
label:SetTextColor(unpack(m.config.label_color.enabled))
|
||||
return label
|
||||
end
|
||||
@@ -389,7 +393,7 @@ function public.dropdown(parent)
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
|
||||
text:SetPoint('LEFT', dropdown, 'LEFT', 8, 0)
|
||||
text:SetFont(m.config.font, 13)
|
||||
text:SetFont(m.config.font, m.config.small_font_size)
|
||||
text:SetShadowColor(0, 0, 0, 0)
|
||||
|
||||
--
|
||||
@@ -419,9 +423,9 @@ function public.dropdown(parent)
|
||||
return dropdown
|
||||
end
|
||||
|
||||
function public.slider(frame)
|
||||
function public.slider(parent)
|
||||
|
||||
local slider = CreateFrame('Slider', nil, frame)
|
||||
local slider = CreateFrame('Slider', nil, parent)
|
||||
slider:SetOrientation('HORIZONTAL')
|
||||
slider:SetHeight(6)
|
||||
slider:SetHitRectInsets(0, 0, -8, -8)
|
||||
@@ -439,7 +443,7 @@ function public.slider(frame)
|
||||
label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 6)
|
||||
label:SetJustifyH('LEFT')
|
||||
label:SetHeight(13)
|
||||
label:SetFont(m.config.font, 13)
|
||||
label:SetFont(m.config.font, m.config.small_font_size)
|
||||
label:SetTextColor(unpack(m.config.label_color.enabled))
|
||||
|
||||
local editbox = m.editbox(slider)
|
||||
@@ -485,7 +489,7 @@ end
|
||||
-- text:SetHeight(18)
|
||||
-- text:SetPoint('LEFT', checkbox, 'RIGHT')
|
||||
-- text:SetPoint('RIGHT')
|
||||
-- text:SetFont(m.config.font, m.config.normal_font_size)
|
||||
-- text:SetFont(m.config.font, m.config.medium_font_size)
|
||||
--
|
||||
-- checkbox.text = text
|
||||
-- return checkbox
|
||||
|
||||
@@ -1073,7 +1073,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
||||
local text = cell:CreateFontString()
|
||||
text:SetJustifyH('CENTER')
|
||||
text:SetJustifyV('CENTER')
|
||||
text:SetFont(Aux.gui.config.font, 12)
|
||||
text:SetFont(Aux.gui.config.font, Aux.gui.config.tiny_font_size)
|
||||
text:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
|
||||
cell:SetFontString(text)
|
||||
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
|
||||
|
||||
+2
-2
@@ -308,7 +308,7 @@ local methods = {
|
||||
|
||||
local text = col:CreateFontString()
|
||||
text:SetJustifyV('CENTER')
|
||||
text:SetFont(Aux.gui.config.font, Aux.gui.config.normal_font_size)
|
||||
text:SetFont(Aux.gui.config.font, Aux.gui.config.medium_font_size)
|
||||
text:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
|
||||
text:SetAllPoints()
|
||||
col.text = text
|
||||
@@ -394,7 +394,7 @@ local methods = {
|
||||
if st.sizes.headFontSize then
|
||||
col.text:SetFont(Aux.gui.config.font, st.sizes.headFontSize)
|
||||
else
|
||||
col.text:SetFont(Aux.gui.config.font, 15)
|
||||
col.text:SetFont(Aux.gui.config.font, Aux.gui.config.medium_font_size)
|
||||
end
|
||||
end
|
||||
st:Redraw()
|
||||
|
||||
+11
-11
@@ -32,7 +32,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 13)
|
||||
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
|
||||
label:SetText('Show hidden items')
|
||||
private.show_hidden_checkbox = checkbox
|
||||
@@ -211,14 +211,14 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
|
||||
dropdown:SetWidth(90)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||
label:SetText('Duration')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
|
||||
dropdown:SetScript('OnShow', function()
|
||||
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
|
||||
end)
|
||||
local label = Aux.gui.label(dropdown, 15)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.medium_font_size)
|
||||
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
|
||||
private.deposit = label
|
||||
private.duration_dropdown = dropdown
|
||||
@@ -234,7 +234,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
m.write_settings(settings)
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 13)
|
||||
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
|
||||
label:SetText('Hide this item')
|
||||
private.hide_checkbox = checkbox
|
||||
@@ -268,16 +268,16 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
this:SetText(Aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
end)
|
||||
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
|
||||
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
|
||||
editbox.pretty:SetAllPoints()
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Starting Price')
|
||||
end
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
@@ -312,16 +312,16 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
this:SetText(Aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
end)
|
||||
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
|
||||
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
|
||||
editbox.pretty:SetAllPoints()
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Buyout Price')
|
||||
end
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
@@ -343,7 +343,7 @@ Aux.post_tab.FRAMES(function(m, public, private)
|
||||
m.set_unit_buyout_price(this.amount)
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(btn, 13)
|
||||
local label = Aux.gui.label(btn, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Historical Value')
|
||||
private.historical_value_button = btn
|
||||
|
||||
+14
-14
@@ -84,7 +84,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
this:SetBackdropColor(unpack(Aux.gui.config.off_color))
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 15)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
|
||||
label:SetText('Pages')
|
||||
label:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
|
||||
@@ -110,7 +110,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
this:SetBackdropColor(unpack(Aux.gui.config.off_color))
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 16)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
label:SetTextColor(unpack(Aux.gui.config.text_color.enabled))
|
||||
@@ -387,7 +387,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Name')
|
||||
private.name_input = editbox
|
||||
@@ -397,7 +397,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 10, 0)
|
||||
local label = Aux.gui.label(checkbox, 13)
|
||||
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
|
||||
label:SetText('Exact')
|
||||
private.exact_checkbox = checkbox
|
||||
@@ -416,7 +416,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Level Range')
|
||||
private.min_level_input = editbox
|
||||
@@ -435,8 +435,8 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', Aux.f(editbox.ClearFocus, editbox))
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
local label = Aux.gui.label(editbox, Aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
||||
label:SetText('-')
|
||||
private.max_level_input = editbox
|
||||
end
|
||||
@@ -445,7 +445,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 10, 0)
|
||||
local label = Aux.gui.label(checkbox, 13)
|
||||
local label = Aux.gui.label(checkbox, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', 1, -3)
|
||||
label:SetText('Usable')
|
||||
private.usable_checkbox = checkbox
|
||||
@@ -455,7 +455,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||
label:SetText('Item Class')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
|
||||
@@ -469,7 +469,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||
label:SetText('Item Subclass')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
|
||||
@@ -483,7 +483,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||
label:SetText('Item Slot')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
|
||||
@@ -497,7 +497,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22)
|
||||
dropdown:SetWidth(300)
|
||||
dropdown:SetHeight(10)
|
||||
local label = Aux.gui.label(dropdown, 13)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||
label:SetText('Min Rarity')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
|
||||
@@ -517,7 +517,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown)
|
||||
end)
|
||||
getglobal(dropdown:GetName()..'Text'):Hide()
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.normal_font_size)
|
||||
local label = Aux.gui.label(dropdown, Aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
|
||||
label:SetText('Post Filter')
|
||||
private.filter_dropdown = dropdown
|
||||
@@ -557,7 +557,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
Aux.gui.set_content_style(frame)
|
||||
local scale_frame = CreateFrame('Frame', nil, frame)
|
||||
scale_frame:SetAllPoints()
|
||||
local display = Aux.gui.label(scale_frame, 18)
|
||||
local display = Aux.gui.label(scale_frame, Aux.gui.config.large_font_size)
|
||||
display:SetAllPoints()
|
||||
display:SetJustifyH('LEFT')
|
||||
display:SetJustifyV('TOP')
|
||||
|
||||
Reference in New Issue
Block a user