[tekui-devel] tekui: example class written in C added; ScrollGroup: setWidth/H...

Timm S. Mueller tmueller at neoscientists.org
Mon May 5 03:51:13 CEST 2008


details:   http://hg.teklib.org/tekui/rev/9f045ef547be
changeset: 465:9f045ef547be
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Sun May 04 13:49:10 2008 +0200
description:
example class written in C added; ScrollGroup: setWidth/Height/Top/Left
renamed to onSetWidth/Height/...; FloatText, List: now using setValue() to
change scrollgroup width/height; List: some refresh problems fixed

diffs (truncated from 328 to 100 lines):

diff -r 3fbfb8d28bee -r 9f045ef547be tek/class/example.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tek/class/example.c	Sun May 04 13:49:10 2008 +0200
@@ -0,0 +1,55 @@
+
+/*
+**	example.c
+**	Written by Timm S. Mueller <tmueller at schulze-mueller.de>
+**	See copyright notice in COPYRIGHT
+**
+**	Template for a class written in C, derived from a superclass,
+**	that other classes can be derived from
+*/
+
+#include <lua.h>
+#include <lauxlib.h>
+#include <lualib.h>
+
+/* Name of our superclass: */
+#define SUPERCLASS_NAME "tek.class"
+
+/* Name of our class: */
+#define CLASS_NAME "tek.class.example"
+
+static const luaL_Reg classfuncs[] =
+{
+	/* insert methods here */
+	{ NULL, NULL }
+};
+
+int luaopen_tek_class_example(lua_State *L)
+{
+	lua_getglobal(L, "require");
+	/* s: <require> */
+	lua_pushliteral(L, SUPERCLASS_NAME);
+	/* s: <require>, "superclass" */
+	lua_call(L, 1, 1);
+	/* s: superclass */
+	lua_pushvalue(L, -1);
+	/* s: superclass, superclass */
+	luaL_register(L, CLASS_NAME, classfuncs);
+	/* s: superclass, superclass, class */
+	lua_call(L, 1, 1);
+	/* s: superclass, class */
+	luaL_newmetatable(L, CLASS_NAME "*");
+	/* s: superclass, class, meta */
+	lua_getfield(L, -3, "newClass");
+	/* s: superclass, class, meta, <newClass> */
+	lua_setfield(L, -2, "__call");
+	/* s: superclass, class, meta */
+	lua_pushvalue(L, -3);
+	/* s: superclass, class, meta, superclass */
+	lua_setfield(L, -2, "__index");
+	/* s: superclass, class, meta */
+	lua_setmetatable(L, -2);
+	/* s: superclass, class */
+	lua_pop(L, 2);
+	return 0;
+}
diff -r 3fbfb8d28bee -r 9f045ef547be tek/class/ui/floattext.lua
--- a/tek/class/ui/floattext.lua	Sat May 03 13:25:15 2008 +0200
+++ b/tek/class/ui/floattext.lua	Sun May 04 13:49:10 2008 +0200
@@ -18,7 +18,7 @@ local max = math.max
 local max = math.max
 
 module("tek.class.ui.floattext", tek.class.ui.area)
-_VERSION = "FloatText 2.1"
+_VERSION = "FloatText 2.2"
 
 local FloatText = _M
 
@@ -145,7 +145,8 @@ function FloatText:layoutText(x, y, widt
 		if tw + so > width then
 			if #line > 0 then
 				remove(line)
-				insert(text, { x, y, x + tw + so - 1, y + fh - 1, concat(line, " ") })
+				insert(text, { x, y, x + tw + so - 1, y + fh - 1,
+					concat(line, " ") })
 				y = y + fh
 			end
 			line = { word }
@@ -184,7 +185,7 @@ function FloatText:layout(r1, r2, r3, r4
 		self.Lines, self.Height = self:layoutText(r1, r2, width)
 	end
 	if self:simpleLayout(r1, r2, r3, r2 + self.Height - 1) then
-		self.Parent:setHeight(self.Height)
+		self.Parent:setValue("Height", self.Height)
 		return true
 	end
 end
diff -r 3fbfb8d28bee -r 9f045ef547be tek/class/ui/list.lua
--- a/tek/class/ui/list.lua	Sat May 03 13:25:15 2008 +0200
+++ b/tek/class/ui/list.lua	Sun May 04 13:49:10 2008 +0200
@@ -19,7 +19,7 @@ local type = type
 local type = type
 
 module("tek.class.ui.list", tek.class.ui.gadget)
-_VERSION = "List 2.1"
+_VERSION = "List 2.2"
 local List = _M


More information about the tekui-devel mailing list