
/*
 * This file was generated by the SOM Compiler.
 * FileName: G:\cwpsh\rel\os2c\include\base\os2\wppalet.xh.
 * Generated using:
 *     SOM Precompiler somipc: 2.29.1.14
 *     SOM Emitter emitxh: 2.43
 */

/*
 *   Module Header
 * 
 *   Module Name: WPPALET
 * 
 *   OS/2 Presentation Manager Workplace class definitions
 * 
 *   Copyright (c) International Business Machines Corporation 1991, 1992
 * 
 */


#ifndef SOM_WPPalette_xh
#define SOM_WPPalette_xh

class WPPalette;

#define WPPalette_MajorVersion 1
#define WPPalette_MinorVersion 2

/* C++ SOM defs */
#include <somcls.xh>
#include <somcm.xh>

/* C++ parent defs */
#ifndef SOM_WPAbstract_xh
#include <wpabs.xh>
#endif

#ifndef WPPalette_API
#define WPPalette_API
/*
 * -- The Class API
 */

/*
 * Start of bindings for IDL types
 */

class SOMClass;
class SOMObject;
class WPFolder;
class M_WPObject;
class WPObject;
class WPImageFile;
class M_WPAbstract;
class M_WPPalette;

/*
 * End of bindings for IDL types.
 */

/*
 * Passthru lines: File: "C.h", "after"
 */

      /*
       *  Open view for the wpOpen() method
       */

      #define OPEN_PALETTE       121

      /*
       *  Palette save-restore keys
       */

      #define IDKEY_PALXCELLCOUNT      1000
      #define IDKEY_PALYCELLCOUNT      1001
      #define IDKEY_PALXCELLWIDTH      1002
      #define IDKEY_PALYCELLHEIGHT     1003
      #define IDKEY_PALXGAP            1004
      #define IDKEY_PALYGAP            1005
      #define IDKEY_PALSCREENSIZEX     1006
      #define IDKEY_PALSCREENSIZEY     1007
      #define IDKEY_PALCELLDATA_FIRST  1050

      /*
       *  Default palette information
       */

      #define DEF_XCELLCOUNT      13
      #define DEF_YCELLCOUNT      9

      /*
       *  Variables kept for each open palette window as
       *  a structure pointed to by the QWL_USER window
       *  word ...
       */

      typedef struct _CELL
      {
         ULONG       cbData;           /* Size of the data that follows */

         /* Class specific cell data follows immediately afterwards -
          * for example the font palette would store the ASCII name of
          * the font, and the color palette would store the RGB color
          * of the cell.
          */
      } CELL;
      typedef CELL *PCELL;

      typedef struct _PALINFO
      {
         ULONG       xCellCount;       /* Number of columns of cells */
         ULONG       yCellCount;       /* Number of rows of cells */
         ULONG       xCursor;          /* Cursor location (readonly) */
         ULONG       yCursor;          /* Cursor location (readonly) */
         ULONG       xCellWidth;       /* Width of each cell */
         ULONG       yCellHeight;      /* Height of each cell */
         ULONG       xGap;             /* X separation of cells */
         ULONG       yGap;             /* Y separation of cells */
      } PALINFO;
      typedef PALINFO *PPALINFO;

      #define SetPaletteDataPtr( hwnd, pPaletteData ) \
           WinSetWindowULong( hwnd, QWL_USER, (ULONG)pPaletteData )

      #define QueryPaletteDataPtr( hwnd ) \
           (PPALETTEDATA)WinQueryWindowULong( hwnd, QWL_USER )

      typedef struct _PALETTEDATA
      {
         WPFolder   *Palette;          /* Folder object for this window */
         USEITEM     UseItem;          /* Folder object's INUSE list item */
         VIEWITEM    ViewItem;
         ULONG       xCursor;
         ULONG       yCursor;
      } PALETTEDATA;
      typedef PALETTEDATA *PPALETTEDATA;

      typedef struct _CELLSTRUCT
      {
         RECTL       rclCell;          /* Cell coordinates */
         PCELL       pCell;            /* Cell data pointer */
      } CELLSTRUCT;
      typedef CELLSTRUCT *PCELLSTRUCT;
      /*
       *  Miscellaneous
       */

      #define PM_INVALIDATECELL WM_USER+1000

      /* Macros that act on a PALINFO...
       */
      #define PALETTE_WIDTH(p)  ( p.xCellCount*(p.xCellWidth+p.xGap) )
      #define PALETTE_HEIGHT(p) ( p.yCellCount*(p.yCellHeight+p.yGap) )
      #define ID_PALSCROLLHORZ     8091
      #define ID_PALSCROLLVERT     8092

      /* Coordinates (these are in DIALOG UNITS)
       */
      #define CXBUTTON          12       /* Width of a button (with no text) */
      #define CYBUTTON          12       /* Height of a button */
      #define XBUTTONGAP        6
      #define YBUTTONGAP        4
      #define CYBUTTONAREA      (CYBUTTON + 2*YBUTTONGAP)
      #define DEF_XCELLWIDTH    10
      #define DEF_YCELLHEIGHT   6
      #define DEF_XCELLGAP      4
      #define DEF_YCELLGAP      4



/* A procedure to create the WPPalette Class */
class M_WPPalette;
SOMEXTERN M_WPPalette * SOMLINK WPPaletteNewClass(
		integer4 majorVersion,
		integer4 minorVersion);

/* The API to the WPPalette class object, and the methods it introduces. */
SOMEXTERN struct WPPaletteClassDataStructure {
	M_WPPalette *classObject;
	somMToken wpPaintCell;
	somMToken wpSelectCell;
	somMToken wpSetupCell;
	somMToken wpQueryPaletteInfo;
	somMToken wpSetPaletteInfo;
	somMToken wpEditCell;
	somMToken wpDragCell;
	somMToken withdrawn;
	somMToken wpInitCellStructs;
	somMToken wpRedrawCell;
	somMToken wpPaintPalette;
	somMToken wpPalettePrivate1;
	somMToken wpQueryPaletteHelp;
	somMToken wpPalettePrivate2;
	somMToken wpSaveCellData;
	somMToken wpRestoreCellData;
	somMToken wpFreeCellData;
} SOMDLINK WPPaletteClassData;
#define _WPPalette WPPaletteClassData.classObject

/* The API to parentMtabs for WPPalette, and the instance data it introduces. */
SOMEXTERN struct WPPaletteCClassDataStructure {
	somMethodTabs parentMtab;
	somDToken              instanceDataToken;
} SOMDLINK WPPaletteCClassData;

/*
 * -- Typedefs for WPPalette Method Procedures
 */
