mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Added form object
This commit is contained in:
parent
dbe1ba8170
commit
dbe681ab52
@ -21,6 +21,7 @@ Version 0.9.6.4 - Alpha (Release Date TBD)
|
||||
[ADDED] a new util library function: TableHasValue(table, value)
|
||||
[ADDED] a new util library function: GetHoverObject()
|
||||
[ADDED] a new callback: textinput(text)
|
||||
[ADDED] a new object: form
|
||||
[ADDED] basic clipboard support for the textinput object (0.9.0 only)
|
||||
[ADDED] custom cursor support for the textinput object
|
||||
[ADDED] support for love.filesystem changes to loveframes.util.GetDirectoryContents (0.9.0 only)
|
||||
|
7
init.lua
7
init.lua
@ -123,10 +123,6 @@ function loveframes.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
loveframes.collisions = {}
|
||||
|
||||
base:update(dt)
|
||||
|
||||
if version == "0.9.0" then
|
||||
local hoverobject = loveframes.hoverobject
|
||||
if hoverobject then
|
||||
@ -154,6 +150,9 @@ function loveframes.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
loveframes.collisions = {}
|
||||
base:update(dt)
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- button class
|
||||
-- button object
|
||||
local newobject = loveframes.NewObject("button", "loveframes_object_button", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- checkbox class
|
||||
-- checkbox object
|
||||
local newobject = loveframes.NewObject("checkbox", "loveframes_object_checkbox", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- collapsiblecategory class
|
||||
-- collapsiblecategory object
|
||||
local newobject = loveframes.NewObject("collapsiblecategory", "loveframes_object_collapsiblecategory", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- columnlist class
|
||||
-- columnlist object
|
||||
local newobject = loveframes.NewObject("columnlist", "loveframes_object_columnlist", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
333
objects/form.lua
Normal file
333
objects/form.lua
Normal file
@ -0,0 +1,333 @@
|
||||
--[[------------------------------------------------
|
||||
-- Love Frames - A GUI library for LOVE --
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- form object
|
||||
local newobject = loveframes.NewObject("form", "loveframes_object_form", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: initialize()
|
||||
- desc: initializes the object
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:initialize()
|
||||
|
||||
self.type = "form"
|
||||
self.name = "Form"
|
||||
self.layout = "vertical"
|
||||
self.width = 200
|
||||
self.height = 50
|
||||
self.padding = 5
|
||||
self.spacing = 5
|
||||
self.topmargin = 12
|
||||
self.internal = false
|
||||
self.children = {}
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: update(deltatime)
|
||||
- desc: updates the element
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:update(dt)
|
||||
|
||||
local state = loveframes.state
|
||||
local selfstate = self.state
|
||||
|
||||
if state ~= selfstate then
|
||||
return
|
||||
end
|
||||
|
||||
local visible = self.visible
|
||||
local alwaysupdate = self.alwaysupdate
|
||||
|
||||
if not visible then
|
||||
if not alwaysupdate then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local children = self.children
|
||||
local parent = self.parent
|
||||
local base = loveframes.base
|
||||
local update = self.Update
|
||||
|
||||
-- move to parent if there is a parent
|
||||
if parent ~= base and parent.type ~= "list" then
|
||||
self.x = self.parent.x + self.staticx
|
||||
self.y = self.parent.y + self.staticy
|
||||
end
|
||||
|
||||
self:CheckHover()
|
||||
|
||||
for k, v in ipairs(children) do
|
||||
v:update(dt)
|
||||
end
|
||||
|
||||
if update then
|
||||
update(self, dt)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: draw()
|
||||
- desc: draws the object
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:draw()
|
||||
|
||||
local state = loveframes.state
|
||||
local selfstate = self.state
|
||||
|
||||
if state ~= selfstate then
|
||||
return
|
||||
end
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
if not visible then
|
||||
return
|
||||
end
|
||||
|
||||
local children = self.children
|
||||
local skins = loveframes.skins.available
|
||||
local skinindex = loveframes.config["ACTIVESKIN"]
|
||||
local defaultskin = loveframes.config["DEFAULTSKIN"]
|
||||
local selfskin = self.skin
|
||||
local skin = skins[selfskin] or skins[skinindex]
|
||||
local drawfunc = skin.DrawForm or skins[defaultskin].DrawForm
|
||||
local draw = self.Draw
|
||||
local drawcount = loveframes.drawcount
|
||||
|
||||
-- set the object's draw order
|
||||
self:SetDrawOrder()
|
||||
|
||||
if draw then
|
||||
draw(self)
|
||||
else
|
||||
drawfunc(self)
|
||||
end
|
||||
|
||||
-- loop through the object's children and draw them
|
||||
for k, v in ipairs(children) do
|
||||
v:draw()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: mousepressed(x, y, button)
|
||||
- desc: called when the player presses a mouse button
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:mousepressed(x, y, button)
|
||||
|
||||
local state = loveframes.state
|
||||
local selfstate = self.state
|
||||
|
||||
if state ~= selfstate then
|
||||
return
|
||||
end
|
||||
|
||||
local visible = self.visible
|
||||
|
||||
if not visible then
|
||||
return
|
||||
end
|
||||
|
||||
local children = self.children
|
||||
local hover = self.hover
|
||||
|
||||
if hover and button == "l" then
|
||||
local baseparent = self:GetBaseParent()
|
||||
if baseparent and baseparent.type == "frame" then
|
||||
baseparent:MakeTop()
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in ipairs(children) do
|
||||
v:mousepressed(x, y, button)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: mousereleased(x, y, button)
|
||||
- desc: called when the player releases a mouse button
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:mousereleased(x, y, button)
|
||||
|
||||
local state = loveframes.state
|
||||
local selfstate = self.state
|
||||
|
||||
if state ~= selfstate then
|
||||
return
|
||||
end
|
||||
|
||||
local visible = self.visible
|
||||
local children = self.children
|
||||
|
||||
if not visible then
|
||||
return
|
||||
end
|
||||
|
||||
for k, v in ipairs(children) do
|
||||
v:mousereleased(x, y, button)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: AddItem(object)
|
||||
- desc: adds an item to the object
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:AddItem(object)
|
||||
|
||||
local objtype = object.type
|
||||
if objtype == "frame" then
|
||||
return
|
||||
end
|
||||
|
||||
local children = self.children
|
||||
local state = self.state
|
||||
|
||||
object:Remove()
|
||||
object.parent = self
|
||||
object:SetState(state)
|
||||
|
||||
table.insert(children, object)
|
||||
self:LayoutObjects()
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: RemoveItem(object or number)
|
||||
- desc: removes an item from the object
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:RemoveItem(data)
|
||||
|
||||
local dtype = type(data)
|
||||
|
||||
if dtype == "number" then
|
||||
local children = self.children
|
||||
local item = children[data]
|
||||
if item then
|
||||
item:Remove()
|
||||
end
|
||||
else
|
||||
data:Remove()
|
||||
end
|
||||
|
||||
self:LayoutObjects()
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: LayoutObjects()
|
||||
- desc: positions the object's children and calculates
|
||||
a new size for the object
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:LayoutObjects()
|
||||
|
||||
local layout = self.layout
|
||||
local padding = self.padding
|
||||
local spacing = self.spacing
|
||||
local topmargin = self.topmargin
|
||||
local children = self.children
|
||||
local width = padding * 2
|
||||
local height = padding * 2 + topmargin
|
||||
local x = padding
|
||||
local y = padding + topmargin
|
||||
|
||||
if layout == "vertical" then
|
||||
local largest_width = 0
|
||||
for k, v in ipairs(children) do
|
||||
v.staticx = x
|
||||
v.staticy = y
|
||||
y = y + v.height + spacing
|
||||
height = height + v.height + spacing
|
||||
if v.width > largest_width then
|
||||
largest_width = v.width
|
||||
end
|
||||
end
|
||||
height = height - spacing
|
||||
self.width = width + largest_width
|
||||
self.height = height
|
||||
elseif layout == "horizontal" then
|
||||
local largest_height = 0
|
||||
for k, v in ipairs(children) do
|
||||
v.staticx = x
|
||||
v.staticy = y
|
||||
x = x + v.width + spacing
|
||||
width = width + v.width + spacing
|
||||
if v.height > largest_height then
|
||||
largest_height = v.height
|
||||
end
|
||||
end
|
||||
width = width - spacing
|
||||
self.width = width
|
||||
self.height = height + largest_height
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetLayoutType(ltype)
|
||||
- desc: sets the object's layout type
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetLayoutType(ltype)
|
||||
|
||||
self.layout = ltype
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetLayoutType()
|
||||
- desc: gets the object's layout type
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetLayoutType()
|
||||
|
||||
return self.layout
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetTopMargin(margin)
|
||||
- desc: sets the margin between the top of the object
|
||||
and its children
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetTopMargin(margin)
|
||||
|
||||
self.topmargin = margin
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetTopMargin()
|
||||
- desc: gets the margin between the top of the object
|
||||
and its children
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetTopMargin()
|
||||
|
||||
return self.topmargin
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetName(name)
|
||||
- desc: sets the object's name
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetName(name)
|
||||
|
||||
self.name = name
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetName()
|
||||
- desc: gets the object's name
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetName()
|
||||
|
||||
return self.name
|
||||
|
||||
end
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- frame class
|
||||
-- frame object
|
||||
local newobject = loveframes.NewObject("frame", "loveframes_object_frame", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
@ -453,7 +453,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetName(name)
|
||||
- desc: sets the frame's name
|
||||
- desc: sets the object's name
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetName(name)
|
||||
|
||||
@ -463,7 +463,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetName()
|
||||
- desc: gets the frame's name
|
||||
- desc: gets the object's name
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetName()
|
||||
|
||||
@ -473,7 +473,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetDraggable(true/false)
|
||||
- desc: sets whether the frame can be dragged or not
|
||||
- desc: sets whether the object can be dragged or not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetDraggable(bool)
|
||||
|
||||
@ -483,7 +483,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetDraggable()
|
||||
- desc: gets whether the frame can be dragged ot not
|
||||
- desc: gets whether the object can be dragged ot not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetDraggable()
|
||||
|
||||
@ -494,7 +494,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetScreenLocked(bool)
|
||||
- desc: sets whether the frame can be moved passed the
|
||||
- desc: sets whether the object can be moved passed the
|
||||
boundaries of the window or not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetScreenLocked(bool)
|
||||
@ -505,7 +505,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetScreenLocked()
|
||||
- desc: gets whether the frame can be moved passed the
|
||||
- desc: gets whether the object can be moved passed the
|
||||
boundaries of window or not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetScreenLocked()
|
||||
@ -516,7 +516,8 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: ShowCloseButton(bool)
|
||||
- desc: sets whether the close button should be drawn
|
||||
- desc: sets whether the object's close button should
|
||||
be drawn
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:ShowCloseButton(bool)
|
||||
|
||||
@ -574,8 +575,8 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetModal(bool)
|
||||
- desc: makes the object the top object in the drawing
|
||||
order
|
||||
- desc: sets whether or not the object is in a modal
|
||||
state
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetModal(bool)
|
||||
|
||||
@ -647,7 +648,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetParentLocked(bool)
|
||||
- desc: sets whether the frame can be moved passed the
|
||||
- desc: sets whether the object can be moved passed the
|
||||
boundaries of its parent or not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetParentLocked(bool)
|
||||
@ -658,7 +659,7 @@ end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetParentLocked(bool)
|
||||
- desc: gets whether the frame can be moved passed the
|
||||
- desc: gets whether the object can be moved passed the
|
||||
boundaries of its parent or not
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetParentLocked()
|
||||
@ -700,7 +701,8 @@ end
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetDockable(dockable)
|
||||
- desc: sets whether or not the object can dock onto
|
||||
another from or be docked by another frame
|
||||
another object of its type or be docked
|
||||
by another object of its type
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetDockable(dockable)
|
||||
|
||||
@ -711,7 +713,8 @@ end
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetDockable()
|
||||
- desc: gets whether or not the object can dock onto
|
||||
another from or be docked by another frame
|
||||
another object of its type or be docked
|
||||
by another object of its type
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:GetDockable()
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- button class
|
||||
-- grid object
|
||||
local newobject = loveframes.NewObject("grid", "loveframes_object_grid", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- progressbar class
|
||||
-- image object
|
||||
local newobject = loveframes.NewObject("image", "loveframes_object_image", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- imagebutton class
|
||||
-- imagebutton object
|
||||
local newobject = loveframes.NewObject("imagebutton", "loveframes_object_imagebutton", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -340,9 +340,9 @@ function newobject:Sort(column, desc)
|
||||
|
||||
table.sort(children, function(a, b)
|
||||
if desc then
|
||||
return (tonumber(a.columndata[column]) or a.columndata[column]) < (tonumber(b.columndata[column]) or b.columndata[column])
|
||||
return (tostring(a.columndata[column]) or a.columndata[column]) < (tostring(b.columndata[column]) or b.columndata[column])
|
||||
else
|
||||
return (tonumber(a.columndata[column]) or a.columndata[column]) > (tonumber(b.columndata[column]) or b.columndata[column])
|
||||
return (tostring(a.columndata[column]) or a.columndata[column]) > (tostring(b.columndata[column]) or b.columndata[column])
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- list class
|
||||
-- list object
|
||||
local newobject = loveframes.NewObject("list", "loveframes_object_list", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
@ -249,7 +249,8 @@ end
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:AddItem(object)
|
||||
|
||||
if object.type == "frame" then
|
||||
local objtype = object.type
|
||||
if objtype == "frame" then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- multichoice class
|
||||
-- multichoice object
|
||||
local newobject = loveframes.NewObject("multichoice", "loveframes_object_multichoice", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- numberbox class
|
||||
-- numberbox object
|
||||
local newobject = loveframes.NewObject("numberbox", "loveframes_object_numberbox", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- panel class
|
||||
-- panel object
|
||||
local newobject = loveframes.NewObject("panel", "loveframes_object_panel", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- progressbar class
|
||||
-- progressbar object
|
||||
local newobject = loveframes.NewObject("progressbar", "loveframes_object_progressbar", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- slider class
|
||||
-- slider object
|
||||
local newobject = loveframes.NewObject("slider", "loveframes_object_slider", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- tabs class
|
||||
-- tabs object
|
||||
local newobject = loveframes.NewObject("tabs", "loveframes_object_tabs", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
experimental and not final
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- text class
|
||||
-- text object
|
||||
local newobject = loveframes.NewObject("text", "loveframes_object_text", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
@ -39,6 +39,10 @@ function newobject:initialize()
|
||||
self.OnClickLink = nil
|
||||
|
||||
local skin = loveframes.util.GetActiveSkin()
|
||||
if not skin then
|
||||
skin = loveframes.config["DEFAULTSKIN"]
|
||||
end
|
||||
|
||||
local directives = skin.directives
|
||||
if directives then
|
||||
local text_default_color = directives.text_default_color
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Copyright (c) 2013 Kenny Shields --
|
||||
--]]------------------------------------------------
|
||||
|
||||
-- textinput class
|
||||
-- textinput object
|
||||
local newobject = loveframes.NewObject("textinput", "loveframes_object_textinput", true)
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
|
@ -134,8 +134,12 @@ skin.controls.modalbackground_body_color = {255, 255, 255, 100}
|
||||
skin.controls.linenumberspanel_text_color = {170, 170, 170, 255}
|
||||
skin.controls.linenumberspanel_body_color = {235, 235, 235, 255}
|
||||
|
||||
-- form
|
||||
skin.controls.form_text_color = {0, 0, 0, 255}
|
||||
skin.controls.form_text_font = smallfont
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: OutlinedRectangle(object)
|
||||
- func: OutlinedRectangle(x, y, width, height, ovt, ovb, ovl, ovr)
|
||||
- desc: creates and outlined rectangle
|
||||
--]]---------------------------------------------------------
|
||||
function skin.OutlinedRectangle(x, y, width, height, ovt, ovb, ovl, ovr)
|
||||
@ -1627,5 +1631,34 @@ function skin.DrawGrid(object)
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: skin.DrawForm(object)
|
||||
- desc: draws the form object
|
||||
--]]---------------------------------------------------------
|
||||
function skin.DrawForm(object)
|
||||
|
||||
local x = object:GetX()
|
||||
local y = object:GetY()
|
||||
local width = object:GetWidth()
|
||||
local height = object:GetHeight()
|
||||
local topmargin = object.topmargin
|
||||
local name = object.name
|
||||
local font = skin.controls.form_text_font
|
||||
local textcolor = skin.controls.form_text_color
|
||||
local twidth = font:getWidth(name)
|
||||
|
||||
love.graphics.setFont(font)
|
||||
love.graphics.setColor(textcolor)
|
||||
love.graphics.print(name, x + 7, y)
|
||||
|
||||
love.graphics.setColor(bordercolor)
|
||||
love.graphics.rectangle("fill", x, y + 7, 5, 1)
|
||||
love.graphics.rectangle("fill", x + twidth + 9, y + 7, width - (twidth + 9), 1)
|
||||
love.graphics.rectangle("fill", x, y + height, width, 1)
|
||||
love.graphics.rectangle("fill", x, y + 7, 1, height - 7)
|
||||
love.graphics.rectangle("fill", x + width - 1, y + 7, 1, height - 7)
|
||||
|
||||
end
|
||||
|
||||
-- register the skin
|
||||
loveframes.skins.Register(skin)
|
||||
|
Loading…
Reference in New Issue
Block a user