Revision: 3550
          http://vexi.svn.sourceforge.net/vexi/?rev=3550&view=rev
Author:   clrg
Date:     2009-07-13 16:43:36 +0000 (Mon, 13 Jul 2009)

Log Message:
-----------
- Fix scrollhorizontal=false/scrollvertical=false
- Now option widgets default to minwidth of items
- Toggle using contrainwidth=false (think of a better name?)

Modified Paths:
--------------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t 
2009-07-13 15:12:32 UTC (rev 3549)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/scrollpane.t 
2009-07-13 16:43:36 UTC (rev 3550)
@@ -26,16 +26,10 @@
         thisbox.th_viewport;
         
         /** reusable function for write traps that constrain the viewport to 
the contents */
-        var constrainPaneH = function(v) {
-            cascade = v;
-            th_viewport.minwidth = hshrink ? th_viewport[0].contentwidth : 0;
-        }
+        var constrainPaneH = function(v) { cascade = v; th_viewport.minwidth = 
th_viewport[0].contentwidth; }
         
         /** reusable function for write traps that constrain the viewport to 
the contents */
-        var constrainPaneV = function(v) {
-            cascade = v;
-            th_viewport.minheight = vshrink ? th_viewport[0].contentheight : 0;
-        }
+        var constrainPaneV = function(v) { cascade = v; th_viewport.minheight 
= th_viewport[0].contentheight; }
         
         // apply constrain traps
         hshrink ++= constrainPaneH;
@@ -43,6 +37,8 @@
         
         /** set up horizontal scrollbar */
         th_hscroll ++= function(v) {
+            cascade = v;
+            
             /** autohide th_hscroll */
             autohidehorizontal ++= function(a) {
                 if (v == autohidehorizontal) return;
@@ -50,21 +46,23 @@
                 cascade = a;
             }
             
+            /** toggle horizontal scrollbar */
             scrollhorizontal ++= function(s) {
                 if (v.display != s) v.display = s;
                 if (s and v.viewport != th_viewport) v.viewport = th_viewport;
                 if (!s and v.viewport == th_viewport) v.viewport = null;
                 if (!th_viewport) return;
-                if (!s) { if (scrollhorizontal) th_viewport[0].width ++= 
constrainPaneH; }
-                else th_viewport[0].width --= constrainPaneH;
+                if (!s) {
+                    if (scrollhorizontal) th_viewport[0].contentwidth ++= 
constrainPaneH;
+                } else th_viewport[0].contentwidth --= constrainPaneH;
                 cascade = s;
             }
-            
-            cascade = v;
         }
         
         /** set up vertical scrollbar */
         th_vscroll ++= function(v) {
+            cascade = v;
+            
             /** autohide th_vscroll */
             autohidevertical ++= function(a) {
                 if (a == autohidevertical) return;
@@ -72,17 +70,17 @@
                 cascade = a;
             }
             
+            /** toggle vertical scrollbar */
             scrollvertical ++= function(s) {
                 if (v.display != s) v.display = s;
                 if (s and v.viewport != th_viewport) v.viewport = th_viewport;
                 if (!s and v.viewport == th_viewport) v.viewport = null;
                 if (!th_viewport) return;
-                if (!s) { if (scrollvertical) th_viewport[0].height ++= 
constrainPaneV; }
-                else th_viewport[0].height --= constrainPaneV;
+                if (!s) {
+                    if (scrollvertical) th_viewport[0].contentheight ++= 
constrainPaneV;
+                } else th_viewport[0].contentheight --= constrainPaneV;
                 cascade = s;
             }
-            
-            cascade = v;
         }
         
         /** set up viewport */

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t  
2009-07-13 15:12:32 UTC (rev 3549)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/option.t  
2009-07-13 16:43:36 UTC (rev 3550)
@@ -39,7 +39,9 @@
         thisbox.fontsize ++= static.fontWrite;
         thisbox.popup    ++= static.popupWrite;
         thisbox.popdown  ++= static.popdownWrite;
-        thisbox.width    ++= static.widthWrite;
+        thisbox.visible  ++= static.visibleWrite;
+        thisbox.constrainwidth ++= static.constrainwidthWrite;
+        thisbox.v_popbox.contentwidth ++= static.listwidthWrite;
         
         thisbox.v_container ++= function(v) {
             cascade = v;
@@ -47,8 +49,9 @@
             v_textbox = $output;
         }
         
-        // pointer back to thisbox for static traps
+        // markers for static traps
         $popbox.p_option = thisbox;
+        $popbox.th_focus = $focus;
         
         $focus.minheight = 6 + vexi.ui.font.height(font, fontsize, "dy");
         
@@ -99,7 +102,51 @@
     /** keep content at least same width as widget */
     static.widthWrite = function(v) {
         cascade = v;
-        trapee.v_popbox.minwidth = v-22;
+        trapee.v_popbox.minwidth = v+2;
     }
     
+    /** match option width to list width */
+    static.listwidthWrite = function(v) {
+        cascade = v;
+        trapee.th_focus.minwidth = v-2;
+    }
+    
+    /** need to forcereflow for it to work */
+    static.childWrite = function(v) {
+        cascade = v;
+        trapee.forcereflow();
+    }
+    
+    /** need to forcereflow for it to work */
+    static.visibleWrite = function(v) {
+        cascade = v;
+        if (v) {
+            trapee.v_popbox.forcereflow();
+            trapee.v_content.Children ++= static.childWrite;
+        } else {
+            trapee.v_content.Children --= static.childWrite;
+        }
+    }
+    
+    /** switch list width constraint on/off */
+    static.constrainwidthWrite = function(v) {
+        cascade = v;
+        if (v) {
+            if (trapee.visible) {
+                trapee.v_popbox.forcereflow();
+                trapee.th_list.Children ++= static.childWrite;
+            }
+            trapee.visible ++= static.visibleWrite;
+            trapee.v_popbox.contentwidth ++= listwidthWrite;
+            trapee.th_focus.width --= static.widthWrite;
+        } else {
+            if (trapee.visible) {
+                trapee.th_list.Children --= static.childWrite;
+            }
+            trapee.visible --= static.visibleWrite;
+            trapee.v_popbox.contentwidth --= listwidthWrite;
+            trapee.th_focus.width ++= static.widthWrite;
+        }
+    }
+    
 </vexi>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to