/*
 * drag.h
 *
 * [Generated from drag, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __drag_h
#define __drag_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  drag_start
 *  drag_scroll
 *  drag_setDash
 *  drag_cancel
 *  drag_redraw
 *  drag_eorColour
 */

/* --- drag_start --- *
 *
 * On entry:	R0 == window containing the drag
 *		R1 == flags word (see flags below)
 *		R2 == pointer to drag routine
 *		R3 == magic number to pass in R9
 *		R4 == value to pass to routine in R10
 *		R5 == value to pass to routine in R12
 *
 * On exit:	--
 *
 * Use:		Starts a drag operation.  Any outstanding drag operation
 *		is cancelled on the assumption that someone stole our
 *		UserDragBox event.
 */

extern routine drag_start;

/* --- drag_scroll --- *
 *
 * On entry:	R1 == pointer to window state block
 *
 * On exit:	R2,R3 == new scroll positions to set
 *		R14 == R1+20 (pointer to scroll offsets)
 *
 * Use:		Works out the scroll positions which should be set to auto-
 *		scroll the window.  The algorithm is simple: the window is
 *		scrolled so that the point beneath the mouse pointer is
 *		within the window's visible work area.
 */

extern routine drag_scroll;

/* --- drag_setDash --- *
 *
 * On entry:	R0 == dash pattern byte
 *
 * On exit:	--
 *
 * Use:		Sets the dash pattern to be the given value.
 */

extern routine drag_setDash;

/* --- drag_cancel --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Cancels the current drag operation.
 */

extern routine drag_cancel;

/* --- drag_redraw --- *
 *
 * On entry:	R1 == pointer to redraw block
 *
 * On exit:	--
 *
 * Use:		Redraws the drag box, if the redraw takes place in the
 *		currently dragging window.
 */

extern routine drag_redraw;

/* --- drag_eorColour --- *
 *
 * On entry:	R0 == colour A
 *		R1 == colour B
 *
 * On exit:	--
 *
 * Use:		Sets the foreground colour to be an EOR colour such that
 *		when painted over Wimp colour A, it appears as Wimp colour B.
 */

extern routine drag_eorColour;

/*----- Flags -------------------------------------------------------------*/

#define drFlag_noUpdate ((1<<0))

/*----- Drag handler events -----------------------------------------------*/

/* --- Note --- *
 *
 * The events which request that you draw something are called for each
 * rectangle of the draw operation -- i.e. do not call Wimp_GetRectangle
 * because this is done for you.
 */

#define drEvent_draw 0

#define drEvent_undraw 1

#define drEvent_update 2

#define drEvent_trans 3

#define drEvent_getPos 4

#define drEvent_done 5

#define drEvent_cancel 6

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

#endif
