[tekui-devel] tekui: Cleanup in Frame/Group/Area:askMinMax(): most layouting s...
Timm S. Mueller
tmueller at neoscientists.org
Fri Apr 11 00:30:26 CEST 2008
details: http://hg.teklib.org/tekui/rev/ab2720141015
changeset: 420:ab2720141015
user: Timm S. Mueller <tmueller at neoscientists.org>
date: Thu Apr 10 23:55:59 2008 +0200
description:
Cleanup in Frame/Group/Area:askMinMax(): most layouting scenarios are now
working, but MinWidth/MinHeight for groups is still not functional
diffs (truncated from 121 to 100 lines):
diff -r e3dcae9594c9 -r ab2720141015 tek/app/ui/alignment.lua
--- a/tek/app/ui/alignment.lua Thu Apr 10 22:48:46 2008 +0200
+++ b/tek/app/ui/alignment.lua Thu Apr 10 23:55:59 2008 +0200
@@ -10,6 +10,8 @@ ui.Application:new
{
ui.Window:new
{
+ MaxWidth = 700,
+ MaxHeight = 700,
Title = "Alignment Demo",
Children =
{
diff -r e3dcae9594c9 -r ab2720141015 tek/class/ui/area.lua
--- a/tek/class/ui/area.lua Thu Apr 10 22:48:46 2008 +0200
+++ b/tek/class/ui/area.lua Thu Apr 10 23:55:59 2008 +0200
@@ -199,8 +199,6 @@ end
function Area:askMinMax(m1, m2, m3, m4)
- m1 = max(self.MinWidth, m1)
- m2 = max(self.MinHeight, m2)
m3 = m3 and max(min(self.MaxWidth, m3), m1)
m4 = m4 and max(min(self.MaxHeight, m4), m2)
@@ -214,12 +212,16 @@ function Area:askMinMax(m1, m2, m3, m4)
m3 = m1
elseif self.Width == "fill" then
m3 = nil
+ elseif self.Width == "free" then
+ m3 = ui.HUGE
end
if self.Height == "auto" then
m4 = m2
elseif self.Height == "fill" then
m4 = nil
+ elseif self.Height == "free" then
+ m4 = ui.HUGE
end
local m = self.MinMax
diff -r e3dcae9594c9 -r ab2720141015 tek/class/ui/frame.lua
--- a/tek/class/ui/frame.lua Thu Apr 10 22:48:46 2008 +0200
+++ b/tek/class/ui/frame.lua Thu Apr 10 23:55:59 2008 +0200
@@ -123,8 +123,6 @@ function Frame:askMinMax(m1, m2, m3, m4)
m1 = max(self.MinWidth, m1)
m2 = max(self.MinHeight, m2)
- m3 = m3 and max(min(self.MaxWidth, m3), m1)
- m4 = m4 and max(min(self.MaxHeight, m4), m2)
local p = self.PaddingAndBorder
m1 = (m1 or 0) + p[1] + p[3]
diff -r e3dcae9594c9 -r ab2720141015 tek/class/ui/group.lua
--- a/tek/class/ui/group.lua Thu Apr 10 22:48:46 2008 +0200
+++ b/tek/class/ui/group.lua Thu Apr 10 23:55:59 2008 +0200
@@ -446,48 +446,11 @@ end
-------------------------------------------------------------------------------
function Group:askMinMax(m1, m2, m3, m4)
-
- local w = type(self.Width) == "number" and self.Width
- local h = type(self.Height) == "number" and self.Height
-
if self.TabElement then
m1, m2, m3, m4 = self.TabElement:askMinMax(m1, m2, m3, m4)
else
- m1, m2, m3, m4 = self.Layout:askMinMax(self,
- w or self.MinWidth,
- h or self.MinHeight,
- w or self.MaxWidth,
- h or self.MaxHeight)
- end
-
- if self.Width == "limit" then
- m3 = m3 and min(m3, self.MaxWidth)
- elseif self.Width == "auto" then
- m3 = m1
- elseif self.Width == "fill" then
- m3 = nil
- elseif self.Width == "free" then
- m3 = ui.HUGE
- elseif w then
- m3 = w
- else
- m3 = m3 and max(min(self.MaxWidth, m3), m1)
- end
-
- if self.Height == "limit" then
- m4 = m4 and min(m4, self.MaxHeight)
- elseif self.Height == "auto" then
- m4 = m2
- elseif self.Height == "fill" then
- m4 = nil
- elseif self.Height == "free" then
- m4 = ui.HUGE
- elseif h then
- m4 = h
- else
- m4 = m4 and max(min(self.MaxHeight, m4), m2)
More information about the tekui-devel
mailing list