Revision: 3916
          http://vexi.svn.sourceforge.net/vexi/?rev=3916&view=rev
Author:   clrg
Date:     2010-10-14 13:43:54 +0000 (Thu, 14 Oct 2010)

Log Message:
-----------
Smarter tooltip behaviour in table columns

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

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/column.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/column.t     
2010-10-13 14:57:13 UTC (rev 3915)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/widget/column.t     
2010-10-14 13:43:54 UTC (rev 3916)
@@ -12,13 +12,6 @@
         thisbox.size ++= static.sizeWrite;
         thisbox.value ++= static.valueRead;
         
-        var setTooltip = function(v) { cascade = v; tooltip = v; };
-        
-        thisbox.v_container ++= function(v) {
-            cascade = v;
-            thisbox.v_textbox.text ++= setTooltip;
-        }
-        
     </ui:box>
     
     static.datatypeWrite = function(v) {

Modified: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/column.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/column.t  
2010-10-13 14:57:13 UTC (rev 3915)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/column.t  
2010-10-14 13:43:54 UTC (rev 3916)
@@ -13,13 +13,13 @@
     <lib:column />
     <ui:box redirect=":$content" padding="2 1">
         <button id="b" focusable="false" hshrink="false">
-            <ui:box align="left" layout="place">
+            <ui:box id="wrap" align="left" layout="place" minwidth="8">
                 <ui:box>
-                    <ui:box id="sp_left" display="false" minwidth="8">
-                        <ui:box id="sort" align="right" shrink="true" />
+                    <ui:box id="sp_left" align="right" minwidth="8" 
display="false">
+                        <ui:box id="sort" shrink="true" />
                     </ui:box>
-                    <ui:box id="content" shrink="true" />
-                    <ui:box id="sp_right" display="false" minwidth="8" />
+                    <ui:box id="content" />
+                    <ui:box id="sp_right" minwidth="8" display="false" />
                 </ui:box>
             </ui:box>
         </button>
@@ -35,6 +35,7 @@
                 $sp_left.display = true;
                 $sp_right.display = true;
             } else {
+                $sort.fill = null;
                 $sp_left.display = false;
                 $sp_right.display = false;
             }
@@ -47,14 +48,49 @@
             $b.minheight = h;
         }
         
-        thisbox.v_content ++= function(v) {
-            v.font ++= syncSize;
-            v.fontsize ++= syncSize;
-            v.fontsize = v.fontsize;
+        var lockTooltip;
+        var textWidth;
+        var getTextWidth = function(v) {
             cascade = v;
+            textWidth = v==null ? 0 : vexi.ui.font.width(trapee.font, 
trapee.fontsize, v);
         }
+        var setTooltip = function(v) {
+            cascade = v;
+            lockTooltip = true;
+            if (v>=textWidth+paddingleft+paddingright) {
+                if (tooltip!=null) {
+                    tooltip = null;
+                }
+            } else {
+                tooltip = v_textbox.text;
+            }
+            lockTooltip = false;
+        }
+        var checkTooltip = function(v) {
+            cascade = v;
+            if (lockTooltip) {
+                return;
+            }
+            if (v!=null and v!=v_textbox.text) {
+                $wrap.width --= setTooltip;
+            } else {
+                $wrap.width ++= setTooltip;
+            }
+        }
         
+        thisbox.v_container ++= function(v) {
+            cascade = v;
+            var t = v_textbox;
+            t.font ++= syncSize;
+            t.fontsize ++= syncSize;
+            t.fontsize = v.fontsize;
+            t.text ++= getTextWidth;
+            $wrap.width ++= setTooltip;
+            thisbox.tooltip ++= checkTooltip;
+        }
+        
         $b.action ++= function(v) { thisbox.action = true; cascade = v; }
         
     </ui:box>
+    
 </vexi>


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

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to