Revision: 4435
          http://vexi.svn.sourceforge.net/vexi/?rev=4435&view=rev
Author:   clrg
Date:     2012-09-24 06:08:14 +0000 (Mon, 24 Sep 2012)
Log Message:
-----------
When right aligned, move button to the left.

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/option.t

Added Paths:
-----------
    trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/option.t

Removed Paths:
-------------
    trunk/org.vexi-vexi.widgets/src_poke/visualtest/option.t

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t 
2012-09-14 02:41:49 UTC (rev 4434)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t 
2012-09-24 06:08:14 UTC (rev 4435)
@@ -10,6 +10,7 @@
     <lib:widget.shadowtext />
     <ui:box redirect=":$content" margin="3" maxlistheight="160" vshrink="true">
         <bevel id="bevel" form="down">
+            <ui:box id="leftholder" hshrink="true" />
             <lib.focusborder id="focus" align="topleft" layout="place">
                 <lib:layout.pad id="pad" hshrink="true" padding="3">
                     <lib:text.default id="edit" textalign="left" 
vshrink="true" />
@@ -18,11 +19,13 @@
                     <ui:box id="shadow" align="left" textcolor="#999999" />
                 </lib:layout.pad>
             </lib.focusborder>
-            <button id="button" width="18" minheight="18" shrink="false">
-                <ui:box layout="layer"> 
-                    <ui:box id="arrow" fill=":.image.arrowdown" shrink="true" 
/>
-                </ui:box>
-            </button>
+            <ui:box id="rightholder" hshrink="true">
+                <button id="button" width="18" minheight="18" shrink="false">
+                    <ui:box layout="layer"> 
+                        <ui:box id="arrow" fill=":.image.arrowdown" 
shrink="true" />
+                    </ui:box>
+                </button>
+            </ui:box>
         </bevel>
         <lib:layout.border id="popbox" border="black" fill="white" depth="1">
             <scrollpane id="scroll" autohidevertical="true" 
scrollhorizontal="false">
@@ -36,6 +39,7 @@
         thisbox.th_arrow    = $arrow;
         thisbox.th_bevel    = $bevel;
         thisbox.th_button   = $button;
+        thisbox.th_content  = $content;
         thisbox.th_focus    = $focus;
         thisbox.th_scroll   = $scroll;
         thisbox.th_shadowtext = $shadow;

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/option.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/option.t        
2012-09-14 02:41:49 UTC (rev 4434)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/option.t        
2012-09-24 06:08:14 UTC (rev 4435)
@@ -8,16 +8,19 @@
     
     <lib:widget.option redirect=":$content" margin="3" vshrink="true">
         <bevel id="bevel" form="down">
+            <ui:box id="leftholder" hshrink="true" />
             <lib.focusborder id="focus" align="left" fill="white" 
layout="place">
                 <lib:layout.pad id="pad" padding="3">
                      <ui:box id="output" align="left" />
                 </lib:layout.pad>
             </lib.focusborder>
-            <button id="button" width="18" minheight="18" hshrink="true" 
vshrink="false">
-                <ui:box layout="layer"> 
-                    <ui:box id="arrow" fill=":.image.arrowdown" shrink="true" 
/>
-                </ui:box>
-            </button>
+            <ui:box id="rightholder" hshrink="true">
+                <button id="button" width="18" minheight="18" hshrink="true" 
vshrink="false">
+                    <ui:box layout="layer"> 
+                        <ui:box id="arrow" fill=":.image.arrowdown" 
shrink="true" />
+                    </ui:box>
+                </button>
+            </ui:box>
         </bevel>
         <lib:layout.border id="popbox" border="black" fill="white" depth="1">
             <scrollpane id="scroll" autohidevertical="true" 
scrollhorizontal="false">
@@ -54,6 +57,14 @@
             cascade = v;
             v_fillbox = $focus;
             v_textbox = $output;
+            thisbox.textalign ++= function(v) {
+                cascade = v;
+                var talign = v.toLowerCase();
+                var holder = talign == "right" ? $leftholder : $rightholder;
+                v_textbox.align = talign;
+                if (holder[0] == null)
+                    holder[0] = $button;
+            }
         }
         
         // markers for static traps
