[tekui-devel] tekui: Checkmark now added for real; Blank border added

Timm S. Mueller tmueller at neoscientists.org
Wed Feb 6 01:50:21 CET 2008


details:   http://hg.teklib.org/tekui/rev/7539e6af4947
changeset: 358:7539e6af4947
user:      Timm S. Mueller <tmueller at neoscientists.org>
date:      Wed Feb 06 01:43:02 2008 +0100
description:
Checkmark now added for real; Blank border added

diffs (truncated from 224 to 100 lines):

diff -r 3e37f2f0a6bc -r 7539e6af4947 tek/class/ui/border/blank.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tek/class/ui/border/blank.lua	Wed Feb 06 01:43:02 2008 +0100
@@ -0,0 +1,47 @@
+
+--
+--	tek.class.ui.border.blank
+--	Written by Timm S. Mueller <tmueller at schulze-mueller.de>
+--	See copyright notice in COPYRIGHT
+--
+
+local ui = require "tek.lib.ui"
+local unpack = unpack
+
+module("tek.class.ui.border.blank", tek.class.ui.border)
+_VERSION = "BlankBorder 1.0"
+
+-------------------------------------------------------------------------------
+--	Constants & Class data:
+-------------------------------------------------------------------------------
+
+local DEF_BORDER = { 2, 2, 2, 2 }
+
+-------------------------------------------------------------------------------
+--	Class implementation:
+-------------------------------------------------------------------------------
+
+local Blank = _M
+
+function Blank:getBorder(element, border)
+	return border or element.Display.Theme.BorderBlankBorder or DEF_BORDER
+end
+
+function Blank:draw(element, border, rect)
+	local b1, b2, b3, b4 = unpack(self:getBorder(element, border))
+	local r1, r2, r3, r4 = unpack(rect or element.Rect)
+	local d = element.Drawable
+
+	local p1, p2
+	if element.Focus then
+		p1, p2 = d.Pens[ui.PEN_FOCUSSHINE], d.Pens[ui.PEN_FOCUSSHADOW]
+	else
+		p1 = element.Parent:getBgPen()
+		p2 = p1
+	end
+
+	d:fillRect(r1 - b1, r2 - b2, r3 + b3, r2 - 1, p1)
+	d:fillRect(r3 + 1, r2, r3 + b3, r4 + b4, p2)
+	d:fillRect(r1 - b1, r4 + 1, r3 + b3, r4 + b4, p1)
+	d:fillRect(r1 - b1, r2, r1 - 1, r4, p2)
+end
diff -r 3e37f2f0a6bc -r 7539e6af4947 tek/class/ui/checkmark.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tek/class/ui/checkmark.lua	Wed Feb 06 01:43:02 2008 +0100
@@ -0,0 +1,169 @@
+
+--
+--	tek.class.ui.checkmark
+--	Written by Timm S. Mueller <tmueller at schulze-mueller.de>
+--	See copyright notice in COPYRIGHT
+--
+
+local ui = require "tek.lib.ui"
+local Button = ui.Button
+local VectorImage = ui.VectorImage
+
+local floor = math.floor
+local ipairs = ipairs
+local max = math.max
+
+module("tek.class.ui.checkmark", tek.class.ui.button)
+_VERSION = "CheckMark 0.1"
+
+-------------------------------------------------------------------------------
+--	Constants & Class data:
+-------------------------------------------------------------------------------
+
+local coords =
+{
+	-- shadow:
+	-3,4, -4,3, -3,-2, -4,-3, -2,-3, -3,-4, 4,-3, 3,-4,
+	-- shine:
+	-3,3, 3,4, 2,3, 4,3, 3,2, 3,-3,
+	-- check:
+	0,0, -2,3, -3,2, -1,0, -3,-2, -2,-3, 0,-1, 2,-3, 3,-2, 1,0, 3,2, 2,3, 0,1
+}
+
+-- shadow:
+local points1 = { 1, 9, 10, 11, 12, 13, 7, 14 }
+-- shine:
+local points2 = { 1, 2, 3, 4, 5, 6, 7, 8 }
+-- check:
+local points3 = { 15,16,17,18,19,20,21,22,23,24,25,26,27,16 }
+
+local CheckImage1 = VectorImage:new
+{
+	ImageData =
+	{
+		Coords = coords,
+		Primitives =


More information about the tekui-devel mailing list