Object Type:	xtoggle

Description:	Maintains toggle state and executes script actions
		from mouse button presses.

Author:		Maneesh Sahani / Upi Bhalla  Caltech Feb/93

-----------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:	xtoggle_type [in src/Xodus/widg/xtoggle_struct.h]

Size:		136 bytes

Fields:		fg	Foreground color of text in toggle
		bg	Background color.
		onfg	Foreground color of text in toggle,
			for on (pressed) state.
		onbg	Foreground color for on (pressed) state.
		offfg	Background color of text in toggle,
			for off (unpressed) state.
		offbg	Background color for off (unpressed) state.
		xgeom	Position of left edge of toggle.
		ygeom	Position of upper edge of toggle.
		wgeom	Width of toggle.
		hgeom	Height of toggle.
		onlabel	optional text string to display in on state.
			Defaults to widget name in the GENESIS hierarchy.
		offlabel optional text string to display in off state.
			Defaults to widget name in the GENESIS hierarchy.
		onfont	optional font for text in on state.
		offfont	optional font for text in on state.
		state	Maintains state of widget. 1 if on, 0 if off.
			Defaults to 0.
		script  string representing operations to be performed
----------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:	XToggle [in src/Xodus/widg/xtoggle.c]

Classes:	widget

Actions:	
		B1DOWN:	Button 1 pressed to turn on toggle (left mouse button)
		B2DOWN:	Button 2 pressed to turn on toggle
			(middle button on 3 button mouse)
		B3DOWN:	Button 3 pressed to turn on toggle
			(right button on 3 button mouse)
		ANYBDOWN: Any button pressed.
		B1UP:	Button 1 pressed to turn off toggle (left button)
		B2UP:	Button 2 pressed to turn off toggle
			(middle button on 3 button mouse)
		B3UP:	Button 3 pressed to turn off toggle 
			(right button on 3 button mouse)
		ANYBUP: Any button pressed to turn off toggle.
		XPDATE: update internal fields when widget is changed.

Messages:	none.
			
----------------------------------------------------------------------------

Notes:		Can only be displayed in a form widget
		The xtoggle does not perform any computational operations.
		It issues script calls depending on button presses and
		internal state.

Example:
create xform /form [0,0,500,100]
create xtoggle /form/toggle1 [0,0,100%,100%] \
    -onlabel "This toggle widget is on" \
    -offlabel "This toggle widget is off" \
    -onfg green \
    -offfg black \
    -onfont r24 \
    - script "echo.d1 LMB <value> ; echo.u3 released RMB <v> ; echo any MB <v>"
xshow /form

See also:	XODUS documentation. Mouse events documentation (Clicks)
