COMMENT @----------------------------------------------------------------------

	Copyright (c) GeoWorks 1992 -- All Rights Reserved

PROJECT:	PC GEOS
MODULE:		Include/Objects
FILE:		gBoolGC.def

REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	chris	1/92		Initial version

DESCRIPTION:
	Object definitions for GenBooleanGroupClass.   

	$Id: gBoolGC.def,v 1.1 97/04/04 14:18:14 newdeal Exp $

------------------------------------------------------------------------------@

SetDef	_GBOOLGC

StartLibrary	ui

include ui.def

global 	GenBooleanSendMsg:far
		
		
GenBooleanGroupClass	class	GenClass

;------------------------------------------------------------------------------
;	Messages
;------------------------------------------------------------------------------

MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE			message
; 
; Sets new selections for the GenBooleanGroup.  The or'ed sum of the booleans
; to select are passed.  Any booleans whose data is not set will be cleared. 
; The indeterminate states of booleans are also passed, again represented by
; the or'ed sum of the indeterminate entries.  The modified state of all 
; booleans will be cleared;  to set any of the boolean's modified bits, call
; MSG_GEN_BOOLEAN_GROUP_SET_GROUP_MODIFIED_STATE.  Booleans can be made selected
; or indeterminate via this message, even if they are not usable, not enabled,
; or not represented by a GenBoolean in the GenBooleanGroup (useful for
; linked GenBooleanGroups).
;
; Context:	Can be called externally at any time; is also used internally
;		when responding to user actions.
; Source:	No restrictions
; Destination:	A GenBooleanGroupObject.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- Booleans which should be selected, or "True".
;		      (or'ed sum of boolean identifiers)
;		dx -- Boolean which have indeterminate state
;	 	      (or'ed sum of boolean identifiers)
; Return:	nothing
;		ax, cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_SET_GROUP_MODIFIED_STATE		message
;
; Booleans are normally marked as "not modified" anytime their state is
; set, marked "modified" anytime the user interacts with them, and marked
; "not modified" again on MSG_APPLY.  This primitive provides a way to 
; control modification status outside of these events.
; Booleans can be operated on via this message, even if they are not usable,
; not enabled, or not represented by a GenBoolean in the GenBooleanGroup
; (useful for linked GenBooleanGroups).
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- bitfield of booleans to mark as modified
; 		dx -- bitfield of booleans to mark as not modified
; Return:	nothing
;		ax, cx, dx, bp -- destroyed


MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS	 		message
; 
; Returns the current state of booleans in a GenBooleanGroup, represented by
; the or'ed sum of the identifiers of the selected booleans.  Returns zero if
; no booleans are selected.
;
; Context:	Can be called by apps at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		nothing
; Return:	ax -- Booleans which are selected, or "True"
;		      (or'ed sum of identifiers)
;		carry set if none selected
;		cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_GET_INDETERMINATE_BOOLEANS		message
; 
; Returns the indeterminate selections in a GenBooleanGroup, represented by the 
; or'ed sum of the identifiers of the indeterminate booleans.  Returns zero
; if no booleans are indeterminate.  Booleans may be marked as indeterminate
; even if they are not usable, not enabled, or not in the boolean group.
;
; Context:	Can be called by apps at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		nothing
; Return:	ax -- current indeterminate booleans (or'ed sum of identifiers)
;		cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_GET_MODIFIED_BOOLEANS		message
; 
; Returns the selections in a GenBooleanGroup that have been modified
; since the last apply, represented by the or'ed sum of the identifiers of the 
; motified booleans.  Returns zero if no booleans are modified.  Booleans may
; be marked as modified even if they are not usable, not enabled, or not in 
; the boolean group.
;
; Context:	Can be called by apps at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		nothing
; Return:	ax -- bitfield of user modified booleans
;		      (or'ed sum of identifiers)
;		carry set if no user modifications
;		cx, dx, bp -- destroyed
;


MSG_GEN_BOOLEAN_GROUP_SEND_STATUS_MSG			message
;
; Causes boolean group to send out the "Status" message as specified in
; ATTR_GEN_BOOLEAN_GROUP_STATUS_MSG.  The message will include the current
; state of the object, as well as the "change" bitfield data we pass here.
; This message will still function event if the boolean group is not enabled or
; not usable.
; 
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- data to have passed in the "changed" field of the
;		      status message
; Return:	nothing
;		ax, cx, dx, bp - destroyed

;
;---
;

MSG_GEN_BOOLEAN_GROUP_GET_BOOLEAN_OPTR		message
; 
; Returns the optr of the requested boolean.  Useful for sending messages 
; directly to an boolean, for things like enabling/disabling, setting usable/
; not-usable, changing the boolean's moniker, or getting/setting the identifier
; for the boolean.   If the boolean is not found in the generic tree of the
; GenBooleanGroup, a null OD will be returned.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier to look for
; Return:	carry set if boolean found
;		^lcx:dx -- optr of boolean, or null if none found
;		ax, bp -- destroyed
;

;
;---
;

MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_STATE			message
;
; Sets state for a particular boolean in a GenBooleanGroup.  leaving the other
; booleans unchanged.  If the identifier passed doesn't match an boolean in
; the boolean group, or  matches an boolean that is not usable or not enabled, 
; it will still be added to the selections.   Clears the modified state of the
; boolean. Booleans can be operated on via this message, even if they are not 
; usable, not enabled, or not represented by a GenBoolean in the GenBooleanGroup
; (useful for linked GenBooleanGroups).
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
;		dx -- non-zero if selected, or "True"
; Return:	nothing
;		ax, cx, dx, bp -- destroyed

MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_INDETERMINATE_STATE	message
;
; This allows individual changing of a boolean's indeterminate state, leaving
; all other booleans unchanged.   The Boolean's modified state is cleared.
; Booleans can be operated on via this message, even if they are not usable,
; not enabled, or not represented by a GenBoolean in the GenBooleanGroup
; (useful for linked GenBooleanGroups).
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
; 		dx -- non-zero to mark indeterminate, zero to mark not 
;		      indeterminate.
; Return:	nothing
;		ax, cx, dx, bp -- destroyed


MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_MODIFIED_STATE	message
;
; Booleans are normally marked as "not modified" anytime their state is
; set, marked "modified" anytime the user interacts with them, and marked
; "not modified" again on MSG_APPLY.  This primitive provides a way to 
; control the modified status outside of these events.
; Booleans can be operated on via this message, even if they are not usable,
; not enabled, or not represented by a GenBoolean in the GenBooleanGroup
; (useful for linked GenBooleanGroups).
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
; 		dx -- non-zero to mark modified, zero to mark not modified.
; Return:	nothing
;		ax, cx, dx, bp -- destroyed


MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED		message
;
; Returns the selected state of a boolean.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
; Return:	carry -- set if selected
;		ax, cx, dx, bp -- destroyed

MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_INDETERMINATE		message
;
; Returns the indeterminate state of a boolean.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
; Return:	carry -- set if boolean indeterminate
;		ax, cx, dx, bp -- destroyed

MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_MODIFIED		message
;
; Returns the modified state of a boolean.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean
; Return:	carry -- set if boolean modified
;		ax, cx, dx, bp -- destroyed

;
;---
;


MSG_GEN_BOOLEAN_GROUP_GET_DESTINATION		message
;
; Returns the current destination object, as specified in GBGI_destination.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		nothing
; Return:	^lcx:dx -- the current destination object
;		ax, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_SET_DESTINATION		message
;
; Sets a new destination object, as specified in GBGI_destination.  Apply
; messages and status messags are sent out to this object.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		^lcx:dx -- destination object
; Return:	nothing
;		ax, cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_GET_APPLY_MSG		message
; 
; Returns the current message to send out on apply for the GenBooleanGroup.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		nothing
; Return:	ax -- the current message
;		cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_SET_APPLY_MSG		message
; 
; Sets a new message to send out on apply for the GenBooleanGroup.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- new message
; Return:	nothing
;		ax, cx, dx, bp -- destroyed
;

MSG_GEN_BOOLEAN_GROUP_MAKE_BOOLEAN_VISIBLE	message
; 
; Ensures that an boolean in a scrolling boolean group is visible, by scrolling
; the boolean group if necessary.  Has no effect if boolean group is not 
; scrollable or usable.  Does not change boolean group state.    See ATTR_GEN_-
; BOOLEAN_GROUP_SCROLLABLE.
;
; Context:	Can be called any time the object is USABLE.  Has
;		no effect otherwise.
; Source:	No restrictions
; Destination:	Any scrollable, USABLE GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- identifier of boolean to ensure visible
; Return:	nothing
;		ax, cx, dx, bp -- destroyed
;

;------------------------------------------------------------------------------
; 	Internal messages
;------------------------------------------------------------------------------

MSG_GEN_BOOLEAN_GROUP_SCAN_BOOLEANS		message
;
; Called by the boolean group to find another boolean in the group, usually for
; moving the focus as a result of keyboard navigation.  A dynamic list may
; subclass this to ensure that the boolean to be found will be onscreen (and
; therefore in the generic tree) before doing the usual stuff.  If the initial
; boolean is not found, the message will return that boolean; otherwise, it will
; use the scan amount to find the nth usable booleans away from the initial 
; boolean, where n is the scan amount.   It will then return the nth boolean if
; is is both usable and enabled, or keep looking until it can return a usable 
; or enabled boolean.  If the scan amount forces the search past the beginning 
; or end of the list, it may wraparound and keep looking, depending on the 
; GSIF_WRAP_AROUND flag.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cl -- GenScanItemsFlags
;		dx -- initial boolean identifier
;		bp -- absolute scan amount (direction depends on GSIF_FORWARD)
; Return:	carry clear if no enabled or usable boolean found
;		else carry set , with: 
;			ax -- the resulting identifier
;

MSG_GEN_BOOLEAN_GROUP_REDRAW_BOOLEANS		message
;
; Used internally for redrawing booleans.  Should not generally be called by the
; application.  Used for dynamic list updates.
;
; Context:	Can be called at any time.
; Source:	No restrictions
; Destination:	Any GenBooleanGroup object.
; Interception:	Generally not intercepted.
;
; Pass:		cx -- offset from top boolean to boolean to start redrawing from
; Return:	nothing
;		ax, cx, dx, bp -- destroyed
;


;------------------------------------------------------------------------------
; 	Vardata
;------------------------------------------------------------------------------
BGROUP_UNUSED				vardata


ATTR_GEN_BOOLEAN_GROUP_STATUS_MSG	vardata		word
;
;	Allows a message to be specified for receiving notification of the
;	gadget's current status following user interaction, or the app's
;	forcing of the message via MSG_GEN_BOOLEAN_GROUP_SEND_STATUS_MSG.
;	attribute takes a word argument specifying the message to be sent out.
;	The parameters for the notification message differs from the normal
; 	apply notification:
;
;	 Pass:		cx -- Booleans currently selected, or "True"
;			      (boolean ID's or'ed together)
;			dx -- Booleans whose state is indeterminate
;			      (boolean ID's or'ed together)
;			bp -- Booleans whose state has just changed, causing
;			      this message to be sent out.  If message a
;			      result of MSG_GEN_BOOLEAN_GROUP_SEND_STATUS_MSG
;			      being sent, is data passed in that message.
;	 Return:	nothing
;			ax, cx, dx, bp -- destroyed
;

ATTR_GEN_BOOLEAN_GROUP_INIT_FILE_BOOLEAN	vardata
	; Uses "true/false" values in .ini file.

HINT_BOOLEAN_GROUP_SCROLLABLE			vardata
	; Allows a GenBooleanGroup to be a scrolling list of booleans.  Good for
	; long lists of GenBooleans.  Exclusive, non-exclusive, exclusive-none,
	; and extended-selection-exclusive behavior are all supported under
	; a scrolling list, and the messages are all the same as for a non-
	; scrolling list.  

HINT_BOOLEAN_GROUP_MINIMIZE_SIZE	vardata
	; Tells boolean group to come up in the smallest space available.
	; In motif, this will direct the boolean group to appear in a popup
	; list.  In other situations, it might appear as a one-line scrolling
	; object.  Booleans in a popup list can either be scrollable or not.

HINT_BOOLEAN_GROUP_CHECKBOX_STYLE	vardata 
	; If available in the specific UI, draw boolean objects with some
	; kind of box to check.  This is the default behavior in motif and
	; CUA style user interfaces but not in Open Look, though the style is
	; available.

HINT_BOOLEAN_GROUP_TOOLBOX_STYLE	vardata 
	; If available in the specific UI, draw boolean objects in a toolbox
	; style, usually with a simple box around the visual moniker.  This
	; This is the default behavior in motif for objects in toolbars
	; (denoted by HINT_TOOLBOX), but not for other boolean objects.

ATTR_GEN_BOOLEAN_GROUP_LINK		vardata	optr
	; Allows two or more GenBooleanGroups to be linked together, each 
	; containing one or more items with identifiers unique to all other
	; items in the linked boolean groups.  The links should be circular, 
	; with the last boolean group in the linkage pointing back to the 
	; first.  All boolean groups should always have identical state stored 
	; in them.  See "Linked GenBooleanGroups" for more info.

; Certain vardata values are pinned to the item group to make the code simpler.

.assert (HINT_BOOLEAN_GROUP_SCROLLABLE eq HINT_ITEM_GROUP_SCROLLABLE)

.assert (HINT_BOOLEAN_GROUP_MINIMIZE_SIZE eq HINT_ITEM_GROUP_MINIMIZE_SIZE)

.assert (HINT_BOOLEAN_GROUP_CHECKBOX_STYLE eq HINT_ITEM_GROUP_RADIO_BUTTON_STYLE)
.assert (HINT_BOOLEAN_GROUP_TOOLBOX_STYLE eq HINT_ITEM_GROUP_TOOLBOX_STYLE)

;------------------------------------------------------------------------------
;	Instance data
;------------------------------------------------------------------------------


GBGI_selectedBooleans	word	0
	;The booleans currently "True", represented by the or'ed sum of
	;the boolean's identifiers.

GBGI_indeterminateBooleans	word	0
	;The booleans that are currently indeterminate, represented by the
	;or'ed sum of the booleans' identifiers.

GBGI_modifiedBooleans	word	0
	;The booleans that have been "modified".  Cleared anytime state is
	;set, set anytime user activates any of the booleans, and cleared on
	;MSG_APPLY.  This status may further be modified using
	;MSG_GEN_BOOLEAN_GROUP_SET_GROUP_MODIFIED_STATE and
	;MSG_GEN_BOOLEAN_GROUP_SET_BOOLEAN_MODIFIED_STATE.  It may be
	;checked using MSG_GEN_BOOLEAN_GROUP_GET_MODIFIED_BOOLEANS or
	;MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_MODIFIED.  The apply message is
	;normally only sent out on MSG_APPLY if this word is non-zero,
	;though this behavior can be overriden using
	;ATTR_GEN_SEND_APPLY_MSG_ON_APPLY_EVEN_IF_NOT_MODIFIED

GBGI_destination	optr
	;The destination of any messages sent out by the object.  This can
	;be set via MSG_GEN_BOOLEAN_GROUP_SET_DESTINATION, and retrieved via
	;MSG_GEN_BOOLEAN_GROUP_GET_DESTINATION.

GBGI_applyMsg		word	0
	;Message to send out to the destination on MSG_APPLY.
	;The arguments passed in the notify message are as follows:
	;
	; Pass:		cx -- Booleans currently selected, or "True"
	;		      (GIGI_selectedBooleans)
	;		dx -- Booleans whose state is indeterminate
	;		      (GIGI_indeterminateBooleans)
	;		bp -- Booleans whose state have been modified
	;		      (GIGI_modifiedBooleans)
	; Return:	nothing
	;		ax, cx, dx, bp -- destroyed
	;


GenBooleanGroupClass	endc

EndLibrary	ui









