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

#
# Demo script for labeledwidget class
#

class Lb {
    inherit iwidgets::Labeledwidget

    constructor {aLabel aCommand args} {
	configure -labeltext    $aLabel
	configure -labeljustify right
	configure -labelpos     n
	
	itk_component add b {
	    button [childsite].bb -command $aCommand
	} {ignore -background }
	pack $itk_component(b) -side right -fill both -expand 1
	eval itk_initialize $args
    }
}

proc clash {oo} {
    global wlist
    foreach wid $wlist {
	$wid configure -clash $oo
    }
}
proc justi {oo} {
    global wlist
    foreach wid $wlist {
	$wid configure -labeljustify $oo
    }
}

set wlist [list .a .b .c .d]

Lb .a "-clash on"    {clash 1}
Lb .b "-clash false" {clash 0}
Lb .c "-labeljustify left"   {justi left}
Lb .d "-labeljustify right\n1234567890\n12345678\n12345\n12"   {justi right}

eval pack $wlist

eval iwidgets::Labeledwidget::alignlabels $wlist