home *** CD-ROM | disk | FTP | other *** search
- /*
- File: CAMenu.cpp
-
- Contains: Container Application Library source - Menuing interface
-
- Written by: Steve Foley, Greg Ames, David Nelson
-
- Copyright: © 1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <5> 4/23/95 RB Implemented CAAdjustMenus()
- <4+> 2/28/95 SJF Added debug stuff to API calls
- <4> 2/13/95 SJF Interim checkin to update project database
- <3) 12/15/94 SJF change somGetGlobalEnvironment to _gpProxyShell->GetGlobalEnvironment
- <2> 12/12/94 SJF Clean up compile after adding TCAProxyShell
- <1> 10/30/94 GCA,DHN All mods to make project compile with no
- errors under OpenDoc b1 (with SOM).
- <0> 10/16/94 SJF first written
-
- To Do:
- */
-
- #ifndef _CASESSN_
- #include "CASessn.h"
- #endif
-
- #ifndef _CAERROR_
- #include "CAError.h"
- #endif
-
- #ifndef SOM_ODWindowState_xh
- #include "WinStat.xh"
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- #ifndef SOM_ODMenuBar_xh
- #include <MenuBar.xh>
- #endif
-
- #ifndef SOM_ODDispatcher_xh
- #include <Disptch.xh>
- #endif
-
- #ifndef SOM_ODFoci_xh
- #include <Foci.xh>
- #endif
- #ifndef _ODUTILS_
- #include <ODUtils.h>
- #endif
-
- #ifndef _CADISPTCH_
- #include "CADisptch.h"
- #endif
-
- #pragma segment CALib
-
-
- //-------------------------------------------------------------------------
- // Menu ***
- //-------------------------------------------------------------------------
-
- //-------------------------------------------------------------------------
- // CASetBaseMenuBar - The CA calls CASetBaseMenuBar with the complete
- // application menubar. We strip this of non-system menus before
- // setting the base menu bar of the window state.
- pascal void CASetBaseMenuBar( Handle hMenuBar )
- {
- CA_TRY
-
- gCASession->InstallMenuBar( (ODPlatformMenuBar) hMenuBar );
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- }
-
-
- //-------------------------------------------------------------------------
-
- pascal void CAAdjustMenus()
- {
- CA_TRY
-
- gCASession->UpdateMenus ();
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- }
-
-
- //-------------------------------------------------------------------------
-
- pascal void CARegisterCommand( CACommandID command, CAMenuID menu,
- CAMenuItemID menuItem )
- {
-
- CA_TRY
-
- gCASession->RegisterCommand( (ODCommandID)command, (ODMenuID)menu,
- (ODMenuItemID)menuItem );
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- }
-
-
- //-------------------------------------------------------------------------
-
- pascal Boolean CADispatchMenuEvent( EventRecord* event, long menuSelection )
- {
- Environment* ev = gCASession->GetEV();
- EventRecord newEventRecord;
- Boolean result = false;
-
- if (event)
- newEventRecord = *event;
-
- // Store the menuSelection in event->message for the OD dispatcher
- newEventRecord.what = kODEvtMenu;
- newEventRecord.message = menuSelection;
-
- CA_TRY
-
- result = gCASession->GetCADispatcher()->DispatchMenuEvent((ODEventData*) &newEventRecord);
-
- CA_CATCH_ALL
- CA_ENDTRY
-
- return result;
- }
-
-
-