00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _RM_MFC_UTILITIES_POPUP_SLIDER_H_
00014 #define _RM_MFC_UTILITIES_POPUP_SLIDER_H_
00015
00016 #include <MFCUtilities/RmMFCTypes.h>
00017
00018
00019 #define MSG_SLIDER_UPDATE WM_USER + 1201 // When the slider's position has changed
00020 #define MSG_SLIDER_CLOSED WM_USER + 1202 // When the slider's been closed
00021 #define MSG_SLIDER_RANGE_CHANGED WM_USER + 1203 // When the slider range was modifying
00022
00023 class RMMFCUTIL_API CPopupSlider: public CWnd
00024 {
00025
00026 public:
00027
00028
00029
00030
00031
00032 CPopupSlider( CPoint p, float fValue, float fMin, float fMax, bool bClamp, CWnd* pParentWnd, bool bDynamicRange = true );
00033
00034 BOOL Create( CPoint p, CWnd* pParentWnd );
00035
00036
00037 void EndPopupSlider( int nMessage = MSG_SLIDER_CLOSED );
00038
00039
00040 float GetSliderValue()
00041 {
00042 return m_fValue;
00043 }
00044
00045
00046 void GetSliderRange( float* pfMin, float* pfMax )
00047 {
00048 (*pfMin) = m_fMin;
00049 (*pfMax) = m_fMax;
00050 }
00051
00052
00053 protected:
00054
00055
00056 void ComputeSliderPosition();
00057
00058
00059
00060 void DrawSlider();
00061
00062
00063 void UpdateSliderWindow();
00064
00065
00066
00067 void UpdateSliderValue( CPoint mousePt );
00068
00069
00070
00071
00072 void UpdateSliderRange( CPoint mousePt );
00073
00074
00075
00076 protected:
00077
00078 afx_msg BOOL OnEraseBackground( CDC* pDC );
00079 afx_msg void OnNcDestroy();
00080 afx_msg void OnPaint();
00081 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00082 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00083 afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
00084 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00085 afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
00086 afx_msg void OnKillFocus(CWnd* pNewWnd);
00087 afx_msg BOOL OnMouseWheel( UINT nFlags, short zDelta, CPoint pt );
00088 afx_msg void OnCaptureChanged(CWnd *pWnd);
00089
00090
00091 #if _MFC_VER < 0x0700
00092 afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
00093 #else
00094 afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
00095 #endif
00096
00097
00098 DECLARE_MESSAGE_MAP()
00099
00100 private:
00101 CPopupSlider() {};
00102
00103 private:
00104
00105 CWnd* m_pParent;
00106
00107 bool m_bClosingSlider;
00108
00109 float m_fSliderPosition;
00110
00111 float m_fValue;
00112
00113 float m_fMin;
00114 float m_fMax;
00115 bool m_bClamp;
00116
00117 HCURSOR m_mouseCursor;
00118
00119 bool m_bDynamicRange;
00120 bool m_bRButtonDown;
00121
00122 float m_fStepSize;
00123
00124 int m_nOldPosition;
00125 CPoint m_oldPoint;
00126
00127
00128 };
00129
00130 #endif