[Wgui-cvs] wgui/includes wg_range_control.h,1.1,1.2 wg_scrollbar.h,1.21,1.22
Status: Beta
Brought to you by:
greenwire
|
From: Rob W. <gre...@us...> - 2004-04-27 18:13:59
|
Update of /cvsroot/wgui/wgui/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29743/includes Modified Files: wg_range_control.h wg_scrollbar.h Log Message: Changed CScrollBar so it inherits from CRangeControl Index: wg_scrollbar.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_scrollbar.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** wg_scrollbar.h 6 Apr 2004 20:47:43 -0000 1.21 --- wg_scrollbar.h 27 Apr 2004 18:13:50 -0000 1.22 *************** *** 26,30 **** #define _WG_SCROLLBAR_H_ ! #include "wg_window.h" #include "wg_painter.h" #include "wg_button.h" --- 26,30 ---- #define _WG_SCROLLBAR_H_ ! #include "wg_range_control.h" #include "wg_painter.h" #include "wg_button.h" *************** *** 36,40 **** //! A scroll bar ! class CScrollBar : public CWindow { public: --- 36,40 ---- //! A scroll bar ! class CScrollBar : public CRangeControl<int> { public: *************** *** 55,79 **** virtual ~CScrollBar(void); - //! Set the limits of the scroll bar - void SetLimits(int Min, int Max); - - //! \return The minimum limit of the scroll bar - int GetMinLimit(void) { return m_iMin; } - - //! \return The maximum limit of the scroll bar - int GetMaxLimit(void) { return m_iMax; } - - //! Set the current thumb position - void SetPosition(int iPosition); - - //! \return The current progress value - int GetPosition(void) { return m_iPosition; } - //! Set the amount to jump by when the area below or above the thumb is clicked (this is 5 by default) //! \param iJumpAmount The amount to step by ! void SetJumpAmount(int iJumpAmount) { m_iJumpAmount = iJumpAmount; } //! \return The amount the scrollbar jumps by when clicked above or below the thumb ! int GetJumpAmount(void) { return m_iJumpAmount; } --- 55,71 ---- virtual ~CScrollBar(void); //! Set the amount to jump by when the area below or above the thumb is clicked (this is 5 by default) //! \param iJumpAmount The amount to step by ! virtual void SetJumpAmount(int iJumpAmount) { m_iJumpAmount = iJumpAmount; } //! \return The amount the scrollbar jumps by when clicked above or below the thumb ! virtual int GetJumpAmount(void) const { return m_iJumpAmount; } ! ! ! // CRangeControl overrides ! //! Set the current value. ! //! \param value The new value for the control ! //! \param bRedraw indicates if the control should be redrawn (defaults to true) ! virtual void SetValue(int iValue, bool bRedraw = true); *************** *** 104,112 **** ! private: EScrollBarType m_ScrollBarType; //!< The type of scroll bar - int m_iMin; //!< The minimum value of the scroll bar - int m_iMax; //!< The maximum value of the scroll bar - int m_iPosition; //!< The current position of the scroll bar thumb int m_iJumpAmount; //!< The amount to jump when the area below or above the thumb is clicked CPictureButton* m_pBtnUpLeft; //!< A pointer to the Up or Left button --- 96,104 ---- ! protected: ! //! Repositions the thumb according to the value ! virtual void RepositionThumb(void); ! EScrollBarType m_ScrollBarType; //!< The type of scroll bar int m_iJumpAmount; //!< The amount to jump when the area below or above the thumb is clicked CPictureButton* m_pBtnUpLeft; //!< A pointer to the Up or Left button Index: wg_range_control.h =================================================================== RCS file: /cvsroot/wgui/wgui/includes/wg_range_control.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wg_range_control.h 26 Apr 2004 22:38:00 -0000 1.1 --- wg_range_control.h 27 Apr 2004 18:13:50 -0000 1.2 *************** *** 32,36 **** { ! //! An abstract class that handles all the basics of a control that uses a value that is constrained to a certain range //! Sends a CTRL_VALUECHANGE message whenever the value changes --- 32,36 ---- { ! //! A template class that handles all the basics of a control that uses a value that is constrained to a certain range //! Sends a CTRL_VALUECHANGE message whenever the value changes *************** *** 50,84 **** //! Set the lower limit for the control ! void SetMinLimit(T minLimit) { m_MinLimit = minLimit; } //! \return The minimum limit of the progress bar ! T GetMinLimit(void) const { return m_MinLimit; } //! Set the upper limit for the control ! void SetMaxLimit(T maxLimit) { m_MaxLimit = maxLimit; } //! \return The maximum limit of the progress bar ! T GetMaxLimit(void) const { return m_MaxLimit; } //! Set the current steo size. ! void SetStepSize(T stepSize); //! \return The current step size ! T GetStepSize(void) const { return m_StepSize; } //! Set the current value. ! void SetValue(T value); //! \return The current value ! T GetValue(void) const { return m_Value; } //! Increase the value by one step size ! void Increment(void); //! Decrease the value by one step size ! void Decrement(void); ! private: T m_MinLimit; //!< The minimum value of the control T m_MaxLimit; //!< The maximum value of the control --- 50,116 ---- //! Set the lower limit for the control ! //! \param minLimit The lower limit of the control ! virtual void SetMinLimit(T minLimit) { m_MinLimit = minLimit; } //! \return The minimum limit of the progress bar ! virtual T GetMinLimit(void) const { return m_MinLimit; } //! Set the upper limit for the control ! //! \param maxLimit The upper limit of the control ! virtual void SetMaxLimit(T maxLimit) { m_MaxLimit = maxLimit; } //! \return The maximum limit of the progress bar ! virtual T GetMaxLimit(void) const { return m_MaxLimit; } //! Set the current steo size. ! //! \param stepSize The amount to increment the value by for Increment() and Decrement() calls ! virtual void SetStepSize(T stepSize) { m_StepSize = stepSize; } //! \return The current step size ! virtual T GetStepSize(void) const { return m_StepSize; } //! Set the current value. ! //! \param value The new value for the control ! //! \param bRedraw indicates if the control should be redrawn (defaults to true) ! virtual void SetValue(T value, bool bRedraw = true) ! { ! m_Value = ConstrainValue(value); ! CMessageServer::Instance().QueueMessage(new CValueMessage<T>(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, m_Value)); ! ! if (bRedraw) ! { ! StartDrawProc(); ! } ! } //! \return The current value ! virtual T GetValue(void) const { return m_Value; } //! Increase the value by one step size ! //! \param bRedraw indicates if the control should be redrawn (defaults to true) ! virtual void Increment(bool bRedraw = true) { SetValue(m_Value + m_StepSize, bRedraw); } //! Decrease the value by one step size ! //! \param bRedraw indicates if the control should be redrawn (defaults to true) ! virtual void Decrement(bool bRedraw = true) { SetValue(m_Value - m_StepSize, bRedraw); } ! ! //! takes the value and makes sure it's in it's limits ! //! \param value The value to be checked ! //! \return The closest value that's within the limits ! virtual T ConstrainValue(T value) const ! { ! if (value < m_MinLimit) ! { ! value = m_MinLimit; ! } ! if (value > m_MaxLimit) ! { ! value = m_MaxLimit; ! } ! return value; ! } ! protected: T m_MinLimit; //!< The minimum value of the control T m_MaxLimit; //!< The maximum value of the control |