Version 0.9.4.14 - Alpha (see changelog.txt)

This commit is contained in:
Kenny Shields 2013-01-04 14:34:26 -05:00
parent 6c05801552
commit 7c8df81518
6 changed files with 56 additions and 9 deletions

View File

@ -1,3 +1,12 @@
================================================
Version 0.9.4.14 - Alpha (January 4 - 2013)
================================================
[ADDED] a new util library function: loveframes.util.CheckForUpdates() (note: this function is meant to be used by the developer and is never called internally by Love Frames)
[ADDED] a new callback for the tabbutton object: OnOpened(object)
[ADDED] a new callback for the tabbutton object: OnClosed(object)
[CHANGED] tabs:AddTab(name, object, tip, image) now accepts two new optional arguments for tabbutton callbacks (ex: tabs:AddTab(name, object, tip, image, onopened, onclosed))
================================================ ================================================
Version 0.9.4.13 - Alpha (January 4 - 2013) Version 0.9.4.13 - Alpha (January 4 - 2013)
================================================ ================================================

View File

@ -642,19 +642,17 @@ function loveframes.debug.ExamplesMenu()
local images = {"accept.png", "add.png", "application.png", "building.png", "bin.png", "database.png", "box.png", "brick.png"} local images = {"accept.png", "add.png", "application.png", "building.png", "bin.png", "database.png", "box.png", "brick.png"}
for i=1, 20 do for i=1, 20 do
local image = "resources/images/" .. images[math.random(1, #images)]
local panel1 = loveframes.Create("panel") local panel1 = loveframes.Create("panel")
panel1.Draw = function() panel1.Draw = function()
end end
local text1 = loveframes.Create("text", panel1) local text1 = loveframes.Create("text", panel1)
text1:SetText("Tab " ..i) text1:SetText("Tab " ..i)
tabs1:AddTab("Tab " ..i, panel1, "Tab " ..i, "resources/images/" ..images[math.random(1, #images)]) tabs1:AddTab("Tab " ..i, panel1, "Tab " ..i, image)
text1:SetAlwaysUpdate(true) text1:SetAlwaysUpdate(true)
text1.Update = function(object, dt) text1.Update = function(object, dt)
object:Center() object:Center()
end end
end end
end end

View File

@ -9,7 +9,7 @@ loveframes = {}
-- library info -- library info
loveframes.info = {} loveframes.info = {}
loveframes.info.author = "Kenny Shields" loveframes.info.author = "Kenny Shields"
loveframes.info.version = "0.9.4.13" loveframes.info.version = "0.9.4.14"
loveframes.info.stage = "Alpha" loveframes.info.stage = "Alpha"
-- library configurations -- library configurations

View File

@ -10,7 +10,7 @@ local newobject = loveframes.NewObject("tabbutton", "loveframes_object_tabbutton
- func: initialize() - func: initialize()
- desc: initializes the object - desc: initializes the object
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:initialize(parent, text, tabnumber, tip, image) function newobject:initialize(parent, text, tabnumber, tip, image, onopened, onclosed)
self.type = "tabbutton" self.type = "tabbutton"
self.font = loveframes.smallfont self.font = loveframes.smallfont
@ -24,6 +24,8 @@ function newobject:initialize(parent, text, tabnumber, tip, image)
self.internal = true self.internal = true
self.down = false self.down = false
self.image = nil self.image = nil
self.OnOpened = nil
self.OnClosed = nil
if tip then if tip then
self.tooltip = loveframes.objects["tooltip"]:new(self, tip) self.tooltip = loveframes.objects["tooltip"]:new(self, tip)
@ -35,6 +37,14 @@ function newobject:initialize(parent, text, tabnumber, tip, image)
self:SetImage(image) self:SetImage(image)
end end
if onopened then
self.OnOpened = onopened
end
if onclosed then
self.OnClosed = onclosed
end
-- apply template properties to the object -- apply template properties to the object
loveframes.templates.ApplyToObject(self) loveframes.templates.ApplyToObject(self)
@ -148,7 +158,18 @@ function newobject:mousereleased(x, y, button)
if hover and button == "l" then if hover and button == "l" then
if button == "l" then if button == "l" then
local tab = self.parent.tab
local internals = parent.internals
local onopened = self.OnOpened
local prevtab = internals[tab]
local onclosed = prevtab.OnClosed
parent:SwitchToTab(tabnumber) parent:SwitchToTab(tabnumber)
if onopened then
onopened(self)
end
if onclosed then
onclosed(prevtab)
end
end end
end end

View File

@ -26,7 +26,6 @@ function newobject:initialize()
self.autosize = true self.autosize = true
self.internal = false self.internal = false
self.tooltipfont = loveframes.basicfontsmall self.tooltipfont = loveframes.basicfontsmall
self.tabs = {}
self.internals = {} self.internals = {}
self.children = {} self.children = {}
@ -239,7 +238,7 @@ end
- func: AddTab(name, object, tip, image) - func: AddTab(name, object, tip, image)
- desc: adds a new tab to the tab panel - desc: adds a new tab to the tab panel
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:AddTab(name, object, tip, image) function newobject:AddTab(name, object, tip, image, onopened, onclosed)
local padding = self.padding local padding = self.padding
local autosize = self.autosize local autosize = self.autosize
@ -253,7 +252,7 @@ function newobject:AddTab(name, object, tip, image)
object.staticy = 0 object.staticy = 0
table.insert(self.children, object) table.insert(self.children, object)
internals[tabnumber] = loveframes.objects["tabbutton"]:new(self, name, tabnumber, tip, image) internals[tabnumber] = loveframes.objects["tabbutton"]:new(self, name, tabnumber, tip, image, onopened, onclosed)
self.tabnumber = tabnumber + 1 self.tabnumber = tabnumber + 1
for k, v in ipairs(internals) do for k, v in ipairs(internals) do

View File

@ -257,4 +257,24 @@ function loveframes.util.Error(message)
error("[Love Frames] " ..message) error("[Love Frames] " ..message)
end
--[[---------------------------------------------------------
- func: loveframes.util.CheckForUpdates()
- desc: checks for more recent versions of Love Frames
--]]---------------------------------------------------------
function loveframes.util.CheckForUpdates()
local info = loveframes.info
local version = info.version
local stage = info.stage
local socket = require("socket.http")
local b, c, h = socket.request("http://update.nikolairesokav.com/?id=loveframes&version=" ..version.. "&stage=" ..stage)
if c == 200 then
return b
else
return "An error occurred while checking for updates. Please try again later."
end
end end