home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ibmodf.zip
/
CNTNRPRT.ZIP
/
CNTNRRMB.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-12-09
|
4KB
|
123 lines
/*
* This file was generated by the SOM Compiler.
* Generated using:
* SOM incremental update: 2.38
*/
/*
* This file was generated by the SOM Compiler and Emitter Framework.
* Generated using:
* SOM Emitter emitxtm: 2.38
*/
#ifndef SOM_Module_cntnrrmb_Source
#define SOM_Module_cntnrrmb_Source
#endif
#define ODContainerRootFrameMenuBar_Class_Source
#define VARIABLE_MACROS
#define INCL_DOSMODULEMGR
#define INCL_DOSRESOURCES
#define INCL_ODFRAME
#include "CntnrRMB.xih"
#ifndef SOM_ContainerPart_xh
#include <CntnrPrt.xh>
#endif
#include <os2.h>
#include <stdio.h>
#ifndef _CNTNRRES_
#include "cntnrres.h"
#endif
#include "debug.hpp"
#define THISDLL "cntnrprt"
SOM_Scope void SOMLINK ODContainerRootFrameMenuBarsomInit(ODContainerRootFrameMenuBar *somSelf)
{
ODContainerRootFrameMenuBarData *somThis = ODContainerRootFrameMenuBarGetData(somSelf);
ODContainerRootFrameMenuBarMethodDebug("ODContainerRootFrameMenuBar","ODContainerRootFrameMenuBarsomInit");
ODContainerRootFrameMenuBar_parent_ODRootFrameMenuBar_somInit(somSelf);
_DemoOpenCount = 0;
}
SOM_Scope void SOMLINK ODContainerRootFrameMenuBarAdjustRootMenus(ODContainerRootFrameMenuBar *somSelf,
Environment *ev,
ODMenuID menuID,
ODFrame* frame)
{
ODContainerRootFrameMenuBarData *somThis = ODContainerRootFrameMenuBarGetData(somSelf);
ODContainerRootFrameMenuBarMethodDebug("ODContainerRootFrameMenuBar","ODContainerRootFrameMenuBarAdjustRootMenus");
ODMenuBar *dmb = somSelf->GetDependeeMenuBar(ev );
//somSelf->ClearMenuBarTree( ev);
somSelf->RemoveMenu( ev, ODMENUID_ROOT);
somSelf->AddMenuBLast( ev, dmb, ODMENUID_ROOT );
#ifdef REMAPPING
// if we do remapping, this is the place to do it against somSelf.
#endif
HMODULE hmodDLL;
if (DosQueryModuleHandle( THISDLL, &hmodDLL)) {
beepprintf( "Isn't my DLL (%s) loaded?", THISDLL );
} /* endif */
ODPlatformMenuBar menuBar;
DosGetResource2( hmodDLL
, RT_MENU
, RESID_ROOTMENU
, (PPVOID)&menuBar
);
int id = somSelf->GetFirstMenuID( ev, ODMENUID_ROOT );
if (id) {
id = somSelf->GetLastMenuID( ev, id );
if (id) somSelf->AddMenuAfter( ev, kODNULL, menuBar, frame->GetPart( ev), id );
} /* endif */
DosFreeResource( (PVOID)menuBar );
#if 1
// for demo purposes, we'll do some wacky things here with
// menu item text, check state, and enablement.
if ((menuID==ODMENUID_ALL) || (menuID==IDMS_DOCUMENT)) {
// I've chosen only to update these menu items if
// I their menu is opened or we're requested to
// update the whole tree. The intent of this
// check is to improve efficiency.
// This type of check isn't possible in part::AdjustMenus
// because that reference method does not have a way
// to know which menu is opening. As a result, it must
// update all menus. If one wants to be selective
// in updating active part menu items, one will need
// to create their own menu bar class, or subclass the
// ODActiveFrameMenuBar class and particularly the
// AdjustMenus method.
//
_DemoOpenCount++;
{
char stagestring[40];
sprintf( stagestring, "Menu open count: %d", _DemoOpenCount);
somSelf->SetItemString( ev, IDMR_ROOTITEM2, stagestring);
}
// please forgive the downcast. It is expedient and can be
// avoided if deemed necessary.
ContainerPart * cpart = (ContainerPart*)frame->GetPart( ev);
long DemoState = cpart->GetDemoState( ev);
somSelf->CheckItem( ev, IDMR_ROOTITEM2, (DemoState & 1) );
somSelf->EnableItem( ev, IDMR_ROOTITEM2, (DemoState & 2) );
} /* endif */
#endif
}