From 661e814cdafef813a5e74873feb677679e30fb21 Mon Sep 17 00:00:00 2001 From: mcmlxxix <> Date: Fri, 24 Aug 2012 19:44:07 +0000 Subject: [PATCH] add TreeItem.attr setter. "normal" text color can be set per-item: var i = tree.addItem(....); i.attr = <attr>; --- exec/load/tree.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/exec/load/tree.js b/exec/load/tree.js index f3368c573f..dac041a6a5 100644 --- a/exec/load/tree.js +++ b/exec/load/tree.js @@ -715,7 +715,8 @@ function TreeItem(text,parent,func,args) { var properties = { parent:undefined, status:undefined, - text:undefined + text:undefined, + attr:undefined }; /* protected properties */ @@ -742,6 +743,9 @@ function TreeItem(text,parent,func,args) { this.__defineGetter__("colors",function() { return properties.parent.colors; }); + this.__defineSetter__("attr",function(attr) { + properties.attr = attr; + }); this.__defineGetter__("hash",function() { return properties.parent.hash+"\t"+properties.text; }); @@ -845,8 +849,10 @@ function TreeItem(text,parent,func,args) { else if(current) fg=this.colors.lfg; /* normal menu fg */ - else + else if(properties.attr == undefined) fg=this.colors.fg; + else + fg=properties.attr; /* push text string into list */ for(var i=0;i<properties.text.length;i++) -- GitLab