00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _RM_MFC_UTILITIES_COLOR_PICKER_WND_H_
00014 #define _RM_MFC_UTILITIES_COLOR_PICKER_WND_H_
00015
00016 #if _MSC_VER > 1000
00017 #pragma once
00018 #endif // _MSC_VER > 1000
00019
00020 #include <Utilities/RmUtilControlPlacement.h>
00021 #include <MFCUtilities/RmMFCTypes.h>
00022 #include <MFCUtilities/RmMFCNumericEdit.h>
00023 #include <MFCUtilities/RmMFCColorSlider.h>
00024 #include <MFCUtilities/RmMFCColorWheel.h>
00025 #include <MFCUtilities/RmMFCUtilitiesResource.h>
00026
00027
00028
00029
00030
00031
00032 class RMMFCUTIL_API CRmColorPickerCtrl : public CDialog
00033 {
00034 public:
00035
00036 typedef enum
00037 {
00038 COLOR_PICKER_TYPE_RGB,
00039 COLOR_PICKER_TYPE_HSV
00040
00041 } RmColorPickerCtrlType;
00042
00043 protected:
00044
00045
00046
00047
00048
00049
00050
00051
00052 class CRmColorButton : public CButton
00053 {
00054 public:
00055
00056 CRmColorButton()
00057 {
00058 m_bCheck = false;
00059 m_fColorArray = NULL;
00060
00061 }
00062
00063 virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );
00064
00065 virtual bool GetCheck() { return( m_bCheck ); }
00066 virtual void SetCheck( bool bCheck ) { m_bCheck = bCheck; }
00067 virtual void SetColorArray( float *fColorArray ) { m_fColorArray = fColorArray; }
00068
00069 protected:
00070
00071 bool m_bCheck;
00072 float *m_fColorArray;
00073
00074 };
00075
00076 public:
00077
00078
00079 CRmColorPickerCtrl();
00080 virtual ~CRmColorPickerCtrl();
00081
00082 BOOL Create( HWND hwndParent,
00083 RECT *pRect = NULL,
00084 float *pColorData = NULL,
00085 COLORREF *pColorRef = NULL,
00086 RmNode *pRmNode = NULL,
00087 RmPlugInID *pRmPlugInID = NULL,
00088 bool bInitialFloatingPoint = false,
00089 int nInitialColorType = COLOR_PICKER_TYPE_RGB,
00090 bool bLargeSize = true,
00091 bool bLogChanges = true );
00092
00093 bool GetIsLargeSize() { return( m_bLargeSize ); }
00094
00095
00096 enum { IDD = IDD_RM_COLOR_PICKER_WINDOW };
00097 CButton m_chkFloatingPoint;
00098 CRmColorButton m_btnColor;
00099 CRmNumericEdit m_edit4;
00100 CRmNumericEdit m_edit3;
00101 CRmNumericEdit m_edit2;
00102 CRmNumericEdit m_edit1;
00103 CStatic m_static4;
00104 CStatic m_static3;
00105 CStatic m_static2;
00106 CStatic m_static1;
00107 CComboBox m_colorTypeCombo;
00108 CRmColorSlider m_colorSlider5;
00109 CRmColorSlider m_colorSlider4;
00110 CRmColorSlider m_colorSlider3;
00111 CRmColorSlider m_colorSlider2;
00112 CRmColorSlider m_colorSlider1;
00113 CRmColorWheel m_colorWheel;
00114
00115
00116
00117
00118 protected:
00119 virtual void DoDataExchange(CDataExchange* pDX);
00120 virtual BOOL OnInitDialog();
00121 virtual BOOL PreTranslateMessage(MSG* pMsg);
00122 virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
00123
00124
00125 protected:
00126
00127 void UpdateControls( HWND hWnd );
00128 void UpdateTextControls();
00129 void UpdateCtrlSize( bool bNotifyParent );
00130
00131
00132
00133 afx_msg void OnSelchangeColorTypeCombo();
00134 afx_msg void OnKillfocusEdit1();
00135 afx_msg void OnKillfocusEdit2();
00136 afx_msg void OnKillfocusEdit3();
00137 afx_msg void OnKillfocusEdit4();
00138 afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
00139 afx_msg void OnFloatingPointCheck();
00140 afx_msg void OnSize(UINT nType, int cx, int cy);
00141 afx_msg void OnBnClickedRmColorButton();
00142 afx_msg void OnGetMinMaxInfo(MINMAXINFO* lpMMI);
00143 afx_msg LRESULT OnColorChanged( WPARAM wParam, LPARAM lParam );
00144 afx_msg LRESULT OnValueChanged( WPARAM wParam, LPARAM lParam );
00145 afx_msg LRESULT OnValueChangeStart( WPARAM wParam, LPARAM lParam );
00146 afx_msg LRESULT OnValueChangeEnd( WPARAM wParam, LPARAM lParam );
00147
00148
00149
00150 DECLARE_MESSAGE_MAP()
00151
00152 private:
00153
00154 RmNode *m_pRmNode;
00155 RmPlugInID *m_pRmPlugInID;
00156 HWND m_hwndParent;
00157 bool m_bLogChanges;
00158
00159 float *m_pColorData;
00160 COLORREF *m_pColorRef;
00161 HBRUSH m_hColorBrush;
00162
00163 float m_fColorArray[ 3 ];
00164 float m_fAlpha;
00165
00166 float m_fHue;
00167 float m_fSaturation;
00168 float m_fValue;
00169
00170 float m_fStandardColorMultiplier;
00171 int m_nNumericPrecesion;
00172
00173 RmControlPlacementContainer m_colorControlPlacementContainerBig;
00174 RmControlPlacementContainer m_colorControlPlacementContainerSmall;
00175
00176 bool m_bInternalResize;
00177 bool m_bInitialized;
00178 CRect m_largeClientRect;
00179 CRect m_smallClientRect;
00180
00181 protected:
00182
00183 bool m_bInitialFloatingPoint;
00184 int m_nInitialColorType;
00185 bool m_bLargeSize;
00186
00187 CToolTipCtrl m_toolTipCtrl;
00188
00189 };
00190
00191 #endif