home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / !DeskLib / h / Drag < prev    next >
Encoding:
Text File  |  1994-04-01  |  3.1 KB  |  88 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Drag.h
  12.     Author:  Copyright © 1994 Jason Williams
  13.     Version: 1.00 (01 April 1994)
  14.     Purpose: Automatic handling of drag update and finish events
  15. */
  16.  
  17. #ifndef __dl_drag_h
  18. #define __dl_drag_h
  19.  
  20. #ifndef __dl_core_h
  21. #include "Core.h"
  22. #endif
  23.  
  24.  
  25. /*  Drag_Initialise ----------------------------------------------------------
  26.  *  This function initialises the drag system for use with the Event
  27.  *  sublibrary, registering Handler_DragNULL and Handler_DragFinish with Event.
  28.  *
  29.  *  If you don't use Event, you'll need to do something along similar lines
  30.  *  for yourself.
  31.  *
  32.  *  attachNULLhandler should be TRUE if you want to use an update handler
  33.  *  (for e.g. redrawing a selection as the user drags), or FALSE if you
  34.  *  do not want an update handler ever (if, e.g. the only drags you use are
  35.  *  for file saves etc where the WIMP/DragASpr takes care of all redrawing)
  36.  *
  37.  *  (See below for a description of how dragging should be done)
  38.  */
  39.  
  40. extern void Drag_Initialise(BOOL attachNULLhandler);
  41.  
  42.  
  43. /*  Drag handlers ------------------------------------------------------------
  44.  *  During a drag, the currentupdate proc is called on each NULL event
  45.  *  When a drag operation completes, currentcomplete proc is called.
  46.  *  The userdata is passed in to both of these functions to indicate
  47.  *  just what drag is being updated.
  48.  *  (See below)
  49.  */
  50.  
  51. typedef void (* drag_handler) (void *userdata);
  52.  
  53. extern drag_handler drag_currentupdate;
  54. extern drag_handler drag_currentcomplete;
  55. extern void         *drag_currentuserdata;
  56.  
  57.  
  58. /*  Drag_SetHandlers ---------------------------------------------------------
  59.  *  When you wish to do a drag operation, do the following:
  60.  *    * Call Wimp_DragBox (or equivalent) as appropriate to start the WIMP
  61.  *      dragging.
  62.  *    * Call Drag_SetHandlers to set the procedures that will be called on
  63.  *      each NULL event during dragging, and on completion of the drag
  64.  *      operation.
  65.  *    * Sit back, and let the event handlers do all (well, some of) the work.
  66.  *
  67.  *    Your handler(s) may be NULL, in which case that handler is not called.
  68.  *    Userdata is anything you wish, and is passed into your handlers for
  69.  *    convenience.
  70.  *    Your handlers should be of the form:
  71.  *      void MyDragUpdateHandler(void *myuserdata)
  72.  *      {
  73.  *         (e.g. Get Mouse info and redraw selection)
  74.  *      }
  75.  *
  76.  *      void MyDragFinishHandler(void *myuserdata)
  77.  *      {
  78.  *        (e.g. Set new selection,
  79.  *              or save a file if dragging an icon, etc)
  80.  *      }
  81.  */
  82.  
  83. extern void Drag_SetHandlers(drag_handler uproc, drag_handler cproc,
  84.                              void *userdata);
  85.  
  86.  
  87. #endif
  88.