
/*
 * This file was generated by the SOM Compiler.
 * FileName: wppalet.xh.
 * Generated using:
 *     SOM Precompiler spc: 1.22
 *     SOM Emitter emitxh: 1.11
 */

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

#ifndef wppalet_xh
#define wppalet_xh
class WPPalette;

#define WPPalette_MajorVersion 1
#define WPPalette_MinorVersion 2

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

/* C++ parent def */
#ifndef wpabs_xh
#include "wpabs.xh"
#endif

/*
 * Passthru lines: File: "C.xh", "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      6
      #define DEF_YCELLCOUNT      5

      /*
       *  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    22
      #define DEF_YCELLHEIGHT   16
      #define DEF_XCELLGAP      4
      #define DEF_YCELLGAP      4



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

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

/* A macro to return the WPPalette class object */
class M_WPPalette;
#define _WPPalette ((M_WPPalette*)WPPaletteClassData.classObject)

/* The static interface to WPPalette and its instances */
SOMEXTERN struct WPPaletteClassDataStructure {
	SOMClass *classObject;
	somMToken wpPaintCell;
	somMToken wpSelectCell;
	somMToken wpSetupCell;
	somMToken wpQueryPaletteInfo;
	somMToken wpSetPaletteInfo;
	somMToken wpEditCell;
	somMToken wpDragCell;
	somMToken withdrawn;
	somMToken wpInitCellStructs;
	somMToken wpRedrawCell;
	somMToken wpPaintPalette;
	somMToken wpMouseAction;
	somMToken wpQueryPaletteHelp;
	somMToken wpShowPalettePointer;
} WPPaletteClassData;

/*
 * -- Typedefs for Procedures that support WPPalette Methods
 */
extern "C" {
typedef VOID    (SOMLINK *somTD_WPPalette_wpPaintCell)(WPPalette *somSelf,PCELL pCell,HPS hps,PRECTL prcl,BOOL fHilite);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpSetupCell)(WPPalette *somSelf,PVOID pCellData,ULONG cb,ULONG x,ULONG y);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpRedrawCell)(WPPalette *somSelf,PCELL pCell);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpQueryPaletteInfo)(WPPalette *somSelf,PPALINFO pPalInfo);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpSetPaletteInfo)(WPPalette *somSelf,PPALINFO pPalInfo);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpEditCell)(WPPalette *somSelf,PCELL pCell,HWND hwndPal);
typedef BOOL    (SOMLINK *somTD_WPPalette_wpDragCell)(WPPalette *somSelf,PCELL pCell,HWND hwndPal,PPOINTL ptlDrag);
typedef ULONG    (SOMLINK *somTD_WPPalette_wpQueryPaletteHelp)(WPPalette *somSelf);
}


#endif /* WPPalette_API */


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

void *operator new(size_t size)
{
   (void) size;
   if (!WPPaletteClassData.classObject) 
      WPPaletteNewClass(WPPalette_MajorVersion,WPPalette_MinorVersion);
   return (void *)
      ((somTD_SOMClass_somNew)
      somResolve(SOM_TestCls((SOMAny *)(WPPaletteClassData.classObject),
                             SOMClassClassData.classObject),
                 SOMClassClassData.somNew))
         ((SOMClass*)(WPPaletteClassData.classObject));
}

void operator delete(void * obj)
{
   ((SOMObject *)obj)->somFree();
}

/* public method: wpPaintCell */
VOID    wpPaintCell(PCELL pCell,
		HPS hps,
		PRECTL prcl,
		BOOL fHilite)
{
   SOM_Resolve((SOMAny *)this,WPPalette,wpPaintCell)
	(this,pCell,hps,prcl,fHilite);
}


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


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


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


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


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


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


/* public method: wpQueryPaletteHelp */
ULONG    wpQueryPaletteHelp()
{
   return (ULONG) SOM_Resolve((SOMAny *)this,WPPalette,wpQueryPaletteHelp)
	(this);
}



};   /* WPPalette */



#endif       /* wppalet_xh */

/*
 * This file was generated by the SOM Compiler.
 * FileName: wppalet.xh.
 * Generated using:
 *     SOM Precompiler spc: 1.22
 *     SOM Emitter emitxh: 1.11
 */
#ifndef wppalet_mxh
#define wppalet_mxh
class M_WPPalette;

#define M_WPPalette_MajorVersion 1
#define M_WPPalette_MinorVersion 2

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

/* C++ parent def */
#ifndef wpabs_xh
#include "wpabs.xh"
#endif

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

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

/* A macro to return the M_WPPalette class object */
#define _M_WPPalette ((SOMClass*)M_WPPaletteClassData.classObject)

/* The static interface to M_WPPalette and its instances */
SOMEXTERN struct M_WPPaletteClassDataStructure {
	SOMClass *classObject;
	somMToken wpclsQueryEditString;
} M_WPPaletteClassData;

/*
 * -- Typedefs for Procedures that support M_WPPalette Methods
 */
extern "C" {
typedef PSZ    (SOMLINK *somTD_M_WPPalette_wpclsQueryEditString)(M_WPPalette *somSelf);
}


#endif /* M_WPPalette_API */


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

void *operator new(size_t size)
{
   (void) size;
   if (!M_WPPaletteClassData.classObject) 
      M_WPPaletteNewClass(M_WPPalette_MajorVersion,M_WPPalette_MinorVersion);
   return (void *)
      ((somTD_SOMClass_somNew)
      somResolve(SOM_TestCls((SOMAny *)(M_WPPaletteClassData.classObject),
                             SOMClassClassData.classObject),
                 SOMClassClassData.somNew))
         ((SOMClass*)(M_WPPaletteClassData.classObject));
}

void operator delete(void * obj)
{
   ((SOMObject *)obj)->somFree();
}

/* public method: wpclsQueryEditString */
PSZ    wpclsQueryEditString()
{
   return (PSZ) SOM_Resolve((SOMAny *)this,M_WPPalette,wpclsQueryEditString)
	(this);
}



};   /* M_WPPalette */



#endif       /* wppalet_mxh */
