/////////////////////////////////////////////////////////////////////////////
// Name: slider.h
// Purpose: wxSlider class
-// Author: AUTHOR
+// Author: David Webster
// Modified by:
-// Created: ??/??/98
+// Created: 10/15/99
// RCS-ID: $Id$
-// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Copyright: (c) David Webster
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SLIDER_H_
#define _WX_SLIDER_H_
-#ifdef __GNUG__
-#pragma interface "slider.h"
-#endif
-
#include "wx/control.h"
-WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
-
// Slider
-class WXDLLEXPORT wxSlider: public wxControl
+class WXDLLEXPORT wxSlider: public wxSliderBase
{
- DECLARE_DYNAMIC_CLASS(wxSlider)
-
public:
wxSlider();
+ inline wxSlider( wxWindow* pParent
+ ,wxWindowID vId
+ ,int nValue
+ ,int nMinValue
+ ,int nMaxValue
+ ,const wxPoint& rPos = wxDefaultPosition
+ ,const wxSize& rSize = wxDefaultSize
+ ,long lStyle = wxSL_HORIZONTAL
+#if wxUSE_VALIDATORS
+ ,const wxValidator& rValidator = wxDefaultValidator
+#endif
+ ,const wxString& rsName = wxSliderNameStr
+ )
+ {
+ Create( pParent
+ ,vId
+ ,nValue
+ ,nMinValue
+ ,nMaxValue
+ ,rPos
+ ,rSize
+ ,lStyle
+#if wxUSE_VALIDATORS
+ ,rValidator
+#endif
+ ,rsName
+ );
+ }
+ ~wxSlider();
+
+ bool Create( wxWindow* pParent
+ ,wxWindowID vId
+ ,int nValue
+ ,int nMinValue
+ ,int nMaxValue
+ ,const wxPoint& rPos = wxDefaultPosition
+ ,const wxSize& rSize = wxDefaultSize
+ ,long lStyle = wxSL_HORIZONTAL
+#if wxUSE_VALIDATORS
+ ,const wxValidator& rValidator = wxDefaultValidator
+#endif
+ ,const wxString& rsName = wxSliderNameStr
+ );
+
+ virtual int GetValue(void) const ;
+ virtual void SetValue(int);
- inline wxSlider(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr)
- {
- Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
- }
+ void GetSize( int* pnX
+ ,int* pnY
+ ) const;
+ void GetPosition( int* pnX
+ ,int* pnY
+ ) const ;
+ bool Show(bool bShow = TRUE);
+ void SetRange( int nMinValue
+ ,int nMaxValue
+ );
- ~wxSlider();
+ inline int GetMin(void) const { return m_nRangeMin; }
+ inline int GetMax(void) const { return m_nRangeMax; }
- bool Create(wxWindow *parent, wxWindowID id,
- int value, int minValue, int maxValue,
- const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize,
- long style = wxSL_HORIZONTAL,
- const wxValidator& validator = wxDefaultValidator,
- const wxString& name = wxSliderNameStr);
+ //
+ // For trackbars only
+ //
+ void ClearSel(void);
+ void ClearTicks(void);
- virtual int GetValue() const ;
- virtual void SetValue(int);
- void GetSize(int *x, int *y) const ;
- void SetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO);
- void GetPosition(int *x, int *y) const ;
- bool Show(bool show);
+ int GetLineSize(void) const;
+ int GetPageSize(void) const ;
+ int GetSelEnd(void) const;
+ int GetSelStart(void) const;
+ inline int GetTickFreq(void) const { return m_nTickFreq; }
+ int GetThumbLength(void) const ;
- void SetRange(int minValue, int maxValue);
+ void SetLineSize(int nLineSize);
+ void SetPageSize(int nPageSize);
+ void SetSelection( int nMinPos
+ ,int nMaxPos
+ );
+ void SetThumbLength(int nLen) ;
+ void SetTick(int ntickPos) ;
+ void SetTickFreq( int n
+ ,int nPos
+ );
- inline int GetMin() const { return m_rangeMin; }
- inline int GetMax() const { return m_rangeMax; }
+ //
+ // IMPLEMENTATION
+ //
+ inline WXHWND GetStaticMin(void) const { return m_hStaticMin; }
+ inline WXHWND GetStaticMax(void) const { return m_hStaticMax; }
+ inline WXHWND GetEditValue(void) const { return m_hStaticValue; }
+ virtual bool ContainsHWND(WXHWND hWnd) const;
+ void AdjustSubControls( int nX
+ ,int nY
+ ,int nWidth
+ ,int nHeight
+ ,int nSizeFlags
+ );
+ inline int GetSizeFlags(void) { return m_nSizeFlags; }
+ void Command(wxCommandEvent& rEvent);
+ virtual WXHBRUSH OnCtlColor( WXHDC hDC
+ ,WXHWND hWnd
+ ,WXUINT uCtlColor
+ ,WXUINT uMessage
+ ,WXWPARAM wParam
+ ,WXLPARAM lParam
+ );
+ virtual bool OS2OnScroll( int nOrientation
+ ,WXWORD wParam
+ ,WXWORD wPos
+ ,WXHWND hControl
+ );
- // For trackbars only
- void SetTickFreq(int n, int pos);
- inline int GetTickFreq() const { return m_tickFreq; }
- void SetPageSize(int pageSize);
- int GetPageSize() const ;
- void ClearSel() ;
- void ClearTicks() ;
- void SetLineSize(int lineSize);
- int GetLineSize() const ;
- int GetSelEnd() const ;
- int GetSelStart() const ;
- void SetSelection(int minPos, int maxPos);
- void SetThumbLength(int len) ;
- int GetThumbLength() const ;
- void SetTick(int tickPos) ;
+protected:
+ WXHWND m_hStaticMin;
+ WXHWND m_hStaticMax;
+ WXHWND m_hStaticValue;
+ int m_nRangeMin;
+ int m_nRangeMax;
+ int m_nPageSize;
+ int m_nLineSize;
+ int m_nTickFreq;
+ double m_dPixelToRange;
+ int m_nThumbLength;
+ int m_nSizeFlags;
- void Command(wxCommandEvent& event);
- protected:
- int m_rangeMin;
- int m_rangeMax;
- int m_pageSize;
- int m_lineSize;
- int m_tickFreq;
-DECLARE_EVENT_TABLE()
+ virtual void DoGetSize( int* pnWidth
+ ,int* pnHeight
+ ) const;
+ virtual void DoSetSize( int nX
+ ,int nY
+ ,int nWidth
+ ,int nHeight
+ ,int nSizeFlags = wxSIZE_AUTO
+ );
private:
- void SetSize(int width, int height) {wxWindow::SetSize(width, height);}
-};
+ DECLARE_DYNAMIC_CLASS(wxSlider)
+}; // end of CLASS wxSlider
#endif
// _WX_SLIDER_H_