/*
    ####             #    #     # #
    #   #            #    #       #          The FreeWare C library for 
    #   #  ##   ###  #  # #     # ###             RISC OS machines
    #   # #  # #     # #  #     # #  #   ___________________________________
    #   # ####  ###  ##   #     # #  #                                      
    #   # #        # # #  #     # #  #    Please refer to the accompanying
    ####   ### ####  #  # ##### # ###    documentation for conditions of use
    ________________________________________________________________________

    File:    Handler.h
    Author:  Copyright  1992, 1993, 1994 Jason Williams
    Version: 1.03 (01 April 1994)
    Purpose: Predefined default handlers for you to COPY and use as the
             basis of your own handlers

             NOTE that these are basically EXAMPLE handlers, and so are
             not all designed with peak efficiency in mind.
             PLEASE read the information about these handlers *carefully*
             before use.
             Note that some handlers are for Event, some are for EventMsg
*/


#ifndef __Desk_Handler_h
#define __Desk_Handler_h

#ifdef __cplusplus
	extern "C" {
#endif

#ifndef __Desk_Wimp_h
	#include "Desk.Wimp.h"
#endif


extern Desk_bool Desk_Handler_CloseWindow(Desk_event_pollblock *event, void *reference);
 /*
  *  Simply calls Desk_Wimp_CloseWindow()
  */


extern Desk_bool Desk_Handler_DeleteWindow(Desk_event_pollblock *event, void *reference);
 /*  Alternate handler to Desk_Handler_Close, which calls the higher-level 
  *  Desk_Window_Delete() to close and delete the window, release memory, and
  *  remove all handlers attached to the window.
  */


extern Desk_bool Desk_Handler_OpenWindow(Desk_event_pollblock *event, void *reference);
 /*
  *  Simply calls Desk_Wimp_OpenWindow()
  */


extern Desk_bool Desk_Handler_NullRedraw(Desk_event_pollblock *event, void *reference);
 /*
  *  Supplies a NULL redraw loop (gets rectangles from the WIMP until
  *  all rectangles have been "redrawn"). Doesn't actually do any drawing
  *  though.
  */


extern Desk_bool Desk_Handler_ClickOK(Desk_event_pollblock *event, void *reference);
 /*
  * Handler for clicks on "OK" or "Cancel" (3-d) type buttons 
  * (Indents the button, waits for 1/3 second, and un-indents the button)
  */


extern Desk_bool Desk_Handler_Key(Desk_event_pollblock *event, void *reference);
 /*
  * Handler for unprocessed key events.  Calls Desk_Wimp_ProcessKey to pass
  * the code on to other tasks.
  */




extern Desk_bool Desk_Handler_ModeChange(Desk_event_pollblock *event, void *reference);
 /* 
  * This is a handler for mode change events. It calls Desk_Screen_CacheModeInfo()
  * every time the screen mode changes, guaranteeing that the screen variables
  * are always correct (EXCEPT, YOU must call Desk_Screen_CacheModeInfo() once
  * during initialisation.
  *
  * If you have called Desk_Template_UseOutlineFonts() and the screen resolution
  * has changed in such a way as to necessitate it, it also calls
  * Desk_Window_ModeChange to fix all your icons which use outline fonts
  * (otherwise, they often become the wrong size upon a mode change)
  * (Note that this won't have a very useful effect unless you use Template
  * and Window functions to create all your windows - in fact, such windows
  * will no longer 'own' the fonts they are using, and these fonts may
  * disappear or change at random in the future - so DON'T use this function
  * unless ALL your windows were created with Desk_Window_Create.
  *
  * See also Window.h
  *
  * Attach it to mode change messages using:
  *  Desk_EventMsg_Claim(Desk_message_MODECHANGE, Desk_event_any, Desk_Handler_ModeChange, NULL);
  */




extern Desk_bool Desk_Handler_DragNULL(Desk_event_pollblock *event, void *reference);
/*
 * For use with the Drag sublibrary.
 * See Drag.h for details of how this operates.
 *
 * DragNULL is called on NULL events to allow drag updates (redraw of a
 * selection as it is dragged, for example). It calls the drag handler
 * registered with Desk_Drag_SetHandlers() on each NULL it recieves.
 * (Note that currently I have not written support for enabling and disabling
 * NULL events with the Event sublibrary as needed, because I never use Event)
 *
 */

extern Desk_bool Desk_Handler_DragFinish(Desk_event_pollblock *event, void *reference);

/*
 * For use with the Drag sublibrary.
 * See Drag.h for details of how this operates.
 *
 * DragFinish is called on a USERDRAG event (drag has finished) to tidy up
 * at the end of a drag (Complete a selection, or save a file, etc).
 * This calls the Drag-Completed handler registered with Desk_Drag_SetHandlers
 * and also resets the drag handlers (as no drag is now in progress)
 */



extern Desk_bool Desk_Handler_HatchRedraw(Desk_event_pollblock *event, void *reference);
 /*
  *  Hatch the work area of a window. Useful when testing
  *  a program before you get round to writing your own redraw
  *  routines so you can see that something is happening.
  */


#ifdef __cplusplus
}
#endif


#endif
