(*
 * Title: baricon.h
 * Purpose: Support placing of an icon on the icon bar.
 *
 *)

#ifndef __baricon_h
#define __baricon_h

# ifndef __wimp_h
# include "wimp.h"
# endif

(* -------------------------baricon_clickproc---------------------- *)

(* baricon_clickproc is the type of a function to be called when Select 
 * is clicked.
 *)
type baricon_clickproc = ^procedure clickproc(i : wimp_i);

(* ----------------------------- baricon -----------------------------------
 * Description:   Installs the named sprite as an icon on the right of the 
 *                icon bar and registers a function to be called when Select 
 *                is clicked.
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 *) 
procedure baricon(spritename : string;
                 spritearea : integer;
                 p : baricon_clickproc) : wimp_i; extern;

(* -------------------------------- baricon_left --------------------------
 * Description:   Installs the named sprite as an icon on the left of the
 *                icon bar and regsiters a function to be called when Select
 *                is clicked.
 *
 * Parameters:    As for baricon, above.
 * Returns:       As for baricon, above.
 * Other info:    As for baricon, above.
 *)
procedure baricon_left(spritename : string;
                 spriteare : integer;
                 p : baricon_clickproc) : wimp_i; extern;

(* ----------------------------- baricon_textandsprite --------------------
 * Description:   Installs the named sprite as an icon on the right of the 
 *                icon bar with some given text below it, and registers a 
 *                function to be called when Select is clicked.  
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                char *text           -- text to appear under sprite
 *                int bufflen          -- length of text buffer
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 *                The width of the icon is taken as the greater of bufflen
 *                system font characters and the width of the sprite used.
 *
 *) 
procedure baricon_textandsprite(spritename : string;
                text : string;
                bufflen : integer;
                spritearea : integer;
                p : baricon_clickproc) : wimp_i; extern;

(* -------------------------- baricon_textandsprite_left ------------------
 * Description:   Installs the named sprite as an icon on the right of the 
 *                icon bar with some given text below it, and registers a 
 *                function to be called when Select is clicked.  
 *
 * Parameters:    char *spritename     -- name of sprite to be used
 *                char *text           -- text to appear under sprite
 *                int bufflen          -- length of text buffer
 *                int spritearea       -- area in which sprite is held
 *                baricon_clickproc p  -- pointer to function to be
 *                                        called on left mouse click
 * Returns:       the icon number of the installed icon (of type wimp_i).
 *                This will be passed to function "p" on left mouse click.
 * Other info:    For details of installing a menu handler for this icon
 *                see event_attachmenu().
 *                The width of the icon is taken as the greater of bufflen
 *                system font characters and the width of the sprite used.
 *
 *) 
procedure baricon_textandsprite_left(spritename : string;
                text : string;
                bufflen : integer;
                spritearea : integer;
                p : baricon_clickproc) : wimp_i; extern;


(* ----------------------------- baricon_newsprite -------------------------
 * Description:   Changes the sprite used on the icon bar
 *
 * Parameters:    char *newsprite  -- name of new sprite to be used
 *
 * Returns:       the icon number of the installed icon sprite
 * Other Info:    Newsprite must be held in the same sprite area as
 *                the sprite used in baricon()
 *
 *)
procedure baricon_newsprite(newsprite : string) : wimp_i; extern;

#endif

(* end baricon.h *)
