#------------------------------------------------------------------------
# Compagny	:	4Js
# Developper	:	PM
# Program	:	$PROJET/objects/lradio.obj
# Date		:	04.07.1995
# Last modif.	:	15.10.1995
# Title		:	Description d'un objet menu
#------------------------------------------------------------------------
# Explications :
#
#======================================================================
# Lradio :
#	List of RadioButton
#......................................................................

Class Lradio {
inherit Frame 
global Default

#vars :
#	public geo_width	$Default(Menu,Width)
#	public geo_height	$Default(Menu,Height)
	public geo_orientation	"vertical"
#	public geo_font		$Default(Res,Menu_Font)
	public geo_int_fill	"x"

#application vars :
	public int_geoman	"place_it"
	public int_command	""
	public int_variable	""		;# will be given by default
						;# to the members
	public int_lifetype	"permanent"	;# permanent or not
	public int_soons	"members"
	public int_members	""	;# list of command button

constructor { config } {
#  puts stderr "Lradio::constructor, come in for $this"
	set int_variable	${this}_var
  }

destructor {
#  puts "Lradio::destructor, come in for $this"
  }

#-----------------------------------------------------------------------    
# Define_Lradio :
#	This function defines a one-level menu.
# Parameters:	name of object
# Returns:	the list of objects defined.
#........................................................................

method refresh	{ } {
global Default

#puts "Define_Lradio:"

  foreach entity $int_members {
	$entity config	-int_geoman	"pack_it" \
	              	-int_parent	$this \
	              	-int_command	$int_command \
	              	-geo_fill	$geo_int_fill \
	              	-geo_padx	$geo_int_padx \
	              	-geo_pady	$geo_int_pady

	if { $int_lifetype != "permanent" } { # See what is best...
		$entity config			\
			-int_command_bef "$this delete"
#			-int_command_bef "$this destroy"
#			-int_command_bef "$this clear"
		}

	if { $geo_orientation == "horizontal" } {
#		puts stderr "$this set attach to left"
		$entity config	-geo_attach	"left" \
		              	-geo_fill	"none"
		} else {
#		puts stderr "$this set attach to top"
		$entity config	-geo_attach	"top" \
		              	-geo_fill	"x"
		}
	}
 }

#-----------------------------------------------------------------------    
# Add_Member_Lradio :
#	This function adds a new menu point to the chose
# Parameters:	name of object, its label, and the working variable
#........................................................................

method add_member  { member label {variable ""} {value ""} } {
global Default

  RadioButton $member			\
	-int_variable	$variable	\
	-geo_value	$value		\
	-geo_text	$label
  lappend int_members $member
#  puts "Lradio: received label $label"
  }

#-----------------------------------------------------------------------    
#........................................................................

method define	{ } {
  [$this info inherit]::define
  refresh
  }

}	;# end of class Lradio

#-----------------------------------------------------------------------    
# ======================================================================