(*
 * Title: fontselect.h
 * Purpose: Consistent interface to font choosing
 *
 *)

#ifndef __fontselect_h
#define __fontselect_h

type fontselect_fn = ^function fontselect(font_name : string;
                                       width, hieght : real;
                                       event : wimp_eventstr_ptr) : boolean;

(* --------------------------- fontselect_init -----------------------------
 * Description:   Read in the font list and prepare data for the font
 *                selector window
 *
 * Parameters:
 * Returns:       TRUE if initialisation succeeded.
 * Other Info:
 *)
function fontselect_init : integer; extern;


(* ------------------------ fontselect_closedown --------------------------
 * Description:   Close the font selector windows if they are open, and
 *                free the font selector data structures
 *
 * Parameters:
 * Returns:
 * Other Info:    This call is provided to return the machine to the state
 *                it was in before a call of fontselect_init()
 *)
procedure fontselect_closedown; extern;


(* ------------------------ fontselect_closewindows -----------------------
 * Description:   Close the font selector windows if they are open
 *
 * Parameters:
 * Returns:
 * Other Info:    This call will close the font selector windows and
 *                unattach the handlers, if they are open.
 *)
procedure fontselect_closewindows; extern;


(* ------------------------ fontselect_selector ---------------------------
 * Description:   Opens up or reopens the font chooser window.
 *
 * Parameters:    char *title                -- The title for the window
 *                                              (can be NULL if flags
 *                                              SETTITLE is clear)
 *                int flags                  -- The flags for the call
 *                                              (see below)
 *                char *font_name            -- The font name to set the
 *                                              window contents to (only if
 *                                              SETFONT is set)
 *                double width               -- The width in point size of
 *                                              the font
 *                double height              --
 *                fontselect_fn unknown_icon --
 * Returns:       The window handle of the font selector main window, if
 *                the function call was successful. Otherwise it returns 0.
 * Other Info:    The flags word allows the call to have different effects.
 *                    If fontselect_SETFONT is set then the window contents
 *                    will be updated to reflect the font choice passed in.
 *                    If fontselect_SETTITLE is set then the title of the
 *                    window will be set, otherwise title is ignored.
 *                    If fontselect_REOPEN is set then the font selector
 *                    will only open the window if it is already open. This
 *                    lets the application update the contents of the window
 *                    only if it is currently open.
 *                Note that the fontselect_init() must be called before this
 *                routine.
 *)
function fontselect_selector(title : string;
                flags : integer;
                font_name : string;
                width, height : real;
                unknown_icon_routine : fontselect_fn) : integer; extern;

const   fontselect_REOPEN    = $001;
        fontselect_SETTITLE  = $002;
        fontselect_SETFONT   = $004;


(* ------------------------- fontselect_attach_menu ------------------------
 * Description:   Attaches a menu to all four font selector windows
 *
 * Parameters:    menu mn                        -- menu to attach
 *                event_menu_proc menu_processor -- menu processor for the
 *                                                  menu events
 *                void *handle                   -- handle to pass to the
 *                                                  menu processor
 * Returns:       TRUE if the menus were attached, FALSE otherwise
 * Other Info:    none.
 *)
function fontselect_attach_menu(mn : menu;
                menu_processor : event_menu_proc;
                handle : pointer) : boolean; extern;


#endif


(* end fontselect.h *)
