home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wpobj.zip / CLRSTAR.C < prev    next >
C/C++ Source or Header  |  1993-10-13  |  2KB  |  69 lines

  1. /******************************************************************************
  2.  * MODULE NAME: ClrStar.C
  3.  *
  4.  * DESCRIPTION:
  5.  *     Source code for StarColorPalette object class.
  6. \****************************************************************************/
  7. /* OBJECT CLASS: StarColorPalette
  8.  *
  9.  * CLASS HIERARCHY:
  10.  *
  11.  *     SOMObject
  12.  *       └── WPObject
  13.  *             └── WPAbstract
  14.  *                   └── WPPalette
  15.  *                         └──  WPColorPalette
  16.  *                                  └──  ColorPalette
  17.  *                                          └──  StarColorPalette
  18.  *
  19.  * DESCRIPTION:
  20.  */
  21. #define SOMLINK    _System
  22. #define StarColorPalette_Class_Source
  23. #include "clrstar.ih"       /* implementation header emitted from ClrStar.csc */
  24.  
  25. /********************* INSTANCE METHODS SECTION *****************************\
  26.  *        Do not put any code in this section unless it is really an        *
  27.  *      object INSTANCE method: otherwise parent method resolution will        *
  28.  *                   not work correctly for that method                        *
  29. \****************************************************************************/
  30. #undef SOM_CurrentClass
  31. #define SOM_CurrentClass SOMInstance
  32.  
  33. /*
  34.  * METHOD OVERRIDE: QuerySampleShape
  35.  *
  36.  * DESCRIPTION:
  37.  *   Override the QuerySampleShape method so that this subclass will have a
  38.  *   different shaped color swatch displayed in its palette view.
  39.  */
  40. SOM_Scope BOOL SOMLINK clrs_QuerySampleShape(
  41.     ColorPalette    *somSelf,
  42.     PPOINTL            pPoints,
  43.     PULONG             pcPoints)
  44. {
  45. /*    StarColorPaletteData *somThis = StarColorPaletteGetData(somSelf); */
  46.     #define         STAR_CPOINTS                11
  47.     static POINTL    ptlStar[STAR_CPOINTS] = { {  20,   0 },
  48.                                               {  30,  40 },
  49.                                               {   0,  60 },
  50.                                               {  30,  60 },
  51.                                               {  50, 100 },
  52.                                               {  70,  60 },
  53.                                               { 100,  60 },
  54.                                               {  70,  40 },
  55.                                               {  80,   0 },
  56.                                               {  50,  30 },
  57.                                               {  20,   0 }
  58.                                             };
  59.  
  60.     /* Return the coordinate data for a star shape, instead of just
  61.      * letting this method go through to our parent class.
  62.      */
  63.     if (pPoints)
  64.         memcpy(pPoints,ptlStar,STAR_CPOINTS * sizeof(POINTL));
  65.     if (pcPoints)
  66.         *pcPoints    = STAR_CPOINTS;
  67.     return TRUE;
  68. }
  69.