home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / desklib / examples / DeskLib / Examples / Widget5 / !Widget5 / h / ATrans next >
Encoding:
Text File  |  1995-05-12  |  2.5 KB  |  77 lines

  1. #include "DeskLib:Sprite.h"
  2.  
  3. /*
  4.  *  ATrans.h Header for Andrew's Transfer library
  5.  *
  6.  *  Provides simple routines for loading and saving in the desktop
  7.  */
  8.  
  9. typedef BOOL (*ATrans_checkload)(int filetype, BOOL data_open);
  10. /*
  11.  * This is called when file is double clicked (data_open = TRUE)
  12.  * or dragged onto the program (data_open = FALSE).
  13.  * The function should return TRUE if the program is prepared
  14.  * to load that particular file.
  15.  */
  16.  
  17. typedef void (*ATrans_loadfile)(char *filename, int filetype, BOOL safe);
  18. /*
  19.  * This function is called to load a particular file.
  20.  * safe = TRUE indicates that the file has come from a "safe" source.
  21.  */
  22.  
  23. typedef void (*ATrans_savefile)(char *filename, int filetype, BOOL safe);
  24. /*
  25.  * This function is called to do the saveing of files.
  26.  * safe = TRUE indicates that the file is "safe".
  27.  */
  28.  
  29. typedef int (*ATrans_sendblock)(int *pointer, int size, int filetype);
  30. /*
  31.  * This function is called when a Ram Transfer is performed.
  32.  * If this routine is not defined then ATrans_savefile will always be
  33.  * used.
  34.  * The routine should fill the buffer at pointer to a maximum of
  35.  * size, and is called repeatedly until a non-full buffer is returned.
  36.  * It should return the ammount of data placed in the buffer.
  37.  */
  38.  
  39. typedef struct
  40. {
  41.   int type;
  42.   int size;
  43.   int ref;
  44.   char file[256];
  45.   BOOL dragging;
  46.   ATrans_checkload checkload;
  47.   ATrans_loadfile loadfile;
  48.   ATrans_savefile savefile;
  49.   ATrans_sendblock sendblock;
  50. } ATrans_defblock;
  51.  
  52. /*
  53.  * call this when a drag of the file icon in your savebox is detected.
  54.  * area sets the spritearea that is used to obtain the icon sprite for
  55.  * solid drags (if selected in CMOS RAM).
  56.  * filesize is the expected size of the file for passing in the messages.
  57.  * window and icon should describe the icon that is being dragged.
  58.  * filename is the proposed filename (not necessarily a leafname).
  59.  * area can be either a user sprite area, or 1 for the wimp sprite area,
  60.  * or 0 for the system sprite area.
  61.  */
  62. void ATrans_startdrag(char *filename, int filetype, int filesize,
  63.                       window_handle window, icon_handle icon, sprite_area area);
  64.  
  65.  
  66. /*
  67.  * call this to initialise the library, do it only once
  68.  * if any of the routines are not present then set the argument to NULL
  69.  * note: for saving, at least ATrans_savefile must be defined.
  70.  *       for loading, both ATrans_loadfile and ATrans_checkload must be defined.
  71.  */
  72. void ATrans_Init(ATrans_checkload checkload,
  73.                  ATrans_loadfile loadfile,
  74.                  ATrans_savefile savefile,
  75.                  ATrans_sendblock sendblock);
  76.  
  77.