#ifndef proginfo_H
#define proginfo_H

/* C header file for ProgInfo
 * written by DefMod (Apr  1 1999) on Thu Apr  8 02:52:30 1999
 * Jonathan Coxhead, jonathan@doves.demon.co.uk, 5 Sept 1995
 */

/*OSLib---efficient, type-safe, transparent, extensible,
   register-safe A P I coverage of RISC O S*/
/*Copyright  1994 Jonathan Coxhead*/

/*
      OSLib is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 1, or (at your option)
   any later version.

      OSLib is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

      You should have received a copy of the GNU General Public License
   along with this programme; if not, write to the Free Software
   Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, U S A.
*/

#ifndef types_H
#include "types.h"
#endif

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

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

/**********************************
 * SWI names and SWI reason codes *
 **********************************/
#undef  ProgInfo_ClassSWI
#define ProgInfo_ClassSWI                       0x82B40
#undef  XProgInfo_ClassSWI
#define XProgInfo_ClassSWI                      0xA2B40
#undef  ProgInfo_PostFilter
#define ProgInfo_PostFilter                     0x82B41
#undef  XProgInfo_PostFilter
#define XProgInfo_PostFilter                    0xA2B41
#undef  ProgInfo_PreFilter
#define ProgInfo_PreFilter                      0x82B42
#undef  XProgInfo_PreFilter
#define XProgInfo_PreFilter                     0xA2B42
#undef  ProgInfo_GetWindowID
#define ProgInfo_GetWindowID                    0x0
#undef  ProgInfo_SetVersion
#define ProgInfo_SetVersion                     0x1
#undef  ProgInfo_GetVersion
#define ProgInfo_GetVersion                     0x2
#undef  ProgInfo_SetLicenceType
#define ProgInfo_SetLicenceType                 0x3
#undef  ProgInfo_GetLicenceType
#define ProgInfo_GetLicenceType                 0x4
#undef  ProgInfo_SetTitle
#define ProgInfo_SetTitle                       0x5
#undef  ProgInfo_GetTitle
#define ProgInfo_GetTitle                       0x6

/************************************
 * Structure and union declarations *
 ************************************/
typedef struct proginfo_object                  proginfo_object;
typedef struct proginfo_action_about_to_be_shown proginfo_action_about_to_be_shown;

/********************
 * Type definitions *
 ********************/
typedef bits proginfo_flags;

typedef int proginfo_licence;

struct proginfo_object
   {  proginfo_flags flags;
      toolbox_msg_reference title;
      int title_limit;
      toolbox_msg_reference purpose;
      toolbox_msg_reference author;
      proginfo_licence licence_type;
      toolbox_msg_reference version;
      toolbox_string_reference alternative_window_name;
   };

typedef toolbox_full proginfo_full;

struct proginfo_action_about_to_be_shown
   {  toolbox_position_tag tag;
      union
      {  os_coord top_left;
         proginfo_full full;
      }
      position;
   };

/************************
 * Constant definitions *
 ************************/
#define class_PROG_INFO                         ((toolbox_class) 0x82b40)
#define proginfo_GENERATE_ABOUT_TO_BE_SHOWN     ((proginfo_flags) 0x1)
#define proginfo_GENERATE_DIALOGUE_COMPLETED    ((proginfo_flags) 0x2)
#define proginfo_INCLUDE_LICENCE_TYPE           ((proginfo_flags) 0x4)
#define proginfo_NAME                           ((toolbox_c) 0x82b400)
#define proginfo_PURPOSE                        ((toolbox_c) 0x82b401)
#define proginfo_AUTHOR                         ((toolbox_c) 0x82b402)
#define proginfo_LICENCE_TYPE                   ((toolbox_c) 0x82b403)
#define proginfo_VERSION                        ((toolbox_c) 0x82b404)
#define proginfo_NAME_LABEL                     ((toolbox_c) 0x82b405)
#define proginfo_PURPOSE_LABEL                  ((toolbox_c) 0x82b406)
#define proginfo_AUTHOR_LABEL                   ((toolbox_c) 0x82b407)
#define proginfo_LICENCE_LABEL                  ((toolbox_c) 0x82b408)
#define proginfo_VERSION_LABEL                  ((toolbox_c) 0x82b409)
#define proginfo_LICENCE_PUBLIC_DOMAIN          ((proginfo_licence) 0x0)
#define proginfo_LICENCE_SINGLE_USER            ((proginfo_licence) 0x1)
#define proginfo_LICENCE_SINGLE_MACHINE         ((proginfo_licence) 0x2)
#define proginfo_LICENCE_SITE                   ((proginfo_licence) 0x3)
#define proginfo_LICENCE_NETWORK                ((proginfo_licence) 0x4)
#define proginfo_LICENCE_AUTHORITY              ((proginfo_licence) 0x5)
#define action_PROG_INFO_ABOUT_TO_BE_SHOWN      0x82B40u
#define action_PROG_INFO_DIALOGUE_COMPLETED     0x82B41u
#define error_PROG_INFO_TASKS_ACTIVE            0x80B400u
#define error_PROG_INFO_ALLOC_FAILED            0x80B401u
#define error_PROG_INFO_SHORT_BUFFER            0x80B402u
#define error_PROG_INFO_NO_SUCH_TASK            0x80B411u
#define error_PROG_INFO_NO_SUCH_METHOD          0x80B412u
#define error_PROG_INFO_NO_SUCH_MISC_OP_METHOD  0x80B413u

/*************************
 * Function declarations *
 *************************/

#ifdef __cplusplus
   extern "C" {
#endif

/* ------------------------------------------------------------------------
 * Function:      proginfo_get_window_id()
 *
 * Description:   Calls reason code 0 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *
 * Output:        window - value of R0 on exit (X version only)
 *
 * Returns:       R0 (non-X version only)
 *
 * Other notes:   Before entry, R2 = 0x0.
 */

extern os_error *xproginfo_get_window_id (bits flags,
      toolbox_o prog_info,
      toolbox_o *window);
extern toolbox_o proginfo_get_window_id (bits flags,
      toolbox_o prog_info);

/* ------------------------------------------------------------------------
 * Function:      proginfo_set_version()
 *
 * Description:   Calls reason code 1 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *                version - value of R3 on entry
 *
 * Other notes:   Before entry, R2 = 0x1.
 */

extern os_error *xproginfo_set_version (bits flags,
      toolbox_o prog_info,
      char const *version);
extern void proginfo_set_version (bits flags,
      toolbox_o prog_info,
      char const *version);

/* ------------------------------------------------------------------------
 * Function:      proginfo_get_version()
 *
 * Description:   Calls reason code 2 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *                buffer - value of R3 on entry
 *                size - value of R4 on entry
 *
 * Output:        used - value of R4 on exit (X version only)
 *
 * Returns:       R4 (non-X version only)
 *
 * Other notes:   Before entry, R2 = 0x2.
 */

extern os_error *xproginfo_get_version (bits flags,
      toolbox_o prog_info,
      char *buffer,
      int size,
      int *used);
extern int proginfo_get_version (bits flags,
      toolbox_o prog_info,
      char *buffer,
      int size);

/* ------------------------------------------------------------------------
 * Function:      proginfo_set_licence_type()
 *
 * Description:   Calls reason code 3 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *                licence_type - value of R3 on entry
 *
 * Other notes:   Before entry, R2 = 0x3.
 */

extern os_error *xproginfo_set_licence_type (bits flags,
      toolbox_o prog_info,
      proginfo_licence licence_type);
extern void proginfo_set_licence_type (bits flags,
      toolbox_o prog_info,
      proginfo_licence licence_type);

/* ------------------------------------------------------------------------
 * Function:      proginfo_get_licence_type()
 *
 * Description:   Calls reason code 4 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *
 * Output:        licence_type - value of R0 on exit (X version only)
 *
 * Returns:       R0 (non-X version only)
 *
 * Other notes:   Before entry, R2 = 0x4.
 */

extern os_error *xproginfo_get_licence_type (bits flags,
      toolbox_o prog_info,
      proginfo_licence *licence_type);
extern proginfo_licence proginfo_get_licence_type (bits flags,
      toolbox_o prog_info);

/* ------------------------------------------------------------------------
 * Function:      proginfo_set_title()
 *
 * Description:   Calls reason code 5 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *                title - value of R3 on entry
 *
 * Other notes:   Before entry, R2 = 0x5.
 */

extern os_error *xproginfo_set_title (bits flags,
      toolbox_o prog_info,
      char const *title);
extern void proginfo_set_title (bits flags,
      toolbox_o prog_info,
      char const *title);

/* ------------------------------------------------------------------------
 * Function:      proginfo_get_title()
 *
 * Description:   Calls reason code 6 of SWI 0x44EC6
 *
 * Input:         flags - value of R0 on entry
 *                prog_info - value of R1 on entry
 *                buffer - value of R3 on entry
 *                size - value of R4 on entry
 *
 * Output:        used - value of R4 on exit (X version only)
 *
 * Returns:       R4 (non-X version only)
 *
 * Other notes:   Before entry, R2 = 0x6.
 */

extern os_error *xproginfo_get_title (bits flags,
      toolbox_o prog_info,
      char *buffer,
      int size,
      int *used);
extern int proginfo_get_title (bits flags,
      toolbox_o prog_info,
      char *buffer,
      int size);

#ifdef __cplusplus
   }
#endif

#endif
