/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "Licence").
 * You may not use this file except in compliance with the Licence.
 *
 * You can obtain a copy of the licence at RISC OS path @.^.LICENCE
 * or  http://www.riscosdev.com/lanman98/LICENCE.CDDL
 * See the Licence for the specific language governing permissions
 * and limitations under the Licence.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the Licence file. If applicable, add the
 * following below this CDDL HEADER, with the fields enclosed by
 * brackets "[]" replaced with your own identifying information:
 * Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
 
/*
 *   Portions Copyright 1996 Warm Silence Software Ltd.
 */

/******************************************************/
/*                                                    */
/* Name: PGmnu.h                                      */
/* Author: Paul Gardiner.                             */
/* Function:                                          */
/*   Provides a library of function for producing     */
/* menus, for use PGwin. They CANNOT be used in       */
/* isolation.                                         */
/*                                                    */
/******************************************************/

#ifndef _PGmnu_
#define _PGmnu_

#include "PGwin.h"

typedef void (*mnu_action)(void);

typedef void (*mnu_set_colour)(int);

typedef struct mnu_item_s *mnu_item;

typedef struct mnu_menu_s *mnu_menu;



mnu_item MnuAction(char *, mnu_action);
    /* Defines a menu item, with text and action as */
    /* specified. At present the text is limited to */
    /* 12 characters.                               */

mnu_item MnuColSel(char *, mnu_set_colour);
/*
    Defines a menu item for selecting a WIMP colour.
    When a colour is selected the function of type
    mnu_set_colour is executed with the selected
    colour as argument.
*/

mnu_item MnuSubmenu(char *, mnu_menu);
    /* Defines a menu item, with text and submenu.  */

mnu_item MnuSetAct(mnu_item, mnu_action);
/*
   Sets the press action for an existing item,
   for giving submenus a default.
*/

void MnuTick(mnu_item, int);
/*
   Control whether a tick will appear on a menu
   item next time the menu is opened.
 */

void MnuGrey(mnu_item, int);
/*
   Control whether a menu item will be greyed out
   on the next opening.
 */

mnu_menu MnuMenu(char *, mnu_item *);
    /* Defines a menu, taking the items from the    */
    /* specified NULL-terminated array. The         */
    /* character array specifies the title.         */

mnu_menu MnuWindow(win_window);
    /* Defines a window menu. Untested!             */

void MnuOpen(mnu_menu);
    /* Displays a menu on the screen. Items         */
    /* selected by the user will have their         */
    /* associated actions performed during calls to */
    /* either WinCoop, which are defined in the     */
    /* module PGwin.                                */

void MnuRedraw(void);
/*
    Redraws the currently open menu (if there is one).
*/

char *MnuClickedItemText(void);
/*
  To be called in the handler for a menu item;
  returns the text of the item.
*/

#endif /* _PGmnu */
