/*
 * dbx.h
 *
 * [Generated from dbx, 08 November 1995]
 */

#pragma include_only_once
#pragma force_top_level

#ifndef __dbx_h
#define __dbx_h

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  dbx_declare
 *  dbx_sendEvent
 *  dbx_findData
 *  dbx_controlBBox
 *  dbx_update
 *  dbx_qUpdate
 */

/* --- dbx_declare --- *
 *
 * On entry:	R0 == dialogue box handle from dbox
 *		R1 == pointer to dialogue box definition block
 *
 * On exit:	--
 *
 * Use:		Declares a dialogue box to be dbx-managed, and declares the
 *		control types of all its controls.
 */

extern routine dbx_declare;

/* --- dbx_sendEvent --- *
 *
 * On entry:	R0 == event code to send
 *		R1-R7 == depend on the event code
 *		R10 == dialogue box handle
 *
 * On exit:	C flag as set by event handler
 *
 * Use:		Sends an event to the specified dialogue box.  This is
 *		intended to be used by control handlers, hence the unusual
 *		placing of the dialogue handle in R10.
 */

extern routine dbx_sendEvent;

/* --- dbx_findData --- *
 *
 * On entry:	R0 == icon handle
 *		R10 == dialogue box handle
 *
 * On exit:	If found, CS and
 *		  R8 == pointer to writable control data
 *		  R9 == pointer to static control data
 *		else CC and
 *		  R8, R9 corrupted
 *
 * Use:		Allows a control to find its data when called by client
 *		code.
 */

extern routine dbx_findData;

/* --- dbx_controlBBox --- *
 *
 * On entry:	R0 == dialogue box handle
 *		R1 == control icon number
 *
 * On exit:	R0,R1 preserved
 *		R2-R5 == inclusive screen coordinates of icon bounding box
 *
 * Use:		Calculates the position *on the screen* of the given control
 *		icon, and returns it to you as a set of four inclusive
 *		coordinates (*not* inclusive-exclusve as the WIMP tends to
 *		return to you)
 */

extern routine dbx_controlBBox;

/* --- dbx_update --- *
 *
 * On entry:	R0 == dialogue box handle
 *		R1 == icon number of control to update
 *
 * On exit:	--
 *
 * Use:		Redraws the specified control immediately.  If the control
 *		does not redraw itself, this call does nothing.
 */

extern routine dbx_update;

/* --- dbx_qUpdate --- *
 *
 * On entry:	R0 == dialogue box handle
 *		R1 == icon number of control to update
 *
 * On exit:	--
 *
 * Use:		Makes a control quickly update itself in whichever way it
 *		needs to in order to be perfect again.  It is anticipated
 *		that this is used to update EORed areas of the control.
 */

extern routine dbx_qUpdate;

/*----- Standard dbx flags ------------------------------------------------*
 *
 * Individual controls may have their own flags starting at bit 8.
 */

#define dbxFlag_dataR10 ((1<<0))
#define dbxFlag_dataR12 ((1<<1))

/*----- dbx event codes ---------------------------------------------------*
 *
 * All events have:
 *
 *		R0 == event code
 *		R1 == icon handle of control
 *		R8 == pointer to control workspace
 *		R9 == pointer to control definition body
 *		R10 == dialogue box handle
 *		R12 == control handler workspace
 */

#define dbxEvent_click 0

#define dbxEvent_redraw 1

#define dbxEvent_key 2

#define dbxEvent_drop 3

#define dbxEvent_help 4

#define dbxEvent_update 5

/* --- dbxEvent_drop subreason codes --- */

#define dbxDrop_load 0
#define dbxDrop_save 1

/* --- dbx event masks --- */

#define dbxMask_click ((1<<dbxEvent_click))
#define dbxMask_redraw ((1<<dbxEvent_redraw))
#define dbxMask_key ((1<<dbxEvent_key))
#define dbxMask_drop ((1<<dbxEvent_drop))
#define dbxMask_help ((1<<dbxEvent_help))
#define dbxMask_update ((1<<dbxEvent_update))

/*----- That's all, folks -------------------------------------------------*/

#endif
