DeskLib 2.90a:Drag.h


Contents


Introduction and Overview

This header provides a way to handle drags using the Event sublibrary.


Functions


Drag_Initialise

void Drag_Initialise(BOOL attachNULLhandler);

This function must be called to initialise the drag system for use with the Event sublibrary before you use other Drag functions.

attachNULLhandler should be TRUE if you want to use an update handler to do things on Null events. You usually only need this if you are dragging user-redrawn objects, or are using the drag-and-drop protocol between applications.


Drag_SetHandlers

void Drag_SetHandlers(drag_handler uproc, drag_handler cproc, void *userdata);

This sets the functions which will be called during the drag (uproc) and after when the drag finishes (cproc). Either of these may be NULL in which case it will not be used. In any case, uproc will only be called if you told Drag_Initialise that you wanted to claim Null events.

userdata is a pointer that is passed to your handlers for your own use.

Note that this only sets the handlers, it doesn't actually start the drag - you need to call Wimp_DragBox or an equivalent to start the drag.


Type


drag_handler

typedef void (*drag_handler)(void *userdata);

This type is used to define functions called by the Drag library during and at the end of a drag. The userdata is passed to these functions to indicate what drag is being updated or finished.


Variables


drag_currentupdate

extern drag_handler drag_currentupdate;

This is used to keep track of which function to call during the current drag.


drag_currentcomplete

extern drag_handler drag_currentcomplete;

This is used to keep track of which function to call when the current drag ends (when the mouse button is released).


drag_currentuserdata

extern void *drag_currentuserdata;

This contains the user data pointer for the current drag.