SOMEXTERN {
typedef void   SOMLINK somTP_WPPalette_wpPaintCell(WPPalette *somSelf, 
		PCELL pCell, 
		HPS hps, 
		PRECTL prcl, 
		BOOL fHilite);
typedef somTP_WPPalette_wpPaintCell *somTD_WPPalette_wpPaintCell;
typedef BOOL   SOMLINK somTP_WPPalette_wpSetupCell(WPPalette *somSelf, 
		PVOID pCellData, 
		ULONG cb, 
		ULONG x, 
		ULONG y);
typedef somTP_WPPalette_wpSetupCell *somTD_WPPalette_wpSetupCell;
typedef BOOL   SOMLINK somTP_WPPalette_wpRedrawCell(WPPalette *somSelf, 
		PCELL pCell);
typedef somTP_WPPalette_wpRedrawCell *somTD_WPPalette_wpRedrawCell;
typedef BOOL   SOMLINK somTP_WPPalette_wpQueryPaletteInfo(WPPalette *somSelf, 
		PPALINFO pPalInfo);
typedef somTP_WPPalette_wpQueryPaletteInfo *somTD_WPPalette_wpQueryPaletteInfo;
typedef BOOL   SOMLINK somTP_WPPalette_wpSetPaletteInfo(WPPalette *somSelf, 
		PPALINFO pPalInfo);
typedef somTP_WPPalette_wpSetPaletteInfo *somTD_WPPalette_wpSetPaletteInfo;
typedef BOOL   SOMLINK somTP_WPPalette_wpEditCell(WPPalette *somSelf, 
		PCELL pCell, 
		HWND hwndPal);
typedef somTP_WPPalette_wpEditCell *somTD_WPPalette_wpEditCell;
typedef BOOL   SOMLINK somTP_WPPalette_wpDragCell(WPPalette *somSelf, 
		PCELL pCell, 
		HWND hwndPal, 
		PPOINTL ptlDrag);
typedef somTP_WPPalette_wpDragCell *somTD_WPPalette_wpDragCell;
typedef ULONG   SOMLINK somTP_WPPalette_wpQueryPaletteHelp(WPPalette *somSelf);
typedef somTP_WPPalette_wpQueryPaletteHelp *somTD_WPPalette_wpQueryPaletteHelp;
typedef void   SOMLINK somTP_WPPalette_wpSelectCell(WPPalette *somSelf, 
		HWND hwndPal, 
		PCELL pCell);
typedef somTP_WPPalette_wpSelectCell *somTD_WPPalette_wpSelectCell;
typedef void   SOMLINK somTP_WPPalette_wpPaintPalette(WPPalette *somSelf, 
		HPS hps, 
		PRECTL prcl);
typedef somTP_WPPalette_wpPaintPalette *somTD_WPPalette_wpPaintPalette;
typedef BOOL   SOMLINK somTP_WPPalette_wpInitCellStructs(WPPalette *somSelf);
typedef somTP_WPPalette_wpInitCellStructs *somTD_WPPalette_wpInitCellStructs;
typedef BOOL   SOMLINK somTP_WPPalette_wpSaveCellData(WPPalette *somSelf, 
		PCELL pCell, 
		ULONG ulIndex);
typedef somTP_WPPalette_wpSaveCellData *somTD_WPPalette_wpSaveCellData;
typedef BOOL   SOMLINK somTP_WPPalette_wpRestoreCellData(WPPalette *somSelf, 
		PCELL* pCell, 
		ULONG ulIndex, 
		ULONG ulCellSize);
typedef somTP_WPPalette_wpRestoreCellData *somTD_WPPalette_wpRestoreCellData;
typedef BOOL   SOMLINK somTP_WPPalette_wpFreeCellData(WPPalette *somSelf, 
		PCELL pCell, 
		ULONG ulIndex);
typedef somTP_WPPalette_wpFreeCellData *somTD_WPPalette_wpFreeCellData;

/*
 * -- Typedefs for Reintroduced Wrapper Methods
 */
typedef M_WPPalette*   SOMLINK somTP_WPPalette_somGetClass(WPPalette *somSelf);
typedef somTP_WPPalette_somGetClass *somTD_WPPalette_somGetClass;
}

#endif /* WPPalette_API */


/*
 * -- This emitter treats Method Tokens as Thunks by default.
 * -- Use the sc modifier "nothunks" to change this default
 */
#undef somresolve_
#define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))

/*
 * -- The C++ Wrapper Class for WPPalette
 */
class WPPalette : public WPAbstract
{
public:

// WPPalette::new creates the class object if necessary, and then uses somNewNoInit
// to allocate memory and create the object. Initialization is in ctors.
void *operator new(size_t)
{
   if (!_WPPalette) WPPaletteNewClass(WPPalette_MajorVersion,WPPalette_MinorVersion);
   return (void*)
      SOM_Resolve(_WPPalette,SOMClass,somNewNoInit)
         ((SOMClass *)((void*)_WPPalette));
}

// WPPalette::delete uses somDestruct.
void operator delete(void * obj)
{
   if (obj && *(void**)obj) {
      SOM_Resolve(obj,SOMObject,somDestruct)
         ((SOMObject*)obj, 1, 0);
   }
}

WPPalette& operator=(WPPalette& fromObj)
{
   this->somDefaultAssign(0,(SOMObject*)((void*)&fromObj));
   return *this;
}

WPPalette()
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultInit(0);
}

