module Buttons (buttons) where

import Tcl

type Text = String
type Attribute = String

buttons = 
     do w <- window []

        f   <- frame w []

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

	lf  <- frame w []
	mapM_ (mkButton w lf) demoButtons
	packAdd lf [packV,packPadX 10,packPadY 10]
	packAdd f []
	return ()


mkButton w frm (opt, attr) =
     do b <- button w [text (opt ++ " " ++ attr), width 20, borderwidth 4]
	cset b [opt %% attr] 
	packAdd b [inFrame frm,packV,packPadY 5]
	return b


demoButtons :: [(Text, Attribute)]
demoButtons = 
	[("background", 	"green")
	,("bitmap", 		"question")
	,("cursor", 		"pirate")
	,("activeforeground",	"red")
	,("activebackground",  	"red")
        ,("state",		"disabled")
	,("foreground",    	"blue")
	,("relief", 	  	"flat")
	,("relief", 		"sunken")
	,("relief", 		"raised")
	,("relief", 		"groove")
	,("relief",  		"solid")
	,("relief",  		"ridge")	
	]

msg = "Buttons demonstrating various attributes."
