ColorPickerDialogClass.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 "colorutils.h"
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Forward declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. class ColorBarClass;
  31. class ColorPickerClass;
  32. /////////////////////////////////////////////////////////////////////////////
  33. //
  34. // ColorPickerDialogClass dialog
  35. //
  36. class ColorPickerDialogClass : public CDialog
  37. {
  38. // Construction
  39. public:
  40. ColorPickerDialogClass (int red, int green, int blue, CWnd* pParent = NULL, UINT res_id = ColorPickerDialogClass::IDD);
  41. // Dialog Data
  42. //{{AFX_DATA(ColorPickerDialogClass)
  43. enum { IDD = IDD_COLOR_PICKER };
  44. CSpinButtonCtrl m_BlueSpin;
  45. CSpinButtonCtrl m_GreenSpin;
  46. CSpinButtonCtrl m_RedSpin;
  47. //}}AFX_DATA
  48. // Overrides
  49. // ClassWizard generated virtual function overrides
  50. //{{AFX_VIRTUAL(ColorPickerDialogClass)
  51. protected:
  52. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  53. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  54. virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  55. virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  56. virtual void PostNcDestroy();
  57. //}}AFX_VIRTUAL
  58. // Implementation
  59. protected:
  60. // Generated message map functions
  61. //{{AFX_MSG(ColorPickerDialogClass)
  62. virtual BOOL OnInitDialog();
  63. afx_msg void OnReset();
  64. //}}AFX_MSG
  65. DECLARE_MESSAGE_MAP()
  66. public:
  67. /////////////////////////////////////////////////////////////
  68. // Public methods
  69. /////////////////////////////////////////////////////////////
  70. int Get_Red (void) const { return (int)m_CurrentRed; }
  71. int Get_Green (void) const { return (int)m_CurrentGreen; }
  72. int Get_Blue (void) const { return (int)m_CurrentBlue; }
  73. void Set_Color (int r, int g, int b)
  74. { Update_Color((float)r, (float)g, (float)b); }
  75. void Set_Original_Color (int r, int g, int b);
  76. void Create_Form (CWnd *parent);
  77. void Set_Update_Callback (WWCTRL_COLORCALLBACK callme, void *arg)
  78. { m_UpdateCallback = callme; m_CallArg = arg; }
  79. protected:
  80. /////////////////////////////////////////////////////////////
  81. // Protected methods
  82. /////////////////////////////////////////////////////////////
  83. void Update_Red_Bar (void);
  84. void Update_Green_Bar (void);
  85. void Update_Blue_Bar (void);
  86. void Update_Current_Color_Bar (void);
  87. void Update_Whiteness_Bar (void);
  88. void Update_Color (float red, float green, float blue, DWORD flags = 0xFFFFFFFF);
  89. private:
  90. /////////////////////////////////////////////////////////////
  91. // Private member data
  92. /////////////////////////////////////////////////////////////
  93. float m_OrigRed;
  94. float m_OrigGreen;
  95. float m_OrigBlue;
  96. float m_CurrentRed;
  97. float m_CurrentGreen;
  98. float m_CurrentBlue;
  99. ColorBarClass * m_CurrentColorBar;
  100. ColorBarClass * m_OrigColorBar;
  101. ColorBarClass * m_RedColorBar;
  102. ColorBarClass * m_GreenColorBar;
  103. ColorBarClass * m_BlueColorBar;
  104. ColorBarClass * m_WhitenessColorBar;
  105. ColorPickerClass *m_HuePicker;
  106. bool m_bDeleteOnClose;
  107. // Callback function when color is updated.
  108. WWCTRL_COLORCALLBACK m_UpdateCallback;
  109. void * m_CallArg;
  110. };
  111. //{{AFX_INSERT_LOCATION}}
  112. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  113. #endif // !defined(AFX_COLORPICKERDIALOGCLASS_H__C943A7F1_CAA3_11D2_8DDF_00104B6FD9E3__INCLUDED_)