home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
wpobj.zip
/
CLRPALET.IH
< prev
next >
Wrap
Text File
|
1993-11-10
|
20KB
|
671 lines
/*
* This file was generated by the SOM Compiler.
* FileName: clrpalet.ih.
* Generated using:
* SOM Precompiler spc: 1.22
* SOM Emitter emitih: 1.59
*/
/*
*
*
* MODULE NAME: ClrPalet.CSC
*
* DESCRIPTION:
* Object class definition file for ColorPalette object class.
*/
#ifndef clrpalet_ih
#define clrpalet_ih
/*
* Passthru lines: File: "C.ih", "before"
*/
/* These two definitions make our compiled size smaller: otherwise SOM will
* add a lot of debug code in on our behalf whenever we call a method
* and around each method call itself.
*/
#define SOM_NoTest 1 /* Disables somTestCls on method resolution */
#define _RETAIL /* Disables xxxMethodDebug() functions */
/* Include standard PM header files
*/
#define INCL_WIN
#define INCL_GPI
#define INCL_DOS
#define INCL_WINWORKPLACE
#define INCL_WPCLASS
#define INCL_WPFOLDER
#include <os2.h>
#include "clrpalet.ph"
/* Include C runtime library functions that we might need
*/
#include <string.h>
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
/* Include the colour wheel control header file and define its window
* procedure and class name
*/
#include "pdsctls.h"
MRESULT EXPENTRY ClrWheelWndProc(
HWND hWnd,
ULONG msg,
MPARAM mp1,
MPARAM mp2);
/* Dialog procedure that allows the user to change the color of an
* element within the palette
*/
MRESULT EXPENTRY ColorPickingDialog(
HWND hwnd,
ULONG msg,
MPARAM mp1,
MPARAM mp2);
/* Data structure used by ColorPickingDialog
*/
typedef struct _COLORPICKDATA
{
ColorPalette *Palette; /* Palette object */
PCELL pCell; /* Cell being edited */
ULONG ulRGBOriginal; /* Original color of the cell */
BOOL fSpinSet; /* Spinbutton is setting the color */
} COLORPICKDATA;
/* Global variables
*/
HMODULE vhmodClrPalet = NULLHANDLE;
#include "clrpalet.h"
/*
* Set the scope of methods functions
*/
#ifndef SOM_Scope
#ifdef __cplusplus
#define SOM_Scope extern "C"
#else
#define SOM_Scope extern
#endif
#endif
#ifndef SOM_CurrentClass
#define SOM_CurrentClass ColorPaletteCClassData.parentMtab
#endif
#define ColorPalette_MaxNoMethods 3
/*
* Instance data
*/
typedef struct {
HWND hwndEditDlg;
HWND hwndColorSample;
PCELL pSelectedCell;
} ColorPaletteData;
/*
* Instance variable access macros
*/
#define _hwndEditDlg (somThis->hwndEditDlg)
#define _hwndColorSample (somThis->hwndColorSample)
#define _pSelectedCell (somThis->pSelectedCell)
/*
* Getdata macro
*/
#define ColorPaletteGetData(somSelf) \
((ColorPaletteData *) \
SOM_DataResolve(somSelf, ColorPaletteCClassData.instanceDataToken))
/*
* Trace/Debug macro
*/
#ifndef ColorPaletteMethodDebug
#define ColorPaletteMethodDebug(c,m) SOMMethodDebug(c,m)
#endif
/*
* Begin stuff that only goes in the primary file
*/
#ifdef ColorPalette_Class_Source
/*
* Current class macros for Instance and Meta classes.
*/
#undef SOMMeta
#define SOMMeta M_ColorPaletteCClassData.parentMtab
#undef SOMInstance
#define SOMInstance ColorPaletteCClassData.parentMtab
#ifndef M_ColorPalette_Class_Source
#define M_ColorPalette_Class_Source
#endif /* M_ColorPalette_Class_Source */
/*
* Generate the Apply Stubs.
*/
#pragma linkage(somAP_SetEditDlgHandle, system)
static BOOL SOMLINK somAP_SetEditDlgHandle(ColorPalette *somSelf,
somId __id,
somId __desc,
va_list __ap)
{
HWND hwndEditDlg = va_arg(__ap, HWND);
__ap; __id; __desc; /* Referenced to prevent warning msg */
return (ColorPalette_SetEditDlgHandle(somSelf,hwndEditDlg));
}
#pragma linkage(somAP_QueryEditDlgHandle, system)
static HWND SOMLINK somAP_QueryEditDlgHandle(ColorPalette *somSelf,
somId __id,
somId __desc,
va_list __ap)
{
__ap; __id; __desc; /* Referenced to prevent warning msg */
return (ColorPalette_QueryEditDlgHandle(somSelf));
}
#pragma linkage(somAP_QuerySampleShape, system)
static BOOL SOMLINK somAP_QuerySampleShape(ColorPalette *somSelf,
somId __id,
somId __desc,
va_list __ap)
{
PPOINTL pPoints = va_arg(__ap, PPOINTL);
PULONG pcPoints = va_arg(__ap, PULONG);
__ap; __id; __desc; /* Referenced to prevent warning msg */
return (ColorPalette_QuerySampleShape(somSelf,pPoints,pcPoints));
}
/*
* Overridden method: wpPaintCell
*/
#pragma linkage(clrp_wpPaintCell, system)
SOM_Scope VOID SOMLINK clrp_wpPaintCell(ColorPalette *somSelf,
PCELL pCell,
HPS hps,
PRECTL prcl,
BOOL fHilite);
#ifndef parent_wpPaintCell
static char *somMN_wpPaintCell = "wpPaintCell";
static somId somId_wpPaintCell = &somMN_wpPaintCell;
#define parent_wpPaintCell(somSelf,pCell,hps,prcl,fHilite) \
((SOM_ParentResolveE(WPPalette, SOM_CurrentClass, wpPaintCell)) \
(somSelf,pCell,hps,prcl,fHilite))
#endif
#define ColorPaletteParent_wpPaintCell parent_wpPaintCell
/*
* Overridden method: wpEditCell
*/
#pragma linkage(clrp_wpEditCell, system)
SOM_Scope BOOL SOMLINK clrp_wpEditCell(ColorPalette *somSelf,
PCELL pCell,
HWND hwndPal);
#ifndef parent_wpEditCell
static char *somMN_wpEditCell = "wpEditCell";
static somId somId_wpEditCell = &somMN_wpEditCell;
#define parent_wpEditCell(somSelf,pCell,hwndPal) \
((SOM_ParentResolveE(WPPalette, SOM_CurrentClass, wpEditCell)) \
(somSelf,pCell,hwndPal))
#endif
#define ColorPaletteParent_wpEditCell parent_wpEditCell
/*
* Overridden method: wpRedrawCell
*/
#pragma linkage(clrp_wpRedrawCell, system)
SOM_Scope BOOL SOMLINK clrp_wpRedrawCell(ColorPalette *somSelf,
PCELL pCell);
#ifndef parent_wpRedrawCell
static char *somMN_wpRedrawCell = "wpRedrawCell";
static somId somId_wpRedrawCell = &somMN_wpRedrawCell;
#define parent_wpRedrawCell(somSelf,pCell) \
((SOM_ParentResolveE(WPPalette, SOM_CurrentClass, wpRedrawCell)) \
(somSelf,pCell))
#endif
#define ColorPaletteParent_wpRedrawCell parent_wpRedrawCell
/*
* Overridden method: wpSetup
*/
#pragma linkage(clrp_wpSetup, system)
SOM_Scope BOOL SOMLINK clrp_wpSetup(ColorPalette *somSelf,
PSZ pszSetupString);
#ifndef parent_wpSetup
static char *somMN_wpSetup = "wpSetup";
static somId somId_wpSetup = &somMN_wpSetup;
#define parent_wpSetup(somSelf,pszSetupString) \
((SOM_ParentResolveE(WPObject, SOM_CurrentClass, wpSetup)) \
(somSelf,pszSetupString))
#endif
#define ColorPaletteParent_wpSetup parent_wpSetup
/*
* Temporary class data structure used only in class creation
*/
static somClassDataStructure ColorPalettetempClassData;
/*
* Initialize the class data structure
*/
struct ColorPaletteClassDataStructure ColorPaletteClassData = {(SOMAny *) NULL};
/*
* Define the C class data structure
*/
struct ColorPaletteCClassDataStructure ColorPaletteCClassData = {(somMethodTab *) NULL};
/*
* New Method: SetEditDlgHandle
*/
#pragma linkage(clrp_SetEditDlgHandle, system)
SOM_Scope BOOL SOMLINK clrp_SetEditDlgHandle(ColorPalette *somSelf,
HWND hwndEditDlg);
static char *somMN_SetEditDlgHandle = "SetEditDlgHandle";
static somId somId_SetEditDlgHandle = &somMN_SetEditDlgHandle;
static char *somDS_SetEditDlgHandle = somMD_ColorPalette_SetEditDlgHandle;
static somId somDI_SetEditDlgHandle = &somDS_SetEditDlgHandle;
#pragma linkage(somRD_SetEditDlgHandle, system)
static BOOL SOMLINK somRD_SetEditDlgHandle(ColorPalette *somSelf,
HWND hwndEditDlg)
{
return ((BOOL) va_somDispatchL(somSelf, somId_SetEditDlgHandle,
_somGetMethodDescriptor(SOM_GetClass(somSelf),somId_SetEditDlgHandle),hwndEditDlg));
}
/*
* New Method: QueryEditDlgHandle
*/
#pragma linkage(clrp_QueryEditDlgHandle, system)
SOM_Scope HWND SOMLINK clrp_QueryEditDlgHandle(ColorPalette *somSelf);
static char *somMN_QueryEditDlgHandle = "QueryEditDlgHandle";
static somId somId_QueryEditDlgHandle = &somMN_QueryEditDlgHandle;
static char *somDS_QueryEditDlgHandle = somMD_ColorPalette_QueryEditDlgHandle;
static somId somDI_QueryEditDlgHandle = &somDS_QueryEditDlgHandle;
#pragma linkage(somRD_QueryEditDlgHandle, system)
static HWND SOMLINK somRD_QueryEditDlgHandle(ColorPalette *somSelf)
{
return ((HWND) va_somDispatchL(somSelf, somId_QueryEditDlgHandle,
_somGetMethodDescriptor(SOM_GetClass(somSelf),somId_QueryEditDlgHandle)));
}
/*
* New Method: QuerySampleShape
*/
#pragma linkage(clrp_QuerySampleShape, system)
SOM_Scope BOOL SOMLINK clrp_QuerySampleShape(ColorPalette *somSelf,
PPOINTL pPoints,
PULONG pcPoints);
static char *somMN_QuerySampleShape = "QuerySampleShape";
static somId somId_QuerySampleShape = &somMN_QuerySampleShape;
static char *somDS_QuerySampleShape = somMD_ColorPalette_QuerySampleShape;
static somId somDI_QuerySampleShape = &somDS_QuerySampleShape;
#pragma linkage(somRD_QuerySampleShape, system)
static BOOL SOMLINK somRD_QuerySampleShape(ColorPalette *somSelf,
PPOINTL pPoints,
PULONG pcPoints)
{
return ((BOOL) va_somDispatchL(somSelf, somId_QuerySampleShape,
_somGetMethodDescriptor(SOM_GetClass(somSelf),somId_QuerySampleShape),pPoints,pcPoints));
}
/*
* Routines to create the class object
*/
/*
* Declare the Static Methods table.
*/
static somStaticMethod_t ColorPaletteSM[] = {
{ &ColorPaletteClassData.SetEditDlgHandle,
&somId_SetEditDlgHandle,
&somDI_SetEditDlgHandle,
(somMethodProc *) clrp_SetEditDlgHandle,
(somMethodProc *) somRD_SetEditDlgHandle,
(somMethodProc *) somAP_SetEditDlgHandle },
{ &ColorPaletteClassData.QueryEditDlgHandle,
&somId_QueryEditDlgHandle,
&somDI_QueryEditDlgHandle,
(somMethodProc *) clrp_QueryEditDlgHandle,
(somMethodProc *) somRD_QueryEditDlgHandle,
(somMethodProc *) somAP_QueryEditDlgHandle },
{ &ColorPaletteClassData.QuerySampleShape,
&somId_QuerySampleShape,
&somDI_QuerySampleShape,
(somMethodProc *) clrp_QuerySampleShape,
(somMethodProc *) somRD_QuerySampleShape,
(somMethodProc *) somAP_QuerySampleShape },
};
/*
* Declare the Override Methods table.
*/
static somOverrideMethod_t ColorPaletteOM[] = {
{ &somId_wpPaintCell,
(somMethodProc *) clrp_wpPaintCell },
{ &somId_wpEditCell,
(somMethodProc *) clrp_wpEditCell },
{ &somId_wpRedrawCell,
(somMethodProc *) clrp_wpRedrawCell },
{ &somId_wpSetup,
(somMethodProc *) clrp_wpSetup },
};
static void ColorPalettesomInitializeClass ()
{
int i;
somStaticMethod_t *smp;
somOverrideMethod_t *omp;
/*
* Add the Static Methods.
*/
for (smp = ColorPaletteSM, i = 0; i < 3; smp++, i++)
*(smp->classData) =
_somAddStaticMethod (ColorPalettetempClassData.classObject,
*(smp->methodId), *(smp->methodDescriptor),
smp->method, smp->redispatchStub,
smp->applyStub);
/*
* Override methods.
*/
for (omp = ColorPaletteOM, i = 0; i < 4; omp++, i++)
_somOverrideSMethod (ColorPalettetempClassData.classObject,
*(omp->methodId), omp->method);
}
#pragma linkage(ColorPalettesomCreateClass, system)
static void SOMLINK ColorPalettesomCreateClass(SOMClass *pClsObj,
SOMClass *mClsObj)
{
ColorPalettetempClassData.classObject = _somNew (mClsObj);
_somInitClass (ColorPalettetempClassData.classObject,
"ColorPalette",
pClsObj,
sizeof(ColorPaletteData),
ColorPalette_MaxNoMethods,
ColorPalette_MajorVersion,
ColorPalette_MinorVersion);
ColorPaletteCClassData.instanceDataToken =
_somGetInstanceToken(ColorPalettetempClassData.classObject);
ColorPalettesomInitializeClass();
ColorPaletteCClassData.parentMtab =
_somGetPClsMtab(ColorPalettetempClassData.classObject);
_somSetClassData(ColorPalettetempClassData.classObject, (somClassDataStructure *)&ColorPaletteClassData);
_somClassReady(ColorPalettetempClassData.classObject);
/* make newly created class object visible */
ColorPaletteClassData.classObject = ColorPalettetempClassData.classObject;
}
ColorPalette * SOMLINK ColorPaletteNewClass (integer4 scemajorVersion,
integer4 sceminorVersion)
{
SOMClass *pClsObj;
SOMClass *mClsObj;
/* Check the version numbers */
if (((scemajorVersion != 0) &&
(scemajorVersion != ColorPalette_MajorVersion)) ||
((sceminorVersion != 0) &&
(sceminorVersion > ColorPalette_MinorVersion))) {
somPrintf("ColorPaletteNewClass: Error, bad version numbers.\n");
SOM_Error(SOMERROR_BadVersion);
}
/* Don't do anything if class object is already created. */
if (ColorPaletteClassData.classObject != (SOMAny *) NULL)
return(ColorPaletteClassData.classObject);
/* Make sure the environment is initialized. */
if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
if (SOMClassMgrObject == (SOMAny *) NULL)
SOM_Error(SOMERROR_CouldNotStartup);
/* Get the parent class object. */
WPColorPaletteNewClass(1,2); /* static reference */
pClsObj = _somFindClass(SOMClassMgrObject,
SOM_IdFromString("WPColorPalette"), 1, 2);
if (pClsObj == (SOMClass *) NULL)
SOM_Error(SOMERROR_NoParentClass);
/* Explicit metaclass, so get it */
M_ColorPaletteNewClass(0,0); /* static reference */
mClsObj = _somFindClass(SOMClassMgrObject,
SOM_IdFromString("M_ColorPalette"), 0, 0);
if (mClsObj == (SOMClass *) NULL)
SOM_Error(SOMERROR_NoMetaClass);
somConstructClass(ColorPalettesomCreateClass, pClsObj, mClsObj,
&ColorPalettetempClassData);
return (ColorPaletteClassData.classObject);
}
#endif /* ColorPalette_Class_Source */
#endif /* clrpalet_ih */
/*
* This file was generated by the SOM Compiler.
* FileName: clrpalet.ih.
* Generated using:
* SOM Precompiler spc: 1.22
* SOM Emitter emitih: 1.59
*/
#ifndef clrpalet_mih
#define clrpalet_mih
/*
* Set the scope of methods functions
*/
#ifndef SOM_Scope
#ifdef __cplusplus
#define SOM_Scope extern "C"
#else
#define SOM_Scope extern
#endif
#endif
#ifndef SOM_CurrentClass
#define SOM_CurrentClass M_ColorPaletteCClassData.parentMtab
#endif
#define M_ColorPalette_MaxNoMethods 0
/*
* Instance data
*/
typedef void M_ColorPaletteData;
/*
* Trace/Debug macro
*/
#ifndef M_ColorPaletteMethodDebug
#define M_ColorPaletteMethodDebug(c,m) SOMMethodDebug(c,m)
#endif
/*
* Begin stuff that only goes in the primary file
*/
#ifdef M_ColorPalette_Class_Source
/*
* Current class macros for Instance and Meta classes.
*/
/*
* Generate the Apply Stubs.
*/
/*
* Overridden method: wpclsInitData
*/
#pragma linkage(clrpM_wpclsInitData, system)
SOM_Scope void SOMLINK clrpM_wpclsInitData(M_ColorPalette *somSelf);
#ifndef parent_wpclsInitData
static char *somMN_wpclsInitData = "wpclsInitData";
static somId somId_wpclsInitData = &somMN_wpclsInitData;
#define parent_wpclsInitData(somSelf) \
((SOM_ParentResolveE(M_WPObject, SOM_CurrentClass, wpclsInitData)) \
(somSelf))
#endif
#define M_ColorPaletteParent_wpclsInitData parent_wpclsInitData
/*
* Overridden method: wpclsQueryIconData
*/
#pragma linkage(clrpM_wpclsQueryIconData, system)
SOM_Scope ULONG SOMLINK clrpM_wpclsQueryIconData(M_ColorPalette *somSelf,
PICONINFO pIconInfo);
#ifndef parent_wpclsQueryIconData
static char *somMN_wpclsQueryIconData = "wpclsQueryIconData";
static somId somId_wpclsQueryIconData = &somMN_wpclsQueryIconData;
#define parent_wpclsQueryIconData(somSelf,pIconInfo) \
((SOM_ParentResolveE(M_WPObject, SOM_CurrentClass, wpclsQueryIconData)) \
(somSelf,pIconInfo))
#endif
#define M_ColorPaletteParent_wpclsQueryIconData parent_wpclsQueryIconData
/*
* Overridden method: wpclsQueryStyle
*/
#pragma linkage(clrpM_wpclsQueryStyle, system)
SOM_Scope ULONG SOMLINK clrpM_wpclsQueryStyle(M_ColorPalette *somSelf);
#ifndef parent_wpclsQueryStyle
static char *somMN_wpclsQueryStyle = "wpclsQueryStyle";
static somId somId_wpclsQueryStyle = &somMN_wpclsQueryStyle;
#define parent_wpclsQueryStyle(somSelf) \
((SOM_ParentResolveE(M_WPObject, SOM_CurrentClass, wpclsQueryStyle)) \
(somSelf))
#endif
#define M_ColorPaletteParent_wpclsQueryStyle parent_wpclsQueryStyle
/*
* Temporary class data structure used only in class creation
*/
static somClassDataStructure M_ColorPalettetempClassData;
/*
* Initialize the class data structure
*/
struct M_ColorPaletteClassDataStructure M_ColorPaletteClassData = {(SOMAny *) NULL};
/*
* Define the C class data structure
*/
struct M_ColorPaletteCClassDataStructure M_ColorPaletteCClassData = {(somMethodTab *) NULL};
/*
* Routines to create the class object
*/
/*
* Declare the Override Methods table.
*/
static somOverrideMethod_t M_ColorPaletteOM[] = {
{ &somId_wpclsInitData,
(somMethodProc *) clrpM_wpclsInitData },
{ &somId_wpclsQueryIconData,
(somMethodProc *) clrpM_wpclsQueryIconData },
{ &somId_wpclsQueryStyle,
(somMethodProc *) clrpM_wpclsQueryStyle },
};
static void M_ColorPalettesomInitializeClass ()
{
int i;
somOverrideMethod_t *omp;
/*
* Override methods.
*/
for (omp = M_ColorPaletteOM, i = 0; i < 3; omp++, i++)
_somOverrideSMethod (M_ColorPalettetempClassData.classObject,
*(omp->methodId), omp->method);
}
#pragma linkage(M_ColorPalettesomCreateClass, system)
static void SOMLINK M_ColorPalettesomCreateClass(SOMClass *pClsObj,
SOMClass *mClsObj)
{
M_ColorPalettetempClassData.classObject = _somNew (mClsObj);
_somInitClass (M_ColorPalettetempClassData.classObject,
"M_ColorPalette",
pClsObj,
0,
M_ColorPalette_MaxNoMethods,
M_ColorPalette_MajorVersion,
M_ColorPalette_MinorVersion);
M_ColorPaletteCClassData.instanceDataToken =
_somGetInstanceToken(M_ColorPalettetempClassData.classObject);
M_ColorPalettesomInitializeClass();
M_ColorPaletteCClassData.parentMtab =
_somGetPClsMtab(M_ColorPalettetempClassData.classObject);
_somSetClassData(M_ColorPalettetempClassData.classObject, (somClassDataStructure *)&M_ColorPaletteClassData);
_somClassReady(M_ColorPalettetempClassData.classObject);
/* make newly created class object visible */
M_ColorPaletteClassData.classObject = M_ColorPalettetempClassData.classObject;
}
M_ColorPalette * SOMLINK M_ColorPaletteNewClass (integer4 scemajorVersion,
integer4 sceminorVersion)
{
SOMClass *pClsObj;
SOMClass *mClsObj;
/* Check the version numbers */
if (((scemajorVersion != 0) &&
(scemajorVersion != M_ColorPalette_MajorVersion)) ||
((sceminorVersion != 0) &&
(sceminorVersion > M_ColorPalette_MinorVersion))) {
somPrintf("M_ColorPaletteNewClass: Error, bad version numbers.\n");
SOM_Error(SOMERROR_BadVersion);
}
/* Don't do anything if class object is already created. */
if (M_ColorPaletteClassData.classObject != (SOMAny *) NULL)
return(M_ColorPaletteClassData.classObject);
/* Make sure the environment is initialized. */
if (SOMClassMgrObject == (SOMAny *) NULL) somEnvironmentNew();
if (SOMClassMgrObject == (SOMAny *) NULL)
SOM_Error(SOMERROR_CouldNotStartup);
/* Get the parent class object. */
M_WPColorPaletteNewClass(1,2); /* static reference */
pClsObj = _somFindClass(SOMClassMgrObject,
SOM_IdFromString("M_WPColorPalette"), 1, 2);
if (pClsObj == (SOMClass *) NULL)
SOM_Error(SOMERROR_NoParentClass);
/* Use parent's metaclass */
mClsObj = SOM_GetClass(pClsObj);
somConstructClass(M_ColorPalettesomCreateClass, pClsObj, mClsObj,
&M_ColorPalettetempClassData);
return (M_ColorPaletteClassData.classObject);
}
#endif /* M_ColorPalette_Class_Source */
#endif /* clrpalet_ih */