[tekui-devel] tekui: Area, Element, Frame, Gadget, Group, Object, Text, TextIn...
Timm S. Mueller
tmueller at neoscientists.org
Tue Apr 1 15:36:29 CEST 2008
details: http://hg.teklib.org/tekui/rev/c2f8cda82ef4
changeset: 397:c2f8cda82ef4
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Mon Mar 31 18:19:39 2008 +0200
description:
Area, Element, Frame, Gadget, Group, Object, Text, TextInput, Tunnel, Window:
Added init() function; Element: getPrivate() changed yet again, now using a
regular member instead of a metatable; Focus, Hilite yet again moved from
Gadget to Frame; PopItem:preparePopup() now invokes child:init(); TextInput:
inherits from Text, no need to initialize Font itself
diffs (truncated from 677 to 100 lines):
diff -r 76a695f31d7f -r c2f8cda82ef4 tek/class/ui/area.lua
--- a/tek/class/ui/area.lua Sun Mar 30 17:44:05 2008 +0200
+++ b/tek/class/ui/area.lua Mon Mar 31 18:19:39 2008 +0200
@@ -34,7 +34,7 @@ local floor = math.floor
local floor = math.floor
module("tek.class.ui.area", tek.class.ui.element)
-_VERSION = "Area 5.6"
+_VERSION = "Area 5.7"
local Area = _M
-------------------------------------------------------------------------------
@@ -48,24 +48,27 @@ local NOTIFY_WEIGHT = { ui.NOTIFY_SELF,
-- Class implementation:
-------------------------------------------------------------------------------
-function Area.new(class, self)
- self = self or { }
- self.Margin = self.Margin or false
- self.Redraw = false
+function Area.init(self)
self.Background = false
self.DamageRegion = false
self.Display = false
self.Drawable = false
+ self.HAlign = self.HAlign or 0
+ self.Margin = self.Margin or false
+ self.MarginAndBorder = { }
+ self.MaxHeight = self.MaxHeight or false
+ self.MaxWidth = self.MaxWidth or false
+ self.MinMax = { }
self.Rect = false
- self.MinMax = { }
- self.MarginAndBorder = { }
+ self.Redraw = false
+ self.TrackDamage = self.TrackDamage or false
+ self.VAlign = self.VAlign or 0
self.Weight = self.Weight or false
- self.TrackDamage = self.TrackDamage or false
- self.HAlign = self.HAlign or 0
- self.VAlign = self.VAlign or 0
- self.MaxWidth = self.MaxWidth or false
- self.MaxHeight = self.MaxHeight or false
- return Element.new(class, self)
+ return Element.init(self)
+end
+
+function Area.new(class, self)
+ return Element.new(class, init(self or { }))
end
-------------------------------------------------------------------------------
diff -r 76a695f31d7f -r c2f8cda82ef4 tek/class/ui/element.lua
--- a/tek/class/ui/element.lua Sun Mar 30 17:44:05 2008 +0200
+++ b/tek/class/ui/element.lua Mon Mar 31 18:19:39 2008 +0200
@@ -20,14 +20,13 @@
--
-------------------------------------------------------------------------------
-local db = require "tek.lib.debug"
local ui = require "tek.lib.ui"
local Object = ui.Object
local assert = assert
local type = type
module("tek.class.ui.element", tek.class.ui.object)
-_VERSION = "Element 4.1"
+_VERSION = "Element 4.2"
local Element = _M
-------------------------------------------------------------------------------
@@ -43,31 +42,30 @@ NOTIFY_APPLICATION = function(val, self)
-- private = element:getPrivate(): Gets an element's private data.
-------------------------------------------------------------------------------
-local function havePrivate(self)
- return self.PrivateData
-end
-
-local function getPrivate(self)
- self.getPrivate = havePrivate
- local priv = { }
- self.PrivateData = priv
- return priv
+function Element:getPrivate()
+ local p = self.__PrivateData
+ if not p then
+ p = { }
+ self.__PrivateData = p
+ end
+ return p
end
-------------------------------------------------------------------------------
-- Class implementation:
-------------------------------------------------------------------------------
-function Element.new(class, self)
- self = self or { }
+function Element.init(self)
More information about the tekui-devel
mailing list