! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays hashtables io kernel math namespaces make opengl sequences strings splitting ui.gadgets ui.gadgets.tracks ui.gadgets.theme ui.render colors models ; IN: ui.gadgets.labels ! A label gadget draws a string. TUPLE: label < gadget text font color ; : label-string ( label -- string ) text>> dup string? [ "\n" join ] unless ; inline : set-label-string ( string label -- ) [ CHAR: \n over memq? [ string-lines ] when ] dip (>>text) ; inline : label-theme ( gadget -- gadget ) sans-serif-font >>font black >>color ; inline : new-label ( string class -- label ) new-gadget [ set-label-string ] keep label-theme ; inline :