MenuHandler.h

/*
    File:       MenuHandler.h
 
    Contains:   Main program file for the ColorReset application
 
    Written by: Forrest Tanaka  
 
    Copyright:  Copyright © 1988-1999 by Apple Computer, Inc., All Rights Reserved.
 
                You may incorporate this Apple sample source code into your program(s) without
                restriction. This Apple sample source code has been provided "AS IS" and the
                responsibility for its operation is yours. You are not permitted to redistribute
                this Apple sample source code as "Apple sample source code" after having made
                changes. If you're going to re-distribute the source, we require that you make
                it clear in the source that the code was descended from Apple sample source
                code, but that you've made changes.
 
    Change History (most recent first):
                7/13/1999   Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
                
 
*/
#ifndef __MENUHANDLER__
#define __MENUHANDLER__
 
 
 
/******************************************************************************\
* Constants
\******************************************************************************/
 
#define mApple 128 /* Menu ID and resource ID of Apple menu */
#define iAbout   1 /* Menu item number of About SevenPaint item */
 
#define mFile 129 /* Menu ID and resource ID of File menu */
#define iOpen   1 /* Menu item number of OpenÉ item */
#define iClose  3 /* Menu item number of Close item */
#define iSaveAs 4 /* Menu item number of Save AsÉ item */
#define iQuit   6 /* Menu item number of Quit item */
 
#define mEdit 130 /* Menu ID and resource ID of Edit menu */
#define iUndo   1 /* Menu item number of Undo item */
#define iCut    3 /* Menu item number of Cut item */
#define iCopy   4 /* Menu item number of Copy item */
#define iPaste  5 /* Menu item number of Paste item */
#define iClear  6 /* Menu item number of Undo item */
 
#define mDisplay     131 /* Menu ID and resource ID of Display menu */
#define iDithering   1   /* Menu item number of Dithering item */
#define iForeground  2   /* Menu item number of Foreground ColorÉ item */
#define iBackgreound 3   /* Menu item number of Background ColorÉ item */
 
#define mLastMenu mDisplay /* Menu ID of the last menu in the menu bar */
 
 
/******************************************************************************\
* StartMenus - Do additional initialization of the menus
*
* This routine is called just after calling the Utilities sample code routine,
* StandardMenuSetup.  This application needs to do just a little bit of
* additional initialization for menus.  See MenuHandler.c for details.
*
* If there isnÕt enough memory to load the menus, then memFullErr is returned.
* If desired menu resources couldnÕt be found, then resNotFound is returned.  If
* any other error occurs, then dsSysErr is returned.
\******************************************************************************/
 
OSErr StartMenus(void);
 
 
/******************************************************************************\
* DoMenuChoice - Dispatch to the appropriate routine for a menu choice
*
* When itÕs determined that a menu item was chosen, this routine is called to
* dispatch to the appropriate routine for the chosen menu item.  The menu item
* and menu number returned by MenuSelect and MenuKey is passed in the menuChoice
* parameter.
\******************************************************************************/
 
void DoMenuChoice(
    long menuChoice);
 
 
/******************************************************************************\
* FixMenus - Fix menus so that proper items are enabled and marked
*
* FixMenus is called to assure that menu items are disable, enabled, marked, and
* unmarked appropriately.  ItÕs called at the end of every iteration of the main
* event loop.
\******************************************************************************/
 
void FixMenus(void);
 
 
/******************************************************************************\
* DisableAllMenus - Disable all menus except for the Help and Keyboard menus
*
* This routine disables all menus for a modal dialog box.  To restore all the
* menuÕs enable states back to the way they were, call RestoreAllMenus.
* FixMenus should not be called between the calls to DisableAllMenus and
* ReenableAllMenus.
\******************************************************************************/
 
void DisableAllMenus(void);
 
 
/******************************************************************************\
* ReenableAllMenus - Reenable menus that were enabled at DisableAllMenus
*
* ReenableAllMenus reenables all menus that were disabled with DisableAllMenus.
* This routine should be called after a modal dialog box goes away.
\******************************************************************************/
 
void ReenableAllMenus(void);
 
 
#endif