Revision: 4812
http://sourceforge.net/p/vexi/code/4812
Author: clrg
Date: 2015-08-05 10:32:57 +0000 (Wed, 05 Aug 2015)
Log Message:
-----------
Improve icon to accept a stream as well as a string
Modified Paths:
--------------
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/icon.t
Modified:
branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/icon.t
===================================================================
--- branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/icon.t
2015-08-05 10:28:29 UTC (rev 4811)
+++ branches/vexi3/org.vexi-vexi.widgets/src_main/org/vexi/lib/layout/icon.t
2015-08-05 10:32:57 UTC (rev 4812)
@@ -38,7 +38,11 @@
if (!trapee.size) {
return;
}
- trapee[0][0].fill = v ? static.getIcon("icon"+trapee.size, v) : null;
+ // determine whether icon is null, a stream, otherwise
+ // assume it is a string reference to look up an icon
+ var icon = v==null or typeof(v)=="stream" ? v
+ : static.getIcon("icon"+trapee.size, v);
+ trapee[0][0].fill = icon;
}
/** sets the size, in pixels, of this icon */
@@ -94,8 +98,9 @@
static.getIcon = function(subdir, name){
const key = subdir+"."+name;
var r = icons[subdir][name];
- if(!r){
-
+ if (r==null) {
+ // if the look up fails, then fill in with a
+ // blank icon and output a suitable warning
var msg = "[WARNING] icon not found: "+subdir+"/"+name;
vexi.log.warn(new vexi.js.Exception(msg));
if(!listed[subdir]){
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn