[tekui-devel] tekui: Reimplemented Area:checkFocus(); Mode attribute moved bac...
Timm S. Mueller
tmueller at neoscientists.org
Tue Apr 22 20:02:31 CEST 2008
details: http://hg.teklib.org/tekui/rev/9fb41dbce319
changeset: 439:9fb41dbce319
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Tue Apr 22 01:16:41 2008 +0200
description:
Reimplemented Area:checkFocus(); Mode attribute moved back to Gadget;
Application, Window: some cleanup
diffs (truncated from 142 to 100 lines):
diff -r 097c04f6117d -r 9fb41dbce319 tek/class/ui/application.lua
--- a/tek/class/ui/application.lua Tue Apr 22 00:16:04 2008 +0200
+++ b/tek/class/ui/application.lua Tue Apr 22 01:16:41 2008 +0200
@@ -12,10 +12,10 @@ local Group = ui.Group
local assert = assert
local collectgarbage = collectgarbage
+local insert = table.insert
local ipairs = ipairs
local max = math.max
local min = math.min
-local insert = table.insert
local remove = table.remove
local unpack = unpack
@@ -195,7 +195,7 @@ function Application:openWindow(window)
if status ~= "open" then
status = window:openWindow()
if status == "open" then
- db.info("insert window %s", window)
+ db.trace("insert window %s", window)
insert(self.OpenWindows, window)
end
end
@@ -208,7 +208,7 @@ function Application:closeWindow(window)
if status ~= "hidden" then
status = window:closeWindow()
if status ~= "open" then
- db.info("remove window %s", window)
+ db.trace("remove window %s", window)
for i, c in ipairs(self.OpenWindows) do
if c == window then
remove(self.OpenWindows, i)
diff -r 097c04f6117d -r 9fb41dbce319 tek/class/ui/area.lua
--- a/tek/class/ui/area.lua Tue Apr 22 00:16:04 2008 +0200
+++ b/tek/class/ui/area.lua Tue Apr 22 01:16:41 2008 +0200
@@ -91,8 +91,6 @@ function Area.init(self)
self.MinHeight = self.MinHeight or 0
-- Minimum width of the element:
self.MinWidth = self.MinWidth or 0
- -- Mode of behavior ("inert", "toggle", "touch", "button"):
- self.Mode = self.Mode or "inert"
-- Indicates whether the element needs to be redrawn:
self.Redraw = false
-- Selected state of the element (defined, but not handled by Area):
@@ -397,3 +395,11 @@ function Area:setState()
self.Background = ui.PEN_AREABACK
self.Redraw = true
end
+
+-------------------------------------------------------------------------------
+-- checkFocus:
+-------------------------------------------------------------------------------
+
+function Area:checkFocus()
+ return false
+end
diff -r 097c04f6117d -r 9fb41dbce319 tek/class/ui/gadget.lua
--- a/tek/class/ui/gadget.lua Tue Apr 22 00:16:04 2008 +0200
+++ b/tek/class/ui/gadget.lua Tue Apr 22 01:16:41 2008 +0200
@@ -45,6 +45,8 @@ function Gadget.init(self)
self.Hold = false
-- The pointer is hovering over the element:
self.Hover = false
+ -- Mode of behavior ("inert", "toggle", "touch", "button"):
+ self.Mode = self.Mode or "inert"
-- Element is being "pressed":
self.Pressed = false
return Frame.init(self)
@@ -183,7 +185,7 @@ function Gadget:passMsg(msg)
local w = self.Window
if w then -- might be gone if in a PopupWindow
local he = w.HoverElement
- he = he == self and not self.Disabled and self.Mode ~= "inert" and he
+ he = he == self and he:checkFocus() and he
if msg[2] == ui.MSG_MOUSEBUTTON then
if msg[3] == 1 then -- leftdown:
if he then
@@ -201,3 +203,11 @@ function Gadget:passMsg(msg)
end
return msg
end
+
+-------------------------------------------------------------------------------
+-- checkFocus:
+-------------------------------------------------------------------------------
+
+function Gadget:checkFocus()
+ return not self.Disabled and self.Mode ~= "inert"
+end
diff -r 097c04f6117d -r 9fb41dbce319 tek/class/ui/window.lua
--- a/tek/class/ui/window.lua Tue Apr 22 00:16:04 2008 +0200
+++ b/tek/class/ui/window.lua Tue Apr 22 01:16:41 2008 +0200
@@ -15,13 +15,15 @@ local Group = ui.group
local Group = ui.group
local assert = assert
+local floor = math.floor
+local insert = table.insert
+local ipairs = ipairs
More information about the tekui-devel
mailing list