ColorPickerDialogClass.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #if !defined(AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)
  19. #define AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif // _MSC_VER >= 1000
  23. // ColorPickerDialogClass.h : header file
  24. //
  25. #include "Resource.H"
  26. #include "WWCtrl.H"
  27. // Forward declarations
  28. class ColorBarClass;
  29. class ColorPickerClass;
  30. /////////////////////////////////////////////////////////////////////////////
  31. //
  32. // ColorPickerDialogClass dialog
  33. //
  34. class ColorPickerDialogClass : public CDialog
  35. {
  36. // Construction
  37. public:
  38. ColorPickerDialogClass (int red, int green, int blue, CWnd* pParent = NULL, UINT res_id = ColorPickerDialogClass::IDD); // standard constructor
  39. // Dialog Data
  40. //{{AFX_DATA(ColorPickerDialogClass)
  41. enum { IDD = IDD_COLOR_PICKER };
  42. CSpinButtonCtrl m_BlueSpin;
  43. CSpinButtonCtrl m_GreenSpin;
  44. CSpinButtonCtrl m_RedSpin;
  45. //}}AFX_DATA
  46. // Overrides
  47. // ClassWizard generated virtual function overrides
  48. //{{AFX_VIRTUAL(ColorPickerDialogClass)
  49. protected:
  50. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  51. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  52. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  53. virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  54. virtual void PostNcDestroy();
  55. //}}AFX_VIRTUAL
  56. // Implementation
  57. protected:
  58. // Generated message map functions
  59. //{{AFX_MSG(ColorPickerDialogClass)
  60. virtual BOOL OnInitDialog();
  61. afx_msg void OnReset();
  62. //}}AFX_MSG
  63. DECLARE_MESSAGE_MAP()
  64. public:
  65. /////////////////////////////////////////////////////////////
  66. // Public methods
  67. /////////////////////////////////////////////////////////////
  68. int Get_Red (void) const { return (int)m_CurrentRed; }
  69. int Get_Green (void) const { return (int)m_CurrentGreen; }
  70. int Get_Blue (void) const { return (int)m_CurrentBlue; }
  71. void Set_Color (int r, int g, int b)
  72. { Update_Color((float)r, (float)g, (float)b); }
  73. void Set_Original_Color (int r, int g, int b);
  74. void Create_Form (CWnd *parent);
  75. void Set_Update_Callback (WWCTRL_COLORCALLBACK callme, void *arg)
  76. { m_UpdateCallback = callme; m_CallArg = arg; }
  77. protected:
  78. /////////////////////////////////////////////////////////////
  79. // Protected methods
  80. /////////////////////////////////////////////////////////////
  81. void Update_Red_Bar (void);
  82. void Update_Green_Bar (void);
  83. void Update_Blue_Bar (void);
  84. void Update_Current_Color_Bar (void);
  85. void Update_Whiteness_Bar (void);
  86. void Update_Color (float red, float green, float blue, DWORD flags = 0xFFFFFFFF);
  87. private:
  88. /////////////////////////////////////////////////////////////
  89. // Private member data
  90. /////////////////////////////////////////////////////////////
  91. float m_OrigRed;
  92. float m_OrigGreen;
  93. float m_OrigBlue;
  94. float m_CurrentRed;
  95. float m_CurrentGreen;
  96. float m_CurrentBlue;
  97. ColorBarClass * m_CurrentColorBar;
  98. ColorBarClass * m_OrigColorBar;
  99. ColorBarClass * m_RedColorBar;
  100. ColorBarClass * m_GreenColorBar;
  101. ColorBarClass * m_BlueColorBar;
  102. ColorBarClass * m_WhitenessColorBar;
  103. ColorPickerClass *m_HuePicker;
  104. bool m_bDeleteOnClose;
  105. // Callback function when color is updated.
  106. WWCTRL_COLORCALLBACK m_UpdateCallback;
  107. void * m_CallArg;
  108. };
  109. //{{AFX_INSERT_LOCATION}}
  110. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  111. #endif // !defined(AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)