]> gitweb.factorcode.org Git - factor.git/commitdiff
fix various UI bugs; use opengl-style colors
authorSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2005 01:13:41 +0000 (01:13 +0000)
committerSlava Pestov <slava@factorcode.org>
Sat, 29 Oct 2005 01:13:41 +0000 (01:13 +0000)
library/ui/presentations.factor

index c43c221b48ae0eaa4452b66dd14431f3c84aaf77..59d423dd42f82ff239cdbaa5351f22ffcd11d9c0 100644 (file)
@@ -38,15 +38,21 @@ C: command-button ( gadget object -- button )
 M: command-button gadget-help ( button -- string )
     command-button-object dup word? [ synopsis ] [ summary ] if ;
 
-: init-commands ( gadget -- gadget )
-    ( dup presented paint-prop [ <command-button> ] when* ) ;
+: init-commands ( style gadget -- gadget )
+    presented rot assoc [ <command-button> ] when* ;
+
+: style-font ( style -- font )
+    [ font swap assoc [ "Monospaced" ] unless* ] keep
+    [ font-style swap assoc [ plain ] unless* ] keep
+    font-size swap assoc [ 12 ] unless* 3array ;
 
 : <styled-label> ( style text -- label )
-    <label> nip ; ! dup rot dup [ alist>hash ] when add-paint ;
+    <label> foreground pick assoc over set-label-text
+    swap style-font over set-label-font ;
 
 : <presentation> ( style text -- presentation )
-    gadget pick assoc dup
-    [ nip ] [ drop dupd <styled-label> init-commands ] if
+    gadget pick assoc
+    [ ] [ >r dup dup r> <styled-label> init-commands ] ?if
     outline rot assoc [ <outliner> ] when* ;
 
 : gadget. ( gadget -- )