From 5fbe6aa9e6eb68b525e0ef56df1d6b2bcc2de3b9 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sat, 25 Jul 2015 22:38:34 -0700 Subject: [PATCH] ui.gadgets.labels: respect the labels background and foreground. --- basis/ui/gadgets/labels/labels.factor | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/basis/ui/gadgets/labels/labels.factor b/basis/ui/gadgets/labels/labels.factor index c95ac71bfb..38fb92e1f0 100644 --- a/basis/ui/gadgets/labels/labels.factor +++ b/basis/ui/gadgets/labels/labels.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays colors.constants combinators fonts +USING: accessors arrays colors.constants combinators fonts fry kernel make math.functions models namespaces sequences splitting strings ui.baseline-alignment ui.gadgets ui.gadgets.tracks ui.pens.solid ui.render ui.text ; @@ -64,13 +64,21 @@ M: label baseline* M: label cap-height* label-metrics cap-height>> round ; + + M: label draw-gadget* - >label< - [ - background get [ font-with-background ] when* - foreground get [ font-with-foreground ] when* - ] dip - draw-text ; + [ >label< ] keep + [ label-background [ font-with-background ] when* ] + [ label-foreground [ font-with-foreground ] when* ] + bi-curry compose dip draw-text ; M: label gadget-text* string>> % ;