home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / Drag < prev    next >
Encoding:
Text File  |  1994-10-03  |  3.2 KB  |  95 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. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27.  
  28. /*  Drag_Initialise ----------------------------------------------------------
  29.  *  This function initialises the drag system for use with the Event
  30.  *  sublibrary, registering Handler_DragNULL and Handler_DragFinish with Event.
  31.  *
  32.  *  If you don't use Event, you'll need to do something along similar lines
  33.  *  for yourself.
  34.  *
  35.  *  attachNULLhandler should be TRUE if you want to use an update handler
  36.  *  (for e.g. redrawing a selection as the user drags), or FALSE if you
  37.  *  do not want an update handler ever (if, e.g. the only drags you use are
  38.  *  for file saves etc where the WIMP/DragASpr takes care of all redrawing)
  39.  *
  40.  *  (See below for a description of how dragging should be done)
  41.  */
  42.  
  43. extern void Drag_Initialise(BOOL attachNULLhandler);
  44.  
  45.  
  46. /*  Drag handlers ------------------------------------------------------------
  47.  *  During a drag, the currentupdate proc is called on each NULL event
  48.  *  When a drag operation completes, currentcomplete proc is called.
  49.  *  The userdata is passed in to both of these functions to indicate
  50.  *  just what drag is being updated.
  51.  *  (See below)
  52.  */
  53.  
  54. typedef void (* drag_handler) (void *userdata);
  55.  
  56. extern drag_handler drag_currentupdate;
  57. extern drag_handler drag_currentcomplete;
  58. extern void         *drag_currentuserdata;
  59.  
  60.  
  61. /*  Drag_SetHandlers ---------------------------------------------------------
  62.  *  When you wish to do a drag operation, do the following:
  63.  *    * Call Wimp_DragBox (or equivalent) as appropriate to start the WIMP
  64.  *      dragging.
  65.  *    * Call Drag_SetHandlers to set the procedures that will be called on
  66.  *      each NULL event during dragging, and on completion of the drag
  67.  *      operation.
  68.  *    * Sit back, and let the event handlers do all (well, some of) the work.
  69.  *
  70.  *    Your handler(s) may be NULL, in which case that handler is not called.
  71.  *    Userdata is anything you wish, and is passed into your handlers for
  72.  *    convenience.
  73.  *    Your handlers should be of the form:
  74.  *      void MyDragUpdateHandler(void *myuserdata)
  75.  *      {
  76.  *         (e.g. Get Mouse info and redraw selection)
  77.  *      }
  78.  *
  79.  *      void MyDragFinishHandler(void *myuserdata)
  80.  *      {
  81.  *        (e.g. Set new selection,
  82.  *              or save a file if dragging an icon, etc)
  83.  *      }
  84.  */
  85.  
  86. extern void Drag_SetHandlers(drag_handler uproc, drag_handler cproc,
  87.                              void *userdata);
  88.  
  89.  
  90. #ifdef __cplusplus
  91.            }
  92. #endif
  93.  
  94. #endif
  95.