#!/bin/sh
# ----------------------------------------------------------------------
#  DEMO: fontmanager in [incr Widgets]
# ----------------------------------------------------------------------
#\
exec itkwish "$0" ${1+"$@"}
package require Iwidgets 3.0
source load.tcl

#
# Demo script for Fontmanager class
#

#
# if you use a font before creating, tk fonts dont work
# so at least we create the default fonts
#
font create def      -family Courier -size 12
font create defBold  -family Courier -size 12 -weight bold

#
# a few options wont hurt either
#
option add *font                   def      startupFile
option add *textFont               def      startupFile
option add *labelFont              defBold  startupFile


#
# here we setup not only the font manger but
# fontmanagment as whole
#
iwidgets::fontmanager  .fm -file b

#
# first we let the manager take control over 
# the already existing fonts
#
.fm add def      "-family Courier -size 12" \
    "Default GUI font:"
.fm add defBold  "-family Courier -size 12 -weight bold" \
    "Bold GUI font:"
#
# the rest of fonts will be created automatically
#
.fm add defFixed "-family Courier -size 12"  \
    "Fixed GUI font:" 
.fm add small    "-family Courier -size 10" \
    "Small GUI font:"
.fm add big      "-family Courier -size 14"  \
    "Big GUI font:" 
.fm add bigBold  "-family Courier -size 14 -weight bold" \
    "Big and Bold GUI font:"
.fm add mudDef   "-family Courier -size 12"  \
    "Default font for MUD text:" 
.fm add mudBold  "-family Courier -size 12 -weight bold" \
    "Bold font for MUD text:"
.fm add scDef    "-family Courier -size 12 -weight bold" \
    "Default font for scriptfile editor:" 

#
# now launch the fontmanager
#
.fm activate

#
# one more widget, that uses fonts
#
button .a -text "activate (Big and Bold GUI font)" -font bigBold -command {.fm activate}
button .b -text "deactivate (Small GUI font)" -font small -command {.fm deactivate}
pack .a .b -expand 1 -fill both