@@ -70,6 +81,8 @@
         var marginleft = trapee.marginleft;
         var v_popbox = trapee.v_popbox;
         return function(dx, sw) {
+//            vexi.trace(dx+", "+sw);
+//            vexi.trace(dx+marginleft+1, vexi.math.max(0, sw-v_popbox.width));
             v_popbox.surface_x =
                 vexi.math.min(dx+marginleft+1, vexi.math.max(0, 
sw-v_popbox.width));
         };
@@ -137,6 +150,7 @@
         trapee.v_popbox.minwidth = vexi.math.max(0, surroundwidth-1);
     }
     
+    /** shrink to match list width */
     static.hshrinkWrite = function(v) {
         cascade = v;
         if (v) {

Copied: trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/option.t (from rev 
4432, trunk/org.vexi-vexi.widgets/src_poke/visualtest/option.t)
===================================================================
--- trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/option.t                  
        (rev 0)
+++ trunk/org.vexi-vexi.widgets/src_poke/poke/widgets/option.t  2012-09-24 
06:08:14 UTC (rev 4435)
@@ -0,0 +1,64 @@
+<!-- Public Domain -->
+
+<vexi xmlns:ui="vexi://ui"
+      xmlns:lay="vexi.layout"
+      xmlns="vexi.widget">
+    
+    <surface />
+    <ui:box shrink="true" width="500" height="500">
+        <lay:grid cols="3" maxwidth="400">
+            <ui:box text=" Option " />
+            <option id="o" shrink="true">
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+            </option>
+            <button id="b1" text="Set Value A" />
+            
+            $b1.action ++= function(v) { $o.value = "Value A"; return; }
+            
+            <ui:box text=" Option " />
+            <option id="o2" textalign="right">
+                <item text="Value A" />
+                <item text="Value B" selected="true" />
+            </option>
+            <ui:box />
+            
+            <ui:box text=" Combo " />
+            <combo id="c" shrink="true" width="120">
+                <item text="foo" />
+                <item text="Value A" selected="true" />
+                <item text="Value B" />
+            </combo>
+            <button id="b2" text="Set Value A" />
+            
+            $b2.action ++= function(v) { $c.value = "Value A"; return; }
+            
+            <ui:box text=" Combo " />
+            <option id="c2" textalign="right">
+                <item text="Value A" />
+                <item text="Value B" selected="true" />
+            </option>
+            <ui:box />
+            
+        </lay:grid>
+        
+        vexi.ui.frame = thisbox;
+        
+    </ui:box>
+</vexi>

Deleted: trunk/org.vexi-vexi.widgets/src_poke/visualtest/option.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_poke/visualtest/option.t    2012-09-14 
02:41:49 UTC (rev 4434)
+++ trunk/org.vexi-vexi.widgets/src_poke/visualtest/option.t    2012-09-24 
06:08:14 UTC (rev 4435)
@@ -1,44 +0,0 @@
-<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget">
-    <w:surface />
-    <ui:box orient="vertical" shrink="true" width="500" height="500">
-        <ui:box />
-        <ui:box shrink="true">
-            <ui:box text=" Option " />
-            <w:option id="o" shrink="true">
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-            </w:option>
-            <w:button id="b1" text="Set Value A" />
-            $b1.action ++= function(v) { $o.value = "Value A"; return; }
-        </ui:box>
-        <ui:box />
-        <ui:box shrink="true">
-            <ui:box text=" Combo " />
-            <w:combo id="c" shrink="true" width="120">
-                <w:item text="foo" />
-                <w:item text="Value A" selected="true" />
-                <w:item text="Value B" />
-            </w:combo>
-            <w:button id="b2" text="Set Value A" />
-            $b2.action ++= function(v) { $c.value = "Value A"; return; }
-        </ui:box>
-        <ui:box />
-        vexi.ui.frame = thisbox;
-    </ui:box>
-</vexi>
\ No newline at end of file

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to