WPPalette(WPPalette* fromObj)
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultCopyInit(0,((SOMObject*)((void*)fromObj)));
}

WPPalette(const WPPalette* fromObj)
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultConstCopyInit(0,((SOMObject*)((void*)fromObj)));
}


/* method: wpPaintCell */
void   wpPaintCell(PCELL pCell, 
		HPS hps, 
		PRECTL prcl, 
		BOOL fHilite)
{
   SOM_ResolveD(this,WPPalette,WPPalette,wpPaintCell)
	(this,pCell,hps,prcl,fHilite);
}


/* method: wpSetupCell */
BOOL   wpSetupCell(PVOID pCellData, 
		ULONG cb, 
		ULONG x, 
		ULONG y)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpSetupCell)
	(this,pCellData,cb,x,y);
}


/* method: wpRedrawCell */
BOOL   wpRedrawCell(PCELL pCell)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpRedrawCell)
	(this,pCell);
}


/* method: wpQueryPaletteInfo */
BOOL   wpQueryPaletteInfo(PPALINFO pPalInfo)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpQueryPaletteInfo)
	(this,pPalInfo);
}


/* method: wpSetPaletteInfo */
BOOL   wpSetPaletteInfo(PPALINFO pPalInfo)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpSetPaletteInfo)
	(this,pPalInfo);
}


/* method: wpEditCell */
BOOL   wpEditCell(PCELL pCell, 
		HWND hwndPal)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpEditCell)
	(this,pCell,hwndPal);
}


/* method: wpDragCell */
BOOL   wpDragCell(PCELL pCell, 
		HWND hwndPal, 
		PPOINTL ptlDrag)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpDragCell)
	(this,pCell,hwndPal,ptlDrag);
}


/* method: wpQueryPaletteHelp */
ULONG   wpQueryPaletteHelp()
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpQueryPaletteHelp)
	(this);
}


/* method: wpSelectCell */
void   wpSelectCell(HWND hwndPal, 
		PCELL pCell)
{
   SOM_ResolveD(this,WPPalette,WPPalette,wpSelectCell)
	(this,hwndPal,pCell);
}


/* method: wpPaintPalette */
void   wpPaintPalette(HPS hps, 
		PRECTL prcl)
{
   SOM_ResolveD(this,WPPalette,WPPalette,wpPaintPalette)
	(this,hps,prcl);
}


/* method: wpInitCellStructs */
BOOL   wpInitCellStructs()
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpInitCellStructs)
	(this);
}


/* method: wpSaveCellData */
BOOL   wpSaveCellData(PCELL pCell, 
		ULONG ulIndex)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpSaveCellData)
	(this,pCell,ulIndex);
}


/* method: wpRestoreCellData */
BOOL   wpRestoreCellData(PCELL* pCell, 
		ULONG ulIndex, 
		ULONG ulCellSize)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpRestoreCellData)
	(this,pCell,ulIndex,ulCellSize);
}


/* method: wpFreeCellData */
BOOL   wpFreeCellData(PCELL pCell, 
		ULONG ulIndex)
{
   return SOM_ResolveD(this,WPPalette,WPPalette,wpFreeCellData)
	(this,pCell,ulIndex);
}


/*
 * Reintroduce inherited methods
 */

/* method: somGetClass */
M_WPPalette*  somGetClass()
{
/*
 *  Return the receiver's class.
 */
   return SOM_ResolveD(this,WPPalette,SOMObject,somGetClass)
	(this);
}



};   /* WPPalette */



#endif       /* SOM_WPPalette_xh */

#ifndef SOM_M_WPPalette_xh
#define SOM_M_WPPalette_xh

class M_WPPalette;

#define M_WPPalette_MajorVersion 1
#define M_WPPalette_MinorVersion 2

/* C++ SOM defs */
#include <somcls.xh>
#include <somcm.xh>

/* C++ parent defs */
#ifndef SOM_M_WPAbstract_xh
#include <wpabs.xh>
#endif

#ifndef M_WPPalette_API
#define M_WPPalette_API
/*
 * -- The Class API
 */

/*
 * Start of bindings for IDL types
 */


/*
 * End of bindings for IDL types.
 */

/*
 * -- M_WPPalette is a metaclass for WPPalette. Make sure WPPalette is known.
 */
class WPPalette;


/* A procedure to create the M_WPPalette Class */
SOMEXTERN SOMClass * SOMLINK M_WPPaletteNewClass(
		integer4 majorVersion,
		integer4 minorVersion);

/* The API to the M_WPPalette class object, and the methods it introduces. */
SOMEXTERN struct M_WPPaletteClassDataStructure {
	SOMClass *classObject;
	somMToken wpclsQueryEditString;
} SOMDLINK M_WPPaletteClassData;
#define _M_WPPalette M_WPPaletteClassData.classObject

/* The API to parentMtabs for M_WPPalette, and the instance data it introduces. */
SOMEXTERN struct M_WPPaletteCClassDataStructure {
	somMethodTabs parentMtab;
	somDToken              instanceDataToken;
} SOMDLINK M_WPPaletteCClassData;

/*
 * -- Typedefs for M_WPPalette Method Procedures
 */
SOMEXTERN {
typedef PSZ   SOMLINK somTP_M_WPPalette_wpclsQueryEditString(M_WPPalette *somSelf);
typedef somTP_M_WPPalette_wpclsQueryEditString *somTD_M_WPPalette_wpclsQueryEditString;

/*
 * -- Typedefs for Reintroduced Wrapper Methods
 */
typedef WPPalette*   SOMLINK somTP_M_WPPalette_somNew(M_WPPalette *somSelf);
typedef somTP_M_WPPalette_somNew *somTD_M_WPPalette_somNew;
}

#endif /* M_WPPalette_API */


/*
 * -- This emitter treats Method Tokens as Thunks by default.
 * -- Use the sc modifier "nothunks" to change this default
 */
#undef somresolve_
#define somresolve_(obj,mToken) ((somMethodProc*)((void)obj, mToken))

/*
 * -- The C++ Wrapper Class for M_WPPalette
 */
class M_WPPalette : public M_WPAbstract
{
public:

// M_WPPalette::new creates the class object if necessary, and then uses somNewNoInit
// to allocate memory and create the object. Initialization is in ctors.
void *operator new(size_t)
{
   if (!_M_WPPalette) M_WPPaletteNewClass(M_WPPalette_MajorVersion,M_WPPalette_MinorVersion);
   return (void*)
      SOM_Resolve(_M_WPPalette,SOMClass,somNewNoInit)
         ((SOMClass *)((void*)_M_WPPalette));
}

// M_WPPalette::delete uses somDestruct.
void operator delete(void * obj)
{
   if (obj && *(void**)obj) {
      SOM_Resolve(obj,SOMObject,somDestruct)
         ((SOMObject*)obj, 1, 0);
   }
}

M_WPPalette& operator=(M_WPPalette& fromObj)
{
   this->somDefaultAssign(0,(SOMObject*)((void*)&fromObj));
   return *this;
}

M_WPPalette()
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (M_WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultInit(0);
}

M_WPPalette(M_WPPalette* fromObj)
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (M_WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultCopyInit(0,((SOMObject*)((void*)fromObj)));
}

M_WPPalette(const M_WPPalette* fromObj)
{
   if (*(void**)this != 
       ((somParentMtabStructPtr)
        (M_WPPaletteCClassData.parentMtab))->mtab)
      return;
   ((SOMObject*)((void*)this))->somDefaultConstCopyInit(0,((SOMObject*)((void*)fromObj)));
}


/* method: wpclsQueryEditString */
PSZ   wpclsQueryEditString()
{
   return SOM_ResolveD(this,M_WPPalette,M_WPPalette,wpclsQueryEditString)
	(this);
}


/*
 * Reintroduce inherited methods
 */

/* method: somNew */
WPPalette*  somNew()
{
   return SOM_ResolveD(this,M_WPPalette,SOMClass,somNew)
	(this);
}



};   /* M_WPPalette */



#endif       /* SOM_M_WPPalette_xh */
