Revision: 3123
http://vexi.svn.sourceforge.net/vexi/?rev=3123&view=rev
Author: clrg
Date: 2008-10-08 16:42:08 +0000 (Wed, 08 Oct 2008)
Log Message:
-----------
Improve vtrail for arbitrary-size tree widgets
Modified Paths:
--------------
trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/tree.t
Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/tree.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/tree.t
2008-10-05 18:36:26 UTC (rev 3122)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/tree.t
2008-10-08 16:42:08 UTC (rev 3123)
@@ -43,8 +43,10 @@
thisbox.th_title = $label;
var lastc = null;
- var syncvtrail = function(v) { $vtrail.height = lastc ? (lastc.y + 8)
: 0; }
- var yFunc = function(v) { cascade = v; syncvtrail(); }
+ var syncTrail = function(v) {
+ $vtrail.height = lastc and lastc.th_node ? (lastc.y +
(lastc.th_node.height+1)/2) : 0;
+ }
+ var syncTrap = function(v) { cascade = v; syncTrail(); }
thisbox.v_container ++= function(v) {
cascade = v;
@@ -52,16 +54,27 @@
v_content.orient = "vertical";
v_content.Children ++= function(c) {
cascade = c;
- var _c = null;
- for (var i = v_content.numchildren-1; i >= 0; i--)
- if (v_content[i].display) { _c = v_content[i]; break; }
- if (lastc != _c) {
- if (lastc) lastc.y --= yFunc;
- if (_c) { _c.y ++= yFunc; }
- lastc = _c;
- syncvtrail();
+ // FIXME: could be much more efficient
+ var l = null;
+ for (var i = v_content.numchildren-1; i >= 0; i--) {
+ if (v_content[i].display and v_content[i].th_node) {
+ l = v_content[i];
+ break;
+ }
}
- $vtrail.display = $content.numchildren > 0;
+ if (lastc != l) {
+ if (lastc) {
+ lastc.y --= syncTrap;
+ lastc.th_node.height --= syncTrap;
+ }
+ if (l) {
+ l.y ++= syncTrap;
+ l.th_node.height ++= syncTrap;
+ }
+ lastc = l;
+ syncTrail();
+ }
+ $vtrail.display = lastc != null;
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn