module Labels (labels) where

import Tcl

type Text = String
type Attribute = String

labels = 
     do w <- window []
        f   <- frame w []

	ml  <- label w [text msg]
	packAdd ml [packV,packPadX 10,packPadY 10]

	lf  <- frame w []
	mapM_ (mkLabel w lf) demoLabels
	packAdd lf [inFrame f,packPadX 10,packPadY 10,packV]
	packAdd f []

	return ()


mkLabel w f (opt, attr) =
     do l <- label w [text lnm, width 20, borderwidth 4]
	cset l [opt %% attr]
	packAdd l [packV,packPadY 5]
	return l
     where
 	lnm   = opt ++ "_" ++ attr


demoLabels :: [(Text, Attribute)]
demoLabels = [("background", 	"green")
	     ,("bitmap", 	"question")
	     ,("cursor", 	"pirate")
	     ,("foreground",    "blue")
	     ,("relief",   	"flat")
	     ,("relief", 	"sunken")
	     ,("relief", 	"raised")
	     ,("relief", 	"groove")
	     ,("relief",  	"solid")
	     ,("relief",  	"ridge")
	     ]

msg = "Labels demonstrating various attributes."
