/*
 * Name        : quit.h
 * Description : C veneers to the Methods provided by the quit class
 * Copyright   :  Pace Micro Technology, 1994-2000
 */



#ifndef __quit_h
#define __quit_h


#ifndef __kernel_h
#include "kernel.h"
#endif

#ifndef __toolbox_h
#include "toolbox.h"
#endif

#ifndef __window_h
#include "window.h"
#endif


/****************************************************************************
 * Quit Templates                                                           *
 ****************************************************************************/

/*-- template --*/

typedef struct
{
  unsigned int   flags;
  char           *title;
  int            max_title;
  char           *message;
  int            max_message;
  char           *window;
} QuitTemplate;

#define Quit_GenerateAboutToBeShown              0x00000001
#define Quit_GenerateDialogueCompleted           0x00000002


/****************************************************************************
 * Quit SWI Calls                                                           *
 ****************************************************************************/

#define Quit_SWIChunkBase    0x82a90
#define Quit_ObjectClass     Quit_SWIChunkBase
#define Quit_ClassSWI        (Quit_SWIChunkBase + 0)
#define Quit_PostFilter      (Quit_SWIChunkBase + 1 - 0x10)
#define Quit_PreFilter       (Quit_SWIChunkBase + 2 - 0x10)


/****************************************************************************
 * Quit Methods                                                             *
 ****************************************************************************/

#define Quit_GetWindowId         0
#define Quit_SetMessage          1
#define Quit_GetMessage          2
#define Quit_SetTitle            3
#define Quit_GetTitle            4



/****************************************************************************
 * Quit Toolbox Events                                                      *
 ****************************************************************************/


/*-- event codes --*/

#define Quit_AboutToBeShown      (Quit_SWIChunkBase+0)
#define Quit_Quit                (Quit_SWIChunkBase+1)
#define Quit_DialogueCompleted   (Quit_SWIChunkBase+2)
#define Quit_Cancel              (Quit_SWIChunkBase+3)


typedef struct
{
  ToolboxEventHeader hdr;
  int                show_type;
  union
  {
    TopLeft               pos;
    WindowShowObjectBlock full;
  } info;

} QuitAboutToBeShownEvent;


typedef struct
{
  ToolboxEventHeader hdr;

} QuitQuitEvent;


typedef struct
{
  ToolboxEventHeader hdr;

} QuitDialogueCompletedEvent;

typedef struct
{
  ToolboxEventHeader hdr;

} QuitCancelEvent;


/****************************************************************************
 * The following functions provide veneers to the methods that are          *
 * associated with this particular class.  Please read the User Interface   *
 * Toolbox manual for more detailed information on their functionality.     *
 ****************************************************************************/



#ifdef __cplusplus
  extern "C" {
#endif


/*
 * Name        : quit_get_window_id
 * Description : Get the id of the underlying window object for the quit object 
 * In          : unsigned int flags
 *               ObjectId quit
 * Out         : ObjectId *window
 * Returns     : pointer to error block
 */

extern _kernel_oserror *quit_get_window_id ( unsigned int flags,
                                             ObjectId quit,
                                             ObjectId *window
                                           );


/*
 * Name        : quit_set_message
 * Description : Sets the message used in the quit object 
 * In          : unsigned int flags
 *               ObjectId quit
 *               char *message
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *quit_set_message ( unsigned int flags,
                                           ObjectId quit,
                                           char *message
                                         );


/*
 * Name        : quit_get_message
 * Description : Gets the message used in the quit object 
 * In          : unsigned int flags
 *               ObjectId quit
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *quit_get_message ( unsigned int flags,
                                           ObjectId quit,
                                           char *buffer,
                                           int buff_size,
                                           int *nbytes
                                         );


/*
 * Name        : quit_set_title
 * Description : Sets the title for the specified quit object 
 * In          : unsigned int flags
 *               ObjectId quit
 *               char *title
 * Out         : None
 * Returns     : pointer to error block
 */

extern _kernel_oserror *quit_set_title ( unsigned int flags,
                                         ObjectId quit,
                                         char *title
                                       );


/*
 * Name        : quit_get_title
 * Description : Gets the title for the specified quit object 
 * In          : unsigned int flags
 *               ObjectId quit
 *               char *buffer
 *               int buff_size
 * Out         : int *nbytes
 * Returns     : pointer to error block
 */

extern _kernel_oserror *quit_get_title ( unsigned int flags,
                                         ObjectId quit,
                                         char *buffer,
                                         int buff_size,
                                         int *nbytes
                                       );


#ifdef __cplusplus
  }
#endif


#endif
