home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / clrwhl11.zip / dllsrc / editcol.h < prev    next >
C/C++ Source or Header  |  1998-01-28  |  5KB  |  115 lines

  1. //=========================================================================\
  2. // edit color dialog based on the undocumented color wheel OS/2 control    |
  3. // from an idea of Paul Ratcliffe (E-mail: paulr@orac.clara.co.uk or       |
  4. // paul.ratcliffe@bbc.co.uk)                                               |
  5. // coded by Alessandro Cantatore (alexcant@tin.it                          |
  6. // version 1.1                                                             |
  7. //=========================================================================/
  8.  
  9. // color wheel class ------------------------------------------------------
  10.  
  11. #define WC_COLORWHEEL               "ColorSelectClass"
  12.  
  13.  
  14. //=========================================================================\
  15. // messages:                                                               |
  16. // WM_COLORWHEELCHANGED : mp1 = LONG RGB color                             |
  17. //                        mp2 = MPVOID                                     |
  18. //                        is sent by the color wheel control to its owner  |
  19. //                        when the color wheel color changes               |
  20. //                        Is is also sent from the "edit color" dialog to  |
  21. //                        its owner window                                 |
  22. // CWM_COLORWHEELSETVAL : mp1 = LONG RGB color                             |
  23. //                        mp2 = MPVOID                                     |
  24. //                        is sent to the color wheel to set the current    |
  25. //                        color                                            |
  26. //=========================================================================/
  27.  
  28.  
  29. // warp 4 messages
  30. #define WM_COLORWHEELCHANGED        0x0601
  31. #define CWM_COLORWHEELSETVAL        0x0602
  32.  
  33. // warp 3 messages
  34. #define WM_COLORWHEELCHANGED3       0x130C
  35. #define CWM_COLORWHEELSETVAL3       0x1384
  36.  
  37.  
  38. // various constants ------------------------------------------------------
  39.  
  40. #define MAXTITLESIZE           128     // max length of dialog title
  41. #define SZ_MODULE     "EDITCOL.DLL"    // DLL name
  42.  
  43.  
  44. // application structures -------------------------------------------------
  45.  
  46. #pragma pack(1)
  47.  
  48. typedef union {
  49.    LONG lClr;
  50.    struct {
  51.       UCHAR blu, grn, red, x;
  52.    } rgb;
  53. } CLR, * PCLR;
  54.  
  55. #pragma pack(2)
  56.  
  57. typedef struct {
  58.    USHORT cbSize;                  // structure size
  59.    USHORT res;                     // not used
  60.    HAB hab;                        // anchor block handle
  61.    HLIB hlib;                      // WPCONFIG.DLL handle
  62.    HMODULE hDlgMod;                // COLWHEEL.DLL handle
  63.    HWND hwndParent;                // handle parent window
  64.    HWND hwndOwner;                 // handle owner window
  65.    ULONG ulVer;                    // OS version
  66.    ULONG cwChangedMsg;             // WM_COLORWHEELCHANGED(-3)
  67.    ULONG cwSetMsg;                 // CWM_COLORWHEELSETVAL(-3)
  68.    CHAR achDlgTitle[MAXTITLESIZE]; // dialog title
  69.    BOOL flUpd;                     // update color-wheel/spinbuttons flag
  70.    CLR clrUndo;                    // start color
  71.    CLR clrCurr;                    // current color
  72.    RECTL rclPar;                   // parent window rectangle
  73.    RECTL rcl;                      // dialog window rectangle
  74. } APPDATA, * PAPPDATA;
  75.  
  76. #pragma pack()
  77.  
  78. // functions --------------------------------------------------------------
  79.  
  80. LONG _Export APIENTRY WinEditColorDlg(HWND hwndParent,  // parent handle
  81.                                       HWND hwndOwner,   // owner handle
  82.                                       COLOR color,      // RGB color (LONG)
  83.                                       PSZ pszTitle);    // dialog title
  84.  
  85. MRESULT EXPENTRY EditColorDlgProc(HWND hwnd,
  86.                                   ULONG msg,
  87.                                   MPARAM mp1,
  88.                                   MPARAM mp2);
  89.  
  90. VOID SetSpins(HWND hwnd, CLR clr);
  91.  
  92.  
  93. // strings ----------------------------------------------------------------
  94. #define SZ_DEFTITLE                 "Edit Color"
  95. #define SZ_RED                      "~Red:"
  96. #define SZ_GREEN                    "~Green:"
  97. #define SZ_BLUE                     "~Blue:"
  98. #define SZ_OK                       "~OK"
  99. #define SZ_UNDO                     "~Undo"
  100. #define SZ_CANCEL                   "~Cancel"
  101.  
  102.  
  103. // dlg controls -----------------------------------------------------------
  104. #define DLG_CWHEEL                  100
  105. #define CWHEEL                      101
  106. #define TXT_RED                     102
  107. #define SPN_RED                     103
  108. #define TXT_GREEN                   104
  109. #define SPN_GREEN                   105
  110. #define TXT_BLUE                    106
  111. #define SPN_BLUE                    107
  112. #define BTN_OK                      108
  113. #define BTN_UNDO                    109
  114. #define BTN_CANCEL                  110
  115.