home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
ibmodf.zip
/
CNTNRPRT.ZIP
/
CNNOTEBK.CPP
next >
Wrap
Text File
|
1995-04-13
|
8KB
|
230 lines
/*
* This file was generated by the SOM Compiler and Emitter Framework.
* Generated using:
* SOM Emitter emitxtm: 2.41
*/
#ifndef SOM_Module_cnnotebk_Source
#define SOM_Module_cnnotebk_Source
#endif
#define CNNotebook_Class_Source
#define VARIABLE_MACROS
#ifndef _CNNOTEBKH_
#include "cnnotebk.h"
#endif
#ifndef _ORDCOLL_
#include "OrdColl.h"
#endif
#include "cnnotebk.xih"
extern "C" {
MPARAM EXPENTRY ColorPageDlgProc(
HWND hwnd,
USHORT msg,
MPARAM mp1,
MPARAM mp2);
}
/**********************************************************************\
* FUNCTION: ColorPageDlgProc
*
* DESCRIPTION: Dialog procedure for the Color Page
*
*
\**********************************************************************/
MPARAM EXPENTRY ColorPageDlgProc(
HWND hwnd,
USHORT msg,
MPARAM mp1,
MPARAM mp2)
{
MRESULT mresReply;
PBOOKINFO pbookinfo;
static ContainerPart * myPart;
static ODNotebook * myNotebook;
Environment* fSOMEnvironment;
fSOMEnvironment = somGetGlobalEnvironment();
ODFrame* displayFrame;
ODUShort whichColor;
/* Get the data for this notebook
*/
switch(msg)
{
case WM_INITDLG:
// deselect radio button selected
WinCheckButton( hwnd, IDMA_COLOR_GRAY, FALSE) ;
if ( !(pbookinfo = (PBOOKINFO)WinQueryWindowULong(WinQueryWindow(
hwnd, QW_PARENT), QWL_USER)) )
return (MRESULT)FALSE;
// a pointer to the part is set inside the bookinfo structure which is stored
// in the window words. Get is in order to access part methods.
myPart = (ContainerPart *)pbookinfo->thisPart;
myNotebook = (ODNotebook *)pbookinfo->thisNotebook;
return (MPARAM)0;
case WM_COMMAND:
switch (SHORT1FROMMP(mp1))
{
case DID_OK:
// Query the state of all buttons to find out which was pressed
ContainerPartData *somThis =
ContainerPartGetData(myNotebook->GetBase(fSOMEnvironment));
displayFrame = (ODFrame *)(somThis->fDisplayFrames->First());
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_GRAY),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_GRAY;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_RED),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_RED;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_GREEN),
BM_QUERYCHECK, 0, 0 );
if(mresReply )
whichColor = IDMA_COLOR_GREEN;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_YELLOW),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_YELLOW;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_BLUE),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_BLUE;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_MAGENTA),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_MAGENTA;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_CYAN),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_CYAN;
mresReply = WinSendMsg(WinWindowFromID(hwnd, IDMA_COLOR_WHITE),
BM_QUERYCHECK, 0, 0 );
if(mresReply)
whichColor = IDMA_COLOR_WHITE;
myPart->SetBGColor1(fSOMEnvironment, displayFrame, whichColor);
displayFrame->Invalidate(fSOMEnvironment, kODNULL);
return (MPARAM)0;
}
case WM_CONTROL:
switch (SHORT1FROMMP(mp1))
{
return (MPARAM)0;
}
case WM_FOCUSCHANGE:
/* On a focus change, we will post a message to process all of the
* changes to stuff. We don't want to do it here, because if a
* method displays an error message, we can't switch focus to the
* message and will hang.
*/
WinPostMsg(hwnd, WM_FOCUS_PROCESSING, mp1, mp2);
return WinDefDlgProc( hwnd, msg, mp1, mp2);
case WM_FOCUS_PROCESSING:
return (MPARAM)0;
case WM_DESTROY:
/* save everything, as the post by the WM_FOCUSCHANGE message
* will not get processed before this message kills the dialog.
*/
WinSendMsg(hwnd, WM_FOCUS_PROCESSING, mp1, mp2);
return WinDefDlgProc(hwnd, msg, mp1, mp2);
default:
/* Pass all unprocessed messages to the default dialog proc.
*/
return WinDefDlgProc( hwnd, msg, mp1, mp2);
}
}
SOM_Scope ODULong SOMLINK ODNotebookInsertBackgroundPage(CNNotebook *somSelf,
Environment *ev,
HWND hwndNotebook)
{
CNNotebookData *somThis = CNNotebookGetData(somSelf);
CNNotebookMethodDebug("CNNotebook","ODNotebookInsertBackgroundPage");
/*
* Called by AddNotebookPages to insert the Part-Properties General
* page. User can view and edit the part title andd icon.
* It in turn calls InsertNotebookPage. DlgProc calls GeneralPageTitleChanged
* and GeneralPageIconChanged when the notebook is destroyed.
* Returns: The pageid for the inserted page.
*/
PAGEINFO pageinfo;
/* Insert the icon settings page - it is applicable to
* almost all classes of object
*/
memset( (PCH)&pageinfo, 0, sizeof( PAGEINFO ) );
pageinfo.cb = sizeof(PAGEINFO);
pageinfo.usPageStyleFlags = BKA_MAJOR;
pageinfo.usPageInsertFlags = BKA_FIRST;
pageinfo.pfnwp = (PFNWP)ColorPageDlgProc;
pageinfo.resid = _hmodHandle;
pageinfo.dlgid = DL_COLORS;
pageinfo.pszName = "Background";
pageinfo.usSettingsFlags = SETTINGS_PAGE_NUMBERS;
pageinfo.pCreateParams = (PVOID)somSelf; /* Let dialog know what object */
/* Objects that are never templateable will not have a template
* checkbox and therefore need a different help panel res id
*/
return somSelf->InsertNotebookPage(ev, hwndNotebook, &pageinfo );
}
SOM_Scope void SOMLINK ODNotebookAddNotebookPages(CNNotebook *somSelf,
Environment *ev,
HWND hwndNotebook)
{
CNNotebookData *somThis = CNNotebookGetData(somSelf);
CNNotebookMethodDebug("CNNotebook","ODNotebookAddNotebookPages");
CHAR LoadError[100];
APIRET rc = DosLoadModule(LoadError, sizeof(LoadError),
"cntnrprt", &_hmodHandle);
somSelf->InsertBackgroundPage(ev, hwndNotebook);
CNNotebook_parent_ODNotebook_AddNotebookPages(somSelf, ev,
hwndNotebook);
}
SOM_Scope void SOMLINK ODNotebooksomInit(CNNotebook *somSelf)
{
CNNotebookData *somThis = CNNotebookGetData(somSelf);
CNNotebookMethodDebug("CNNotebook","ODNotebooksomInit");
CNNotebook_parent_ODNotebook_somInit(somSelf);
_hmodHandle = 0;
}
SOM_Scope void SOMLINK ODNotebooksomUninit(CNNotebook *somSelf)
{
/* CNNotebookData *somThis = CNNotebookGetData(somSelf); */
CNNotebookMethodDebug("CNNotebook","ODNotebooksomUninit");
CNNotebook_parent_ODNotebook_somUninit(somSelf);
}