refactoring
This commit is contained in:
@@ -60,7 +60,7 @@ function item_column_init(rt, cell)
|
||||
text:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
end
|
||||
|
||||
public.search_config = {
|
||||
M.search_config = {
|
||||
{
|
||||
title = 'Item',
|
||||
width = .35,
|
||||
@@ -230,7 +230,7 @@ public.search_config = {
|
||||
},
|
||||
}
|
||||
|
||||
public.auctions_config = {
|
||||
M.auctions_config = {
|
||||
{
|
||||
title = 'Item',
|
||||
width = .35,
|
||||
@@ -377,7 +377,7 @@ public.auctions_config = {
|
||||
},
|
||||
}
|
||||
|
||||
public.bids_config = {
|
||||
M.bids_config = {
|
||||
{
|
||||
title = 'Item',
|
||||
width = .35,
|
||||
@@ -548,11 +548,11 @@ function percentage_color(pct)
|
||||
end
|
||||
end
|
||||
|
||||
function public.percentage_historical(pct, bid)
|
||||
function M.percentage_historical(pct, bid)
|
||||
return (bid and inline_color.gray or percentage_color(pct)) .. (pct > 10000 and '>10000' or pct) .. '%' .. FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
function public.time_left(code)
|
||||
function M.time_left(code)
|
||||
return TIME_LEFT_STRINGS[code]
|
||||
end
|
||||
|
||||
@@ -984,7 +984,7 @@ local methods = {
|
||||
end,
|
||||
}
|
||||
|
||||
function public.CreateAuctionResultsTable(parent, config)
|
||||
function M.CreateAuctionResultsTable(parent, config)
|
||||
|
||||
RT_COUNT = RT_COUNT + 1
|
||||
local rt = CreateFrame('Frame', nil, parent)
|
||||
|
||||
+23
-23
@@ -3,9 +3,9 @@ module 'aux.gui'
|
||||
include 'green_t'
|
||||
include 'aux'
|
||||
|
||||
public.font = [[Fonts\ARIALN.TTF]]
|
||||
M.font = [[Fonts\ARIALN.TTF]]
|
||||
|
||||
public.font_size = {
|
||||
M.font_size = {
|
||||
small = 13,
|
||||
medium = 15,
|
||||
large = 18,
|
||||
@@ -87,7 +87,7 @@ end
|
||||
|
||||
do
|
||||
local id = 1
|
||||
function public.get_unique_name()
|
||||
function M.get_unique_name()
|
||||
id = id + 1
|
||||
return 'AuxFrame' .. id
|
||||
end
|
||||
@@ -108,7 +108,7 @@ do
|
||||
end
|
||||
return orig()
|
||||
end)
|
||||
public.menu = vararg-function(arg)
|
||||
M.menu = vararg-function(arg)
|
||||
structure = perm-arg
|
||||
local x, y = GetCursorPosition()
|
||||
menu:ClearAllPoints()
|
||||
@@ -117,36 +117,36 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function public.set_size(frame, width, height)
|
||||
function M.set_size(frame, width, height)
|
||||
frame:SetWidth(width)
|
||||
frame:SetHeight(height or width)
|
||||
end
|
||||
|
||||
function public.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom)
|
||||
function M.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom)
|
||||
frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
|
||||
frame:SetBackdropColor(backdrop_color())
|
||||
frame:SetBackdropBorderColor(border_color())
|
||||
end
|
||||
|
||||
function public.set_window_style(frame, left, right, top, bottom)
|
||||
function M.set_window_style(frame, left, right, top, bottom)
|
||||
set_frame_style(frame, color.window.background, color.window.border, left, right, top, bottom)
|
||||
end
|
||||
|
||||
function public.set_panel_style(frame, left, right, top, bottom)
|
||||
function M.set_panel_style(frame, left, right, top, bottom)
|
||||
set_frame_style(frame, color.panel.background, color.panel.border, left, right, top, bottom)
|
||||
end
|
||||
|
||||
function public.set_content_style(frame, left, right, top, bottom)
|
||||
function M.set_content_style(frame, left, right, top, bottom)
|
||||
set_frame_style(frame, color.content.background, color.content.border, left, right, top, bottom)
|
||||
end
|
||||
|
||||
function public.panel(parent)
|
||||
function M.panel(parent)
|
||||
local panel = CreateFrame('Frame', nil, parent)
|
||||
set_panel_style(panel)
|
||||
return panel
|
||||
end
|
||||
|
||||
function public.checkbutton(parent, text_height)
|
||||
function M.checkbutton(parent, text_height)
|
||||
local button = button(parent, text_height)
|
||||
button.state = false
|
||||
button:SetBackdropColor(color.state.disabled())
|
||||
@@ -165,7 +165,7 @@ function public.checkbutton(parent, text_height)
|
||||
return button
|
||||
end
|
||||
|
||||
function public.button(parent, text_height)
|
||||
function M.button(parent, text_height)
|
||||
text_height = text_height or font_size.large
|
||||
local button = CreateFrame('Button', nil, parent)
|
||||
set_size(button, 80, 24)
|
||||
@@ -283,7 +283,7 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
function public.tabs(parent, orientation)
|
||||
function M.tabs(parent, orientation)
|
||||
local self = {
|
||||
_frame = parent,
|
||||
_orientation = orientation,
|
||||
@@ -293,7 +293,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function public.editbox(parent)
|
||||
function M.editbox(parent)
|
||||
local editbox = CreateFrame('EditBox', nil, parent)
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetTextInsets(1.5, 1.5, 3, 3)
|
||||
@@ -370,7 +370,7 @@ function public.editbox(parent)
|
||||
return editbox
|
||||
end
|
||||
|
||||
function public.status_bar(parent)
|
||||
function M.status_bar(parent)
|
||||
local self = CreateFrame('Frame', nil, parent)
|
||||
local level = parent:GetFrameLevel()
|
||||
self:SetFrameLevel(level + 1)
|
||||
@@ -433,7 +433,7 @@ function public.status_bar(parent)
|
||||
return self
|
||||
end
|
||||
|
||||
function public.item(parent)
|
||||
function M.item(parent)
|
||||
local item = CreateFrame('Frame', nil, parent)
|
||||
set_size(item, 260, 40)
|
||||
local btn = CreateFrame('CheckButton', unique_name, item, 'ActionButtonTemplate')
|
||||
@@ -452,14 +452,14 @@ function public.item(parent)
|
||||
return item
|
||||
end
|
||||
|
||||
function public.label(parent, size)
|
||||
function M.label(parent, size)
|
||||
local label = parent:CreateFontString()
|
||||
label:SetFont(font, size or font_size.small)
|
||||
label:SetTextColor(color.label.enabled())
|
||||
return label
|
||||
end
|
||||
|
||||
function public.horizontal_line(parent, y_offset, inverted_color)
|
||||
function M.horizontal_line(parent, y_offset, inverted_color)
|
||||
local texture = parent:CreateTexture()
|
||||
texture:SetPoint('TOPLEFT', parent, 'TOPLEFT', 2, y_offset)
|
||||
texture:SetPoint('TOPRIGHT', parent, 'TOPRIGHT', -2, y_offset)
|
||||
@@ -472,7 +472,7 @@ function public.horizontal_line(parent, y_offset, inverted_color)
|
||||
return texture
|
||||
end
|
||||
|
||||
function public.vertical_line(parent, x_offset, top_offset, bottom_offset, inverted_color)
|
||||
function M.vertical_line(parent, x_offset, top_offset, bottom_offset, inverted_color)
|
||||
local texture = parent:CreateTexture()
|
||||
texture:SetPoint('TOPLEFT', parent, 'TOPLEFT', x_offset, top_offset or -2)
|
||||
texture:SetPoint('BOTTOMLEFT', parent, 'BOTTOMLEFT', x_offset, bottom_offset or 2)
|
||||
@@ -485,7 +485,7 @@ function public.vertical_line(parent, x_offset, top_offset, bottom_offset, inver
|
||||
return texture
|
||||
end
|
||||
|
||||
function public.dropdown(parent)
|
||||
function M.dropdown(parent)
|
||||
local dropdown = CreateFrame('Frame', unique_name, parent, 'UIDropDownMenuTemplate')
|
||||
set_content_style(dropdown, 0, 0, 4, 4)
|
||||
|
||||
@@ -509,7 +509,7 @@ function public.dropdown(parent)
|
||||
return dropdown
|
||||
end
|
||||
|
||||
function public.slider(parent)
|
||||
function M.slider(parent)
|
||||
|
||||
local slider = CreateFrame('Slider', nil, parent)
|
||||
slider:SetOrientation'HORIZONTAL'
|
||||
@@ -545,7 +545,7 @@ function public.slider(parent)
|
||||
return slider
|
||||
end
|
||||
|
||||
function public.checkbox(parent)
|
||||
function M.checkbox(parent)
|
||||
local checkbox = CreateFrame('CheckButton', nil, parent, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(16)
|
||||
checkbox:SetHeight(16)
|
||||
@@ -562,7 +562,7 @@ end
|
||||
do
|
||||
local editbox = CreateFrame'EditBox'
|
||||
editbox:SetAutoFocus(false)
|
||||
function public.clear_focus()
|
||||
function M.clear_focus()
|
||||
editbox:SetFocus()
|
||||
editbox:ClearFocus()
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ local gui = require 'aux.gui'
|
||||
|
||||
local ROW_HEIGHT = 39
|
||||
|
||||
function public.render(item_listing)
|
||||
function M.render(item_listing)
|
||||
|
||||
FauxScrollFrame_Update(item_listing.scroll_frame, getn(item_listing.item_records), getn(item_listing.rows), ROW_HEIGHT)
|
||||
local offset = FauxScrollFrame_GetOffset(item_listing.scroll_frame)
|
||||
@@ -41,7 +41,7 @@ function public.render(item_listing)
|
||||
end
|
||||
end
|
||||
|
||||
function public.create(parent, on_click, selected)
|
||||
function M.create(parent, on_click, selected)
|
||||
local content = CreateFrame('Frame', nil, parent)
|
||||
content:SetPoint('TOPLEFT', 0, -51)
|
||||
content:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||
@@ -113,7 +113,7 @@ function public.create(parent, on_click, selected)
|
||||
return item_listing
|
||||
end
|
||||
|
||||
function public.populate(item_listing, item_records)
|
||||
function M.populate(item_listing, item_records)
|
||||
item_listing.item_records = item_records
|
||||
render(item_listing)
|
||||
end
|
||||
|
||||
+1
-1
@@ -396,7 +396,7 @@ local methods = {
|
||||
end,
|
||||
}
|
||||
|
||||
function public.CreateScrollingTable(parent)
|
||||
function M.CreateScrollingTable(parent)
|
||||
-- create the base frame
|
||||
ST_COUNT = ST_COUNT + 1
|
||||
local st = CreateFrame('Frame', 'TSMScrollingTable' .. ST_COUNT, parent)
|
||||
|
||||
Reference in New Issue
Block a user