home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wpsclass.zip / WPPALET.HH < prev    next >
Text File  |  1995-05-15  |  7KB  |  228 lines

  1.  
  2. #ifndef WPPalette_Source
  3. #define WPPalette_Source
  4.  
  5. #include <wpabs.hh>
  6.  
  7. #pragma off(som_bindings);
  8.   /*
  9.    *  Open view for the wpOpen() method
  10.    */
  11.  
  12.   #define OPEN_PALETTE       121
  13.  
  14.   /*
  15.    *  Palette save-restore keys
  16.    */
  17.  
  18.   #define IDKEY_PALXCELLCOUNT      1000
  19.   #define IDKEY_PALYCELLCOUNT      1001
  20.   #define IDKEY_PALXCELLWIDTH      1002
  21.   #define IDKEY_PALYCELLHEIGHT     1003
  22.   #define IDKEY_PALXGAP            1004
  23.   #define IDKEY_PALYGAP            1005
  24.   #define IDKEY_PALSCREENSIZEX     1006
  25.   #define IDKEY_PALSCREENSIZEY     1007
  26.   #define IDKEY_PALCELLDATA_FIRST  1050
  27.  
  28.   /*
  29.    *  Default palette information
  30.    */
  31.  
  32.   #define DEF_XCELLCOUNT      6
  33.   #define DEF_YCELLCOUNT      5
  34.  
  35.   /*
  36.    *  Variables kept for each open palette window as
  37.    *  a structure pointed to by the QWL_USER window
  38.    *  word ...
  39.    */
  40.  
  41.   typedef struct _CELL
  42.   {
  43.      ULONG       cbData;           /* Size of the data that follows */
  44.  
  45.      /* Class specific cell data follows immediately afterwards -
  46.       * for example the font palette would store the ASCII name of
  47.       * the font, and the color palette would store the RGB color
  48.       * of the cell.
  49.       */
  50.   } CELL;
  51.   typedef CELL *PCELL;
  52.  
  53.   typedef struct _PALINFO
  54.   {
  55.      ULONG       xCellCount;       /* Number of columns of cells */
  56.      ULONG       yCellCount;       /* Number of rows of cells */
  57.      ULONG       xCursor;          /* Cursor location (readonly) */
  58.      ULONG       yCursor;          /* Cursor location (readonly) */
  59.      ULONG       xCellWidth;       /* Width of each cell */
  60.      ULONG       yCellHeight;      /* Height of each cell */
  61.      ULONG       xGap;             /* X separation of cells */
  62.      ULONG       yGap;             /* Y separation of cells */
  63.   } PALINFO;
  64.   typedef PALINFO *PPALINFO;
  65.  
  66.   #define SetPaletteDataPtr( hwnd, pPaletteData ) \
  67.        WinSetWindowULong( hwnd, QWL_USER, (ULONG)pPaletteData )
  68.  
  69.   #define QueryPaletteDataPtr( hwnd ) \
  70.        (PPALETTEDATA)WinQueryWindowULong( hwnd, QWL_USER )
  71.  
  72.   typedef struct _PALETTEDATA
  73.   {
  74.      WPFolder   *Palette;          /* Folder object for this window */
  75.      USEITEM     UseItem;          /* Folder object's INUSE list item */
  76.      VIEWITEM    ViewItem;
  77.      ULONG       xCursor;
  78.      ULONG       yCursor;
  79.   } PALETTEDATA;
  80.   typedef PALETTEDATA *PPALETTEDATA;
  81.  
  82.   typedef struct _CELLSTRUCT
  83.   {
  84.      RECTL       rclCell;          /* Cell coordinates */
  85.      PCELL       pCell;            /* Cell data pointer */
  86.   } CELLSTRUCT;
  87.   typedef CELLSTRUCT *PCELLSTRUCT;
  88.   /*
  89.    *  Miscellaneous
  90.    */
  91.  
  92.   #define PM_INVALIDATECELL WM_USER+1000
  93.  
  94.   /* Macros that act on a PALINFO...
  95.    */
  96.   #define PALETTE_WIDTH(p)  ( p.xCellCount*(p.xCellWidth+p.xGap) )
  97.   #define PALETTE_HEIGHT(p) ( p.yCellCount*(p.yCellHeight+p.yGap) )
  98.   #define ID_PALSCROLLHORZ     8091
  99.   #define ID_PALSCROLLVERT     8092
  100.  
  101.   /* Coordinates (these are in DIALOG UNITS)
  102.    */
  103.   #define CXBUTTON          12       /* Width of a button (with no text) */
  104.   #define CYBUTTON          12       /* Height of a button */
  105.   #define XBUTTONGAP        6
  106.   #define YBUTTONGAP        4
  107.   #define CYBUTTONAREA      (CYBUTTON + 2*YBUTTONGAP)
  108.   #define DEF_XCELLWIDTH    22
  109.   #define DEF_YCELLHEIGHT   16
  110.   #define DEF_XCELLGAP      4
  111.   #define DEF_YCELLGAP      4
  112. #pragma pop(som_bindings);
  113.  
  114. #pragma off(dts_class);
  115. #pragma on(somobject_assignment_operators);
  116. #pragma on(somobject_constructors);
  117. #pragma on(somobject_destructor);
  118. #pragma off(case_insensitive_class_names);
  119.  
  120. #pragma on(som_bindings);
  121. class WPPalette : public WPAbstract {
  122.  
  123.      #pragma SOMMap (WPPalette, "WPPalette", "M_WPPalette")
  124.  
  125.      #pragma SOMClassVersion (WPPalette, 1, 2)
  126.  
  127.      #pragma SOMCallstyle (WPPalette, oidl)
  128.  
  129.      #pragma off(som_bindings);
  130.      #pragma pop(som_bindings);
  131.   public :
  132.  
  133. #pragma off(use_override_signature)
  134.      virtual void wpPaintCell(PCELL pCell, HPS hps, PRECTL prcl,
  135.                               BOOL fHilite);
  136.      virtual BOOL wpSetupCell(PVOID pCellData, ULONG cb, ULONG x,
  137.                               ULONG y);
  138.      virtual BOOL wpRedrawCell(PCELL pCell);
  139.      virtual BOOL wpQueryPaletteInfo(PPALINFO pPalInfo);
  140.      virtual BOOL wpSetPaletteInfo(PPALINFO pPalInfo);
  141.      virtual BOOL wpEditCell(PCELL pCell, HWND hwndPal);
  142.      virtual BOOL wpDragCell(PCELL pCell, HWND hwndPal, PPOINTL ptlDrag);
  143.      virtual ULONG wpQueryPaletteHelp();
  144.      virtual void wpInitData();
  145.      virtual void wpUnInitData();
  146.      virtual BOOL wpSetup(PSZ pszSetupString);
  147.      virtual BOOL wpSaveState();
  148.      virtual BOOL wpRestoreState(ULONG ulReserved);
  149.      virtual BOOL wpMenuItemSelected(HWND hwndFrame, ULONG ulMenuId);
  150.      virtual BOOL wpModifyPopupMenu(HWND hwndMenu, HWND hwndCnr,
  151.                                     ULONG iPosition);
  152.      virtual ULONG wpFilterPopupMenu(ULONG ulFlags, HWND hwndCnr,
  153.                                      BOOL fMultiSelect);
  154.      virtual HWND wpOpen(HWND hwndCnr, ULONG ulView, ULONG param);
  155.      virtual BOOL wpMenuItemHelpSelected(ULONG MenuId);
  156. #pragma pop(use_override_signature)
  157.  
  158.      #pragma SOMReleaseOrder ( \
  159.                               wpPaintCell, \
  160.                               *, \
  161.                               wpSetupCell, \
  162.                               wpQueryPaletteInfo, \
  163.                               wpSetPaletteInfo, \
  164.                               wpEditCell, \
  165.                               wpDragCell, \
  166.                               *, \
  167.                               *, \
  168.                               wpRedrawCell, \
  169.                               *, \
  170.                               *, \
  171.                               wpQueryPaletteHelp, \
  172.                               *)
  173. };
  174.  
  175.  
  176. #pragma pop(som_bindings);
  177.  
  178. #pragma pop(dts_class);
  179. #pragma pop(somobject_assignment_operators);
  180. #pragma pop(somobject_constructors);
  181. #pragma pop(somobject_destructor);
  182. #pragma pop(case_insensitive_class_names);
  183. #endif /* WPPalette_Source */
  184.  
  185. #ifndef M_WPPalette_Source
  186. #define M_WPPalette_Source
  187.  
  188. #include <wpabs.hh>
  189. #include <somcls.hh>
  190. #pragma off(dts_class);
  191. #pragma on(somobject_assignment_operators);
  192. #pragma on(somobject_constructors);
  193. #pragma on(somobject_destructor);
  194. #pragma off(case_insensitive_class_names);
  195.  
  196. #pragma on(som_bindings);
  197. class M_WPPalette : public M_WPAbstract {
  198.  
  199.      #pragma SOMClassVersion (M_WPPalette, 1, 2)
  200.  
  201.      #pragma SOMCallstyle (M_WPPalette, oidl)
  202.  
  203.      #pragma off(som_bindings);
  204.      #pragma pop(som_bindings);
  205.   public :
  206.  
  207. #pragma off(use_override_signature)
  208.      virtual PSZ wpclsQueryEditString();
  209.      virtual PSZ wpclsQueryTitle();
  210.      virtual ULONG wpclsQueryStyle();
  211.      virtual ULONG wpclsQueryDefaultView();
  212.      virtual BOOL wpclsQueryDefaultHelp(PULONG pHelpPanelId,
  213.                                         PSZ pszHelpLibrary);
  214. #pragma pop(use_override_signature)
  215.  
  216.      #pragma SOMReleaseOrder ( \
  217.                               wpclsQueryEditString)
  218. };
  219. #pragma pop(som_bindings);
  220.  
  221. #pragma pop(dts_class);
  222. #pragma pop(somobject_assignment_operators);
  223. #pragma pop(somobject_constructors);
  224. #pragma pop(somobject_destructor);
  225. #pragma pop(case_insensitive_class_names);
  226. #endif /* M_WPPalette_Source */
  227.  
  228.