Skip to content

Instantly share code, notes, and snippets.

@Industrial
Created March 23, 2010 22:05
Show Gist options
  • Save Industrial/7887be32564ddd737535 to your computer and use it in GitHub Desktop.
Save Industrial/7887be32564ddd737535 to your computer and use it in GitHub Desktop.
local _G = _G
local TL, TC, TR = 'TOPLEFT', 'TOP', 'TOPRIGHT'
local ML, MC, MR = 'LEFT', 'CENTER', 'RIGHT'
local BL, BC, BR = 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT'
local CreateFrame = _G.CreateFrame
local M = _G.idAddon:NewModule(
'ChatFrame',
'AceConsole-3.0',
'AceEvent-3.0'
)
local frame_width = 400
local frame_height = 300
function M:OnInitialize()
local frame = CreateFrame('Frame', nil, UIParent)
frame:SetWidth(frame_width)
frame:SetHeight(frame_height)
frame:SetPoint(MC, UIParent, MC)
frame:Show()
frame:SetBackdrop({
bgFile = 'Interface/Tooltips/UI-Tooltip-Background',
edgeFile = '',
tile = true,
tileSize = 16,
edgeSize = 0,
insets = {
left = 0,
right = 0,
top = 0,
bottom = 0
}
})
frame:SetBackdropColor(0, 0, 0, 1)
local scroll_frame = CreateFrame('ScrollFrame', nil, frame)
scroll_frame:SetAllPoints(frame)
local scroll_child = CreateFrame('Frame', nil, scroll_frame)
scroll_frame:SetScrollChild(scroll_child)
local padding = 5
local spacing = 0
local line_height = 20
local lines = {}
local line
for i = 1, 50 do
line = CreateFrame('Frame', nil, scroll_child)
line:SetWidth(frame_width - padding * 2)
line:SetHeight(20)
line:Show()
line.text = line:CreateFontString(nil, 'ARTWORK', 'GameFontNormal')
line.text:SetPoint(ML, line, ML)
line.text:SetPoint(MR, line, MR)
line.text:SetText('test test test test test test')
if i == 1 then
line:SetPoint(TL, scroll_child, TL, padding, -padding)
else
line:SetPoint(TL, lines[i - 1], BL, 0, -spacing)
end
lines[i] = line
end
end
function M:OnEnable()
end
function M:OnDisable()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment