Revision: 3968
          http://vexi.svn.sourceforge.net/vexi/?rev=3968&view=rev
Author:   clrg
Date:     2010-12-02 09:37:03 +0000 (Thu, 02 Dec 2010)

Log Message:
-----------
Soem text widget features:
- Extend feature 'shadowtext' - just pre-apply lib.widget.shadowtext at theme 
level
- Feature 'forcecase' on textfield; set to "upper"/"uppercase" or 
"lower"/"lowercase"

Modified Paths:
--------------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/textfield.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/numfield.t
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/textfield.t
    trunk/org.vexi-vexi.widgets/src_poke/visualtest/fields.t

Added Paths:
-----------
    trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/shadowtext.t

Added: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/shadowtext.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/shadowtext.t       
                        (rev 0)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/shadowtext.t       
2010-12-02 09:37:03 UTC (rev 3968)
@@ -0,0 +1,60 @@
+<!-- Copyright 2010 - see COPYING for details [LGPLv3] -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" 
xmlns:rdt="vexi.util.redirect">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <usage>
+            Preapply at a theme level and set th_shadowtext/wrap
+        </usage>
+    </meta:doc>
+    
+    <ui:box>
+        
+        thisbox.shadowtext = "";
+        thisbox.th_shadowtext;
+        thisbox.th_shadowwrap;
+        
+        thisbox.KeyPressed ++= static.keypressWrite;
+        thisbox.shadowtext ++= static.shadowtextWrite;
+        thisbox.v_container ++= static.containerWrite;
+        
+    </ui:box>
+    
+    static.containerWrite = function(v) {
+        cascade = v;
+        trapee.font ++= static.setOnShadow;
+        trapee.fontsize ++= static.setOnShadow;
+        trapee.v_textbox.text ++= static.textWrite;
+        trapee.v_textbox.v_field = trapee;
+    }
+    
+    static.keypressWrite = function(v) {
+        cascade = v;
+        var sw = trapee.th_shadowwrap;
+        if (sw) {
+            sw.display = trapee.v_edit.text == "";
+        }
+    }
+    
+    static.setOnShadow = function(v) {
+        cascade = v;
+        trapee.th_shadowtext[trapname] = v;
+    }
+    
+    /** sets the text to display when the textfield is empty */
+    static.shadowtextWrite = function(v) {
+        cascade = v;
+        var st = trapee.th_shadowtext;
+        if (st) {
+            st.text = v;
+        }
+    }
+    
+    static.textWrite = function(v) {
+        cascade = v;
+        // only show shadowtext if field is empty
+        var f = trapee.v_field;
+        f.th_shadowwrap.display = (v == "" or v == null);
+    }
+    
+</vexi>

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/textfield.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/textfield.t        
2010-12-01 14:52:50 UTC (rev 3967)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/lib/widget/textfield.t        
2010-12-02 09:37:03 UTC (rev 3968)
@@ -11,18 +11,15 @@
     <ui:box>
         
         thisbox.action = false;
+        thisbox.forcecase;
         thisbox.enabled = true;
         thisbox.password = false;
-        thisbox.shadowtext = "";
         thisbox.value = "";
-        thisbox.th_shadowtext;
-        thisbox.th_shadowwrap;
         thisbox.v_updatetext = true;
         
         KeyPressed ++= static.keypressEvent;
         password   ++= static.passwordWrite;
         text       ++= static.textWrite;
-        shadowtext ++= static.shadowtextWrite;
         value      ++= static.valueRead;
         value      ++= static.valueWrite;
         v_container ++= static.containerWrite;
@@ -35,15 +32,6 @@
         trapee.v_textbox.text ++= static.textWrite;
     }
     
-    /** sets the text to display when the textfield is empty */
-    static.shadowtextWrite = function(v) {
-        cascade = v;
-        var st = trapee.th_shadowtext;
-        if (st) {
-            st.text = v;
-        }
-    }
-    
     /** fire action or filter key in case of password fields */
     static.keypressEvent = function(v) {
         var edit = trapee.v_edit;
@@ -77,8 +65,8 @@
                 return;
             }
             
-            // delete text matching selected text
             if (edit.select) {
+                // delete text matching selected text
                 if (cPos > sPos) {
                     trapee.value = val.substring(0, sPos-1) + 
val.substring(cPos, val.length);
                 } else { 
@@ -120,13 +108,24 @@
                 edit.KeyPressed = v;
             }
             trapee.v_updatetext = true;
-        // normal textfield input
+            
         } else {
-            cascade = v;
-            var sw = trapee.th_shadowwrap;
-            if (sw) {
-                sw.display = edit.text == "";
+            if (v.length==1 and trapee.forcecase) {
+               var c = v.charCodeAt(0);
+               if (trapee.forcecase.indexOf("upper")==0) {
+                   // 97-122 (a-z)
+                   if (122>=c and c>=97) {
+                       v = vexi.string.fromCharCode(c-32);
+                   }
+               } else if (trapee.forcecase.indexOf("lower")) {
+                   // 65-90 (A-Z)
+                   if (90>=c and c>=65) {
+                       v = vexi.string.fromCharCode(c+32);
+                   }
+               }
             }
+            // normal textfield input
+            cascade = v;
         }
     }
     
@@ -152,8 +151,6 @@
     /** text writes to v_textbox */
     static.textWrite = function(v) {
         var f = trapee.v_field;
-        // only show shadowtext if field is empty
-        f.th_shadowwrap.display = (v == "" or v == null);
         if (f.password) {
             // hide text from user for passfields
             var str = "";

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 
2010-12-01 14:52:50 UTC (rev 3967)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/combo.t 
2010-12-02 09:37:03 UTC (rev 3968)
@@ -6,6 +6,7 @@
         <author>Charles Goodwin</author>
     </meta:doc>
     
+    <lib:widget.shadowtext />
     <lib:widget.combo redirect=":$content" margin="3" maxlistheight="160" 
vshrink="true">
         <bevel form="down">
             <focusborder id="focus" align="topleft" layout="place">

Modified: trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/numfield.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/numfield.t      
2010-12-01 14:52:50 UTC (rev 3967)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/numfield.t      
2010-12-02 09:37:03 UTC (rev 3968)
@@ -1,17 +1,25 @@
 <!-- Copyright 2009 - see COPYING for details [LGPL] -->
 
 <vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.theme"
-    xmlns:lib="org.vexi.lib.widget">
+    xmlns:lib="org.vexi.lib">
     <meta:doc>
         <author>Charles Goodwin</author>
     </meta:doc>
     
-    <lib:numfield />
+    <lib:widget.shadowtext />
+    <lib:widget.numfield />
     <bevel redirect=":$content" form="down" margin="3" padding="3" 
vshrink="true">
         <ui:box id="inset" layout="place" minheight="19">
             <ui:box id="content" />
+            <lib:layout.pad id="shadowpad" padding="3" vshrink="true">
+                <ui:box align="left">
+                    <ui:box id="shadow" align="left" shrink="true" 
textcolor="#999999" />
+                </ui:box>
+            </lib:layout.pad>
         </ui:box>
         
+        thisbox.th_shadowtext = $shadow;
+        thisbox.th_shadowwrap = $shadowpad;
         thisbox.th_minus = $minus;
         thisbox.th_view = $inset;
         thisbox.th_viewport = $content;

Modified: 
trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/textfield.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/textfield.t     
2010-12-01 14:52:50 UTC (rev 3967)
+++ trunk/org.vexi-vexi.widgets/src_main/org/vexi/theme/classic/textfield.t     
2010-12-02 09:37:03 UTC (rev 3968)
@@ -7,6 +7,7 @@
     </meta:doc>
     
     <lib:widget.textfield />
+    <lib:widget.shadowtext />
     <bevel redirect=":$content" form="down" margin="3" padding="3" 
vshrink="true">
         <ui:box id="inset" align="left" layout="place">
             <ui:box id="content" />
@@ -23,18 +24,6 @@
         thisbox.th_view = $content;
         thisbox.v_prevfill = .settings..fill;
         
-        thisbox.v_container ++= function(v) {
-            cascade = v;
-            thisbox.font ++= static.setOnShadow;
-            thisbox.fontsize ++= static.setOnShadow;
-        }
-        
     </bevel>
     <finalize />
-    
-    static.setOnShadow = function(v) {
-        cascade = v;
-        trapee.th_shadowtext[trapname] = v;
-    }
-    
 </vexi>

Modified: trunk/org.vexi-vexi.widgets/src_poke/visualtest/fields.t
===================================================================
--- trunk/org.vexi-vexi.widgets/src_poke/visualtest/fields.t    2010-12-01 
14:52:50 UTC (rev 3967)
+++ trunk/org.vexi-vexi.widgets/src_poke/visualtest/fields.t    2010-12-02 
09:37:03 UTC (rev 3968)
@@ -3,25 +3,19 @@
     <ui:box orient="vertical">
         <ui:box vshrink="true">
             <ui:box orient="vertical">
-                <ui:box align="left" text="Normal" />
-                <ui:box align="left" text="Maxlength 3 / shrink" />
-                <ui:box align="left" text="Type alpha" />
-                <ui:box align="left" text="Type numeric" />
-                <ui:box align="left" text="Type alphanumeric" />
-                <ui:box align="left" text="Numfield" />
-                <ui:box align="left" text="Spin" />
+                <w:textfield shadowtext="normal textfield" />
+                <w:textfield maxlength="3" shadowtext="maxlength 3 / shrink" />
+                <w:textfield forcecase="upper" shadowtext="forcecase upper" />
+                <w:numfield shadowtext="numfield" />
             </ui:box>
             <ui:box align="left" orient="vertical">
-                <w:textfield text="foooooo" />
-                <w:textfield maxlength="3" />
-                <w:textfield type="alpha" />
-                <w:textfield type="numeric" />
-                <w:textfield type="alphanumeric" />
-                <w:numfield />
-                <w:spin />
+                <w:textfield type="alpha" shadowtext="type alpha" />
+                <w:textfield type="numeric" shadowtext="type numeric" />
+                <w:textfield type="alphanumeric" shadowtext="type 
alphanumeric" />
+                <w:spin shadowtext="spin" />
             </ui:box>
         </ui:box>
-        <w:textarea />
+        <w:textarea shadowtext="normal textarea" />
         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.

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to