home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / SAMPLES / DIBVIEW / PALETTE.H_ / PALETTE.H
Encoding:
C/C++ Source or Header  |  1993-02-08  |  3.0 KB  |  102 lines

  1.  
  2. #ifndef PALETTE_INCLUDED
  3. #define PALETTE_INCLUDED
  4.  
  5.    // Size of window extra bytes (we store a handle to a PALINFO structure).
  6.  
  7. #define PAL_CBWNDEXTRA  (1 * sizeof (WORD))
  8.  
  9.  
  10. typedef struct
  11.    {
  12.    HPALETTE hPal;                      // Handle to palette being displayed.
  13.    WORD     wEntries;                  // # of entries in the palette.
  14.    int      nSquareSize;               // Size of palette square (see PAL_SIZE)
  15.    HWND     hInfoWnd;                  // Handle to the info bar window.
  16.    int      nRows, nCols;              // # of Rows/Columns in window.
  17.    int      cxSquare, cySquare;        // Pixel width/height of palette square.
  18.    WORD     wEntry;                    // Currently selected palette square.
  19.    } PALINFO, FAR *LPPALINFO;
  20.  
  21.  
  22.  
  23.    // Window Words.
  24.  
  25. #define WW_PAL_HPALINFO 0              // Handle to PALINFO structure.
  26.  
  27.  
  28.  
  29.    // The following define is for CopyPaletteChangingFlags().
  30.  
  31. #define DONT_CHANGE_FLAGS -1
  32.  
  33.  
  34.  
  35.    // The following is the palette version that goes in a
  36.    //  LOGPALETTE's palVersion field.
  37.  
  38. #define PALVERSION   0x300
  39.  
  40.  
  41.  
  42. // This is an enumeration for the various ways we can display
  43. //  a palette in PaletteWndProc().
  44.  
  45. enum PAL_SIZE
  46.    {
  47.    PALSIZE_TINY = 0,
  48.    PALSIZE_SMALL,
  49.    PALSIZE_MEDIUM,
  50.    PALSIZE_LARGE
  51.    };
  52.  
  53.  
  54.  
  55. // Menu Defines for Palette Windows.  Note -- these must be in sequential
  56. //  order from TINY to FITWND.  If this is changed, the changes must be
  57. //  reflected in PALETTE.C -- WM_INITMENUPOPUP and WM_COMMAND message
  58. //  processing.
  59.  
  60. #define IDM_PAL_TINY        1000       // Tiny palette squares.
  61. #define IDM_PAL_SMALL       1001       // Small palette squares.
  62. #define IDM_PAL_MEDIUM      1002       // Medium palette squares.
  63. #define IDM_PAL_LARGE       1003       // Large palette squares.
  64.  
  65.  
  66.  
  67. // String defines for strings in DIBVIEW.RC's string table.
  68.  
  69. #define IDS_PAL_RGB         2048       // String for PALETTEENTRY.peFlags=0
  70. #define IDS_PAL_RESERVED    2049       // String for PALETTEENTRY.peFlags=1
  71. #define IDS_PAL_EXPLICIT    2050       // String for PALETTEENTRY.peFlags=2
  72. #define IDS_PAL_ERROR       2051       // String for PALETTEENTRY.peFlags=3
  73. #define IDS_PAL_NOCOLLAPSE  2052       // String for PALETTEENTRY.peFlags=4
  74.  
  75. #define IDS_PAL_NOPAL       2053       // String when no palette passed in.
  76. #define IDS_PAL_DISPRGB     2054       // Format string for status line.
  77.  
  78.  
  79. // Function prototypes.
  80.  
  81.  
  82. long FAR PASCAL __export PaletteWndProc (HWND hwnd,
  83.                 UINT message,
  84.                 WPARAM wParam,
  85.                 LPARAM lParam);
  86.  
  87. void SetPaletteWindowsPal (HWND hWnd, HPALETTE hPal);
  88.  
  89. HPALETTE GetSystemPalette (void);
  90.  
  91. HPALETTE CopyPaletteChangingFlags (HPALETTE hPal, BYTE bNewFlag);
  92.  
  93. void MyAnimatePalette (HWND hWnd, HPALETTE hPal);
  94.  
  95. int ColorsInPalette (HPALETTE hPal);
  96.  
  97. #define CopyPalette(hPal)  CopyPaletteChangingFlags (hPal,(BYTE) DONT_CHANGE_FLAGS)
  98.  
  99. #define CopyPalForAnimation(hPal) CopyPaletteChangingFlags (hPal, PC_RESERVED)
  100.  
  101. #endif // PALETTE_INCLUDED
  102.