Revision: 3170
          http://vexi.svn.sourceforge.net/vexi/?rev=3170&view=rev
Author:   clrg
Date:     2008-11-04 13:33:39 +0000 (Tue, 04 Nov 2008)

Log Message:
-----------
Import some contributed widgets (contributed by me!)

Added Paths:
-----------
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/subsurface.t
    trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/link.t
    trunk/widgets/org.vexi.widgets/src/vexi/layout/icon.t
    trunk/widgets/org.vexi.widgets/src/vexi/widget/link.t

Added: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t               
                (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/layout/icon.t       
2008-11-04 13:33:39 UTC (rev 3170)
@@ -0,0 +1,78 @@
+<!-- Copyright 2008 WEBenableIT -- all rights reserved -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.layout"
+    xmlns:icon="vexi.icon">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <name>Icon</name>
+        <desc>An icon with an optional emblem</desc>
+    </meta:doc>
+    
+    <ui:box shrink="true">
+        <ui:box id="size" layout="layer">
+            <ui:box id="image" shrink="true" />
+            <ui:box id="emblem" align="bottomright" shrink="true" />
+        </ui:box>
+        
+        thisbox.emblem ++= static.emblemWrite;
+        thisbox.image ++= static.imageWrite;
+        thisbox.icon ++= static.iconWrite;
+        thisbox.size ++= static.sizeWrite;
+        
+    </ui:box>
+    
+    /** set the emblem, a 1/4 size image in the bottom right corner */
+    static.emblemWrite = function(v) {
+        cascade = v;
+        if (!trapee.size) return;
+        trapee[0][1].fill = v ? icon["i"+(trapee.size/2)][v] : null;
+    }
+    
+    /** sets the icon's image to the specified resource */
+    static.imageWrite = function(v) {
+        cascade = v;
+        trapee[0][0].fill = v;
+    }
+    
+    /** sets the icon's image to an existing icon */
+    static.iconWrite = function(v) {
+        cascade = v;
+        if (!trapee.size) return;
+        if (v and !static["listicon"+trapee.size][v] and typeof(v)=="string") {
+            try { throw "icon not found: "+v+" ("+trapee.size+")"; }
+            catch(e) { vexi.log.info(vexi.params["debugmode"] ? e : 
e.message); }
+            v = "filenew";
+        }
+        trapee[0][0].fill = v ? icon["i"+trapee.size][v] : null;
+    }
+    
+    /** sets the size, in pixels, of this icon */
+    static.sizeWrite = function(v) {
+        cascade = v;
+        trapee[0].width = v;
+        trapee[0].height = v;
+        if (trapee.icon) trapee.icon = trapee.icon;
+        if (trapee.image) trapee.image = trapee.image;
+    }
+    
+    ////////
+    // icon name caching
+    
+    static.listicon32 = {};
+    static.listicon16 = {};
+    
+    for (var k in icon.i32) {
+        var d = k.indexOf('.');
+        if (d==0) continue;
+        if (d>=1) k = k.substring(0, d);
+        listicon32[k] = true;
+    }
+    
+    for (var k in icon.i16) {
+        var d = k.indexOf('.');
+        if (d==0) continue;
+        if (d>=1) k = k.substring(0, d);
+        listicon16[k] = true;
+    }
+    
+</vexi>

Added: trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/subsurface.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/subsurface.t           
                (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/lib/role/subsurface.t   
2008-11-04 13:33:39 UTC (rev 3170)
@@ -0,0 +1,23 @@
+<!-- Copyright 2008 - see COPYING for details [LGPL] -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta"
+    xmlns:role="org.vexi.lib.role" xmlns:rdrt="vexi.util.redirect">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <desc>For advanced management of surface objects</desc>
+    </meta:doc>
+    
+    <ui:box>
+        
+        // a clone of the surface object
+        var s;
+        var surfaceRead = function() { return s; }
+        
+        /** proxy to the surface object */
+        thisbox.surface ++= function(v) {
+            cascade = v;
+            s = v ? vexi.clone(v) : null;
+        }
+        
+    </ui:box>
+</vexi>

Added: trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/link.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/link.t            
                (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/org/vexi/theme/classic/link.t    
2008-11-04 13:33:39 UTC (rev 3170)
@@ -0,0 +1,114 @@
+<!-- Copyright 2008 WEBenableIT -- all rights reserved -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="vexi.layout"
+    xmlns:role="org.vexi.lib.role" xmlns:theme="vexi.theme" 
xmlns:rdt="vexi.util.redirect">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <name>Link</name>
+    </meta:doc>
+    
+    <role:clickable />
+    <role:focusable />
+    <role:tooltipable />
+    <ui:box margin="2" shrink="true">
+        <theme:focusborder id="focus">
+        <pad cursor="hand" padding="1">
+            <ui:box minheight="16">
+                <icon id="icon" display="false" marginright="5" size="16" />
+                <ui:box id="link" layout="layer" shrink="true">
+                    <ui:box id="text" />
+                    <ui:box id="hintline" align="bottomleft" height="1" 
fill="black" width="0" />
+                    <ui:box id="underline" align="bottom" height="1" 
fill="blue" display="false" />
+                </ui:box>
+            </ui:box>
+        </pad>
+        </theme:focusborder>
+        
+        rdt..addRedirect(thisbox, $icon, "icon", "emblem");
+        
+        thisbox.th_focus = $focus;
+        thisbox.v_iconbox = $icon;
+        thisbox.v_linkbox = $link;
+        thisbox.v_textbox = $text;
+        $text.v_hint = $hintline;
+        
+        thisbox.enabled ++= static.enableWrite;
+        thisbox.focused ++= theme.focusborder..focusWrite;
+        
+        thisbox.active ++= static.activeWrite;
+        thisbox.hover  ++= static.hoverWrite;
+        thisbox.normal ++= static.normalWrite;
+        
+        thisbox.hint ++= static.hintWrite;
+        thisbox.icon ++= static.iconWrite;
+        
+    </ui:box>
+    
+    static.enableWrite = function(v) { cascade = v; trapee.cursor = 
trapee.enabled ? "hand" : null; }
+    
+    static.registerHint = function(v) {
+        cascade = v;
+        var s = trapee.surface;
+        if (s==null) return;
+        if (v) { if (s.registerHint) s.registerHint(trapee); }
+        else { if (s.dropHint) s.dropHint(trapee); }
+    }
+    
+    static.surfaceWrite = function(v) {
+        var s = trapee.surface;
+        if (s and s.dropHint) s.dropHint(trapee);
+        cascade = v;
+        if (v and v.registerHint and trapee.visible)
+            v.registerHint(trapee);
+    }
+    
+    static.hintWrite = function(v) {
+        cascade = v;
+        trapee.v_textbox.hint = v;
+        trapee.surface ++= static.surfaceWrite;
+        trapee.visible ++= static.registerHint;
+    }
+    
+    static.iconWrite = function(v) { cascade = v; trapee.v_iconbox.display = 
v!=null and v!=""; }
+    
+    static.focusWrite = function(v) {
+        cascade = v;
+        trapee.border = trapee.focused ? "#666666" : null;
+        trapee.fill = trapee.focused ? "#ffeedd" : null;
+    }
+    
+    static.textWrite = function(v) {
+        var i = v and trapee.hint ? v.toLowerCase().indexOf(trapee.hint) : -1;
+        if (i>=0) {
+            trapee.v_hint[1].width =
+                vexi.ui.font.width(trapee.font, trapee.fontsize, 
trapee.text.substring(i, i+1));
+            trapee.v_hint[1].x =
+                vexi.ui.font.width(trapee.font, trapee.fontsize, 
trapee.text.substring(0, i));
+        } else {
+            trapee.v_hint[1].width = 0;
+        }
+        return;
+    }
+    
+    static.activeWrite = function(v) {
+        trapee.v_linkbox[0].textcolor = "red";
+        trapee.v_linkbox[2].display = true;
+        trapee.v_linkbox[2].fill = "red";
+        return;
+    }
+    
+    static.hoverWrite = function(v) {
+        trapee.v_linkbox[0].textcolor = "blue";
+        trapee.v_linkbox[2].display = true;
+        trapee.v_linkbox[2].fill = "blue";
+        return;
+    }
+    
+    static.normalWrite = function(v) {
+        trapee.v_linkbox[0].textcolor = trapee.enabled ? "black" : "#666666";
+        trapee.v_linkbox[1].fill = trapee.enabled ? "black" : null;
+        trapee.v_linkbox[2].display = false;
+        return;
+    }
+    
+</vexi>

Added: trunk/widgets/org.vexi.widgets/src/vexi/layout/icon.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/vexi/layout/icon.t                       
        (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/vexi/layout/icon.t       2008-11-04 
13:33:39 UTC (rev 3170)
@@ -0,0 +1,20 @@
+<!-- Copyright 2008 WEBenableIT -- all rights reserved -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" 
xmlns="org.vexi.lib.layout">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <name>Icon</name>
+        <desc>An icon with an optional emblem</desc>
+        <usage>
+            Set the 'image' property to a string which represents the
+            name of an icon found in the vexi/icon/* directories.
+            
+            Put to the 'emblem' property, to set an emblem, which must
+            also be a name of a vexi/icon/['i'+(size/2)]/ icon.
+        </usage>
+    </meta:doc>
+    
+    <margin />
+    <icon />
+    <container />
+</vexi>

Added: trunk/widgets/org.vexi.widgets/src/vexi/widget/link.t
===================================================================
--- trunk/widgets/org.vexi.widgets/src/vexi/widget/link.t                       
        (rev 0)
+++ trunk/widgets/org.vexi.widgets/src/vexi/widget/link.t       2008-11-04 
13:33:39 UTC (rev 3170)
@@ -0,0 +1,19 @@
+<!-- Copyright 2008 WEBenableIT -- all rights reserved -->
+
+<vexi xmlns:ui="vexi://ui" xmlns:meta="vexi://meta" xmlns="org.vexi.lib.layout"
+    xmlns:theme="vexi.theme">
+    <meta:doc>
+        <author>Charles Goodwin</author>
+        <name>Link</name>
+        <desc>A link with an optional icon</desc>
+        <usage>
+            The text property determines the text content of the link.
+            Optionally set the 'icon' property to a string which is the
+            name of an image found in the icon16 directory.
+        </usage>
+    </meta:doc>
+    
+    <margin />
+    <theme:link />
+    <container />
+</vexi>


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
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to