/*
 * template.h
 *
 * [Generated from template, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __template_h
#define __template_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  template_find
 *  template_copy
 *  template_embedded
 *  template_free
 *  template_load
 *  template_init
 */

/* --- template_find --- *
 *
 * On entry:	R0 == pointer to name to match
 *
 * On exit:	R0 == pointer to window definition if found
 *		May return an error
 *
 * Use:		Locates a template in the list and gives you a pointer to
 *		the corresponding window defintion.  You may update the
 *		definition to store an updated window state if you really
 *		want to.
 */

extern routine template_find;

/* --- template_copy --- *
 *
 * On entry:	R0 == pointer to name to match
 *
 * On exit:	R0 == pointer to copy of a window definition
 *		May return an error
 *
 * Use:		Returns a copy of a window template (for the use of the
 *		dialogue box system mainly), including all indirected data
 *		set up properly and everything.  The copy is writable.  To
 *		get rid of the copy, call template_free.
 */

extern routine template_copy;

/* --- template_embedded --- *
 *
 * On entry:	R0 == pointer to embedded template definition
 *
 * On exit:	R0 == pointer to copy (as for template_copy)
 *
 * Use:		Extracts an embedded template into a template block.
 *		Embedded templates can be generated using the templAOF
 *		program, and then linked into your application.
 */

extern routine template_embedded;

/* --- template_free --- *
 *
 * On entry:	R0 == pointer to block allocated with template_copy
 *
 * On exit:	--
 *
 * Use:		Frees a template copy created using template_copy.
 */

extern routine template_free;

/* --- template_load --- *
 *
 * On entry:	R0 == pointer to name of template file to load
 *
 * On exit:	May return an error
 *
 * Use:		Loads the specified template file, and adds its window
 *		definitions into the template list so they can be used when
 *		creating dialogue boxes or windows.
 *
 *		If the templates can't be loaded (e.g. there isn't enough
 *		memory) an error is generated (and can be caught using the
 *		standard Sapphire except mechanism).
 */

extern routine template_load;

/* --- template_init --- *
 *
 * On entry:	R0 == pointer to application name
 *
 * On exit:	--
 *
 * Use:		Initialises the template list and font array, and loads the
 *		`Templates' resource file.
 */

extern routine template_init;

/*----- That's all, folks -------------------------------------------------*/

#endif
