00001 // University of Washington Bothell Graphics Library 00002 // Authors: Kelvin Sung, Steve Baer 00003 // The accompanying library supports CSS Graphics courses taught at UW-Bothell 00004 // See: http://courses.washington.edu/css450/ 00005 // http://courses.washington.edu/css451/ 00007 #pragma once 00008 00015 class CSliderCtrlWithEcho : public CSliderCtrl 00016 { 00019 DECLARE_DYNAMIC(CSliderCtrlWithEcho) 00020 00021 public: 00022 CSliderCtrlWithEcho(); 00023 virtual ~CSliderCtrlWithEcho(); 00024 00029 void Initialize(float min, float max, float init); 00030 00035 bool SetSliderValue(float userValue); 00036 00039 float GetSliderValue(); 00040 00041 protected: 00044 int ConvertUserValueToSliderPosition(float userValue) const; 00045 00048 float ConvertSliderPositionToUserValue( int position ) const; 00049 00052 void UpdateSliderEcho(); 00053 00057 DECLARE_MESSAGE_MAP() 00058 00059 00060 00061 00062 afx_msg void HScroll(UINT nSBCode, UINT nPos); 00063 00067 afx_msg void VScroll(UINT nSBCode, UINT nPos); 00068 00073 afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); 00074 00075 protected: 00079 static const int SLIDER_RESOLUTION = 100000; 00080 00083 float m_minimum_value; 00084 00087 float m_value_range; 00088 00092 CStatic m_MessageWnd; 00093 00096 bool IsOrientedVertical() const; 00097 00098 // Override the OnScroll function if you want to perform an operation when this control 00099 // is scrolled 00100 virtual void OnScroll(float new_value); 00101 };