home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ibmodf.zip
/
CNTNRPRT.ZIP
/
CNTNRPUM.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-29
|
8KB
|
205 lines
/*
* This file was generated by the SOM Compiler and Emitter Framework.
* Generated using:
* SOM Emitter emitxtm: 2.41
*/
#ifndef SOM_Module_cntnrpum_Source
#define SOM_Module_cntnrpum_Source
#endif
#define ODPopupContainerMenu_Class_Source
#define VARIABLE_MACROS
#define INCL_WINWINDOWMGR
#define INCL_WINERRORS
#define INCL_WINMENUS
#define INCL_WINMESSAGEMGR
#define INCL_ODFRAME
#include <os2.h>
#include "CntnrPUM.xih"
#include "CntnrPrt.xh"
#include "debug.hpp"
SOM_Scope void SOMLINK ODPopupContainerMenuInitPopupContainerMenu(ODPopupContainerMenu *somSelf,
Environment *ev,
ODSession* session,
ODFrame* frame)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenuInitPopupContainerMenu");
somSelf->InitMenuBar( ev, session, (ODPlatformMenuBar*)0);
_fOwnerFrame = frame;
somSelf->SetOwner( ev, frame); // setting this will insure that AdjustMenu will actually
// dispatch WM_COMMAND messages to the appropriate part.
}
#if 0
SOM_Scope void SOMLINK ODPopupContainerMenuUnDisplay(ODPopupContainerMenu *somSelf,
Environment *ev)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenuUnDisplay");
+++++++++++++
}
#endif
SOM_Scope void SOMLINK ODPopupContainerMenusomInit(ODPopupContainerMenu *somSelf)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenusomInit");
ODPopupContainerMenu_parent_ODActiveFrameMenuBar_somInit(somSelf);
_fOwnerFrame = 0;
//_mbDependentUpon = 0;
_fMenuHwnd = 0;
_fObjectHwnd = 0;
}
SOM_Scope void SOMLINK ODPopupContainerMenuUpdateMenuDependencyChain(ODPopupContainerMenu *somSelf,
Environment *ev,
ODMenuID menuID)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenuUpdateMenuDependencyChain");
{
ContainerPart * cp = (ContainerPart*)_fOwnerFrame->GetPart( ev );
// gross! down casting! Oh well.
cp->AdjustPopupMenu( ev, _fOwnerFrame, somSelf, menuID );
}
}
MRESULT EXPENTRY PopUpObjectProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
MRESULT mr;
switch (msg) {
case WM_COMMAND:
case WM_HELP:
case WM_INITMENU:
case WM_CONTROL:
{
ODEventData event;
event.msg = msg;
event.hwnd = hwnd;
event.mp1 = mp1;
event.mp2 = mp2;
event.result = 0;
event.mpExtra = 0;
ODMenuBar *mb = (ODMenuBar *)WinQueryWindowPtr( hwnd, 0 );
if (mb) mb->HandleEvent( somGetGlobalEnvironment(), &event);
return event.result;
}
break;
default:
break;
} /* endswitch */
mr = WinDefWindowProc( hwnd, msg, mp1, mp2);
return mr;
}
SOM_Scope void SOMLINK ODPopupContainerMenuDisplay(ODPopupContainerMenu *somSelf,
Environment *ev)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenuDisplay");
ERRORID err;
if ( !_fObjectHwnd ) {
CLASSINFO ci;
#define OWNEROBJCLASSNAME "CntnrPUMObjectClass"
WinRegisterClass( (HAB)0
, OWNEROBJCLASSNAME
, PopUpObjectProc
, /*flStyle:*/0
, /*cbWindowData:*/4
);
err = WinGetLastError( (HAB)0);
_fObjectHwnd = WinCreateWindow( HWND_DESKTOP,
OWNEROBJCLASSNAME,
(PSZ)"OpenDocPopUpObject",
0 /*WS_VISIBLE*/,
0,0, 0, 0,
/*owner:*/NULL,
HWND_TOP,
/*id:*/1,
/*ctldata:*/NULL,
/*presparams:*/NULL);
err = WinGetLastError( (HAB)0);
if (!_fObjectHwnd) {
beepprintf( "Popup menu object window creation failed: errcode=0x%x", (ULONG)err);
} /* endif */
} /* endif */
if ( _fObjectHwnd && !_fMenuHwnd) {
err = WinGetLastError( (HAB)0);
_fMenuHwnd = WinCreateWindow( /*parent:*/HWND_OBJECT,
WC_MENU,
(PSZ)"OpenDocPopupMenu",
0 /*WS_VISIBLE*/,
0,0, 0, 0,
/*owner:*/NULL,
HWND_TOP,
/*id:*/1,
/*ctldata:*/NULL,
/*presparam:*/NULL );
err = WinGetLastError( (HAB)0);
if ( _fMenuHwnd ) {
WinSetWindowPtr( _fObjectHwnd, 0, somSelf );
} else {
beepprintf( "Popup menu window creation failed: errcode=0x%x", (ULONG)err);
} /* endif */
} /* endif */
if ( _fMenuHwnd ) {
somSelf->UpdateMenuDependencyChain( ev, ODMENUID_ALL);
somSelf->UpdateMenuWindowTree( ev, _fMenuHwnd, ODMENUID_ROOT);
ODMenuID firstid = somSelf->GetFirstMenuID( ev, ODMENUID_ROOT);
err = WinGetLastError( (HAB)0);
POINTL ptl;
if (!WinQueryMsgPos( (HAB)0, &ptl)) {
ptl.x = ptl.y = 0;
} /* endif */
err = WinGetLastError( (HAB)0);
// I have chosen not to use the PU_POSITIONITEM flag below because
// that also *selects* the item. In the case of a pull right
// menu item, that means the menu appears with the cascade
// menu open. I don't like that. Instead, I've adjusted
// the x,y values a bit so that the pointer will probably be at
// the bottom of the popup menu. (jlc 11/94)
if (!WinPopupMenu( /*parent:*/ HWND_DESKTOP,
/*owner:*/ _fObjectHwnd,
/*menu:*/ _fMenuHwnd,
/*x,y:*/ ptl.x-30, ptl.y-5,
/*itemid:*/ firstid,
/*options:*/ PU_HCONSTRAIN | PU_VCONSTRAIN | /* PU_POSITIONONITEM | */
PU_NONE |
PU_MOUSEBUTTON1 | PU_KEYBOARD
)) {
err = WinGetLastError( (HAB)0);
beepprintf( "WinPopupMenu failed: errcode=0x%x", (ULONG)err);
} /* endif */
} /* endif */
}
SOM_Scope void SOMLINK ODPopupContainerMenusomUninit(ODPopupContainerMenu *somSelf)
{
ODPopupContainerMenuData *somThis = ODPopupContainerMenuGetData(somSelf);
ODPopupContainerMenuMethodDebug("ODPopupContainerMenu","ODPopupContainerMenusomUninit");
if (_fMenuHwnd) WinDestroyWindow( _fMenuHwnd );
if (_fObjectHwnd) WinDestroyWindow( _fObjectHwnd );
// the super class also keeps a copy of _mbDependentUpon, so we
// don't have to worry about informing that menu of our disappearance.
ODPopupContainerMenu_parent_ODActiveFrameMenuBar_somUninit(somSelf);
}