1/////////////////////////////////////////////////////////////////////////////
2// Name:        slider.h
3// Purpose:     wxSlider class
4// Author:      David Webster
5// Modified by:
6// Created:     10/15/99
7// RCS-ID:      $Id: slider.h 41020 2006-09-05 20:47:48Z VZ $
8// Copyright:   (c) David Webster
9// Licence:     wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_SLIDER_H_
13#define _WX_SLIDER_H_
14
15#include "wx/control.h"
16
17// Slider
18class WXDLLEXPORT wxSlider: public wxSliderBase
19{
20public:
21  wxSlider();
22  inline wxSlider( wxWindow*          pParent
23                  ,wxWindowID         vId
24                  ,int                nValue
25                  ,int                nMinValue
26                  ,int                nMaxValue
27                  ,const wxPoint&     rPos = wxDefaultPosition
28                  ,const wxSize&      rSize = wxDefaultSize
29                  ,long               lStyle = wxSL_HORIZONTAL
30                  ,const wxValidator& rValidator = wxDefaultValidator
31                  ,const wxString&    rsName = wxSliderNameStr
32                 )
33    {
34        Create( pParent
35               ,vId
36               ,nValue
37               ,nMinValue
38               ,nMaxValue
39               ,rPos
40               ,rSize
41               ,lStyle
42               ,rValidator
43               ,rsName
44              );
45    }
46    virtual ~wxSlider();
47
48    bool Create( wxWindow*          pParent
49                ,wxWindowID         vId
50                ,int                nValue
51                ,int                nMinValue
52                ,int                nMaxValue
53                ,const wxPoint&     rPos = wxDefaultPosition
54                ,const wxSize&      rSize = wxDefaultSize
55                ,long               lStyle = wxSL_HORIZONTAL
56                ,const wxValidator& rValidator = wxDefaultValidator
57                ,const wxString&    rsName = wxSliderNameStr
58               );
59
60         virtual int  GetValue(void) const ;
61         virtual void SetValue(int);
62
63                 void GetSize( int* pnX
64                              ,int* pnY
65                             ) const;
66                 void GetPosition( int* pnX
67                                  ,int* pnY
68                                 ) const ;
69                 bool Show(bool bShow = TRUE);
70                 void SetRange( int nMinValue
71                               ,int nMaxValue
72                              );
73
74    inline       int  GetMin(void) const { return m_nRangeMin; }
75    inline       int  GetMax(void) const { return m_nRangeMax; }
76
77    //
78    // For trackbars only
79    //
80                 void ClearSel(void);
81                 void ClearTicks(void);
82
83                 int  GetLineSize(void) const;
84                 int  GetPageSize(void) const ;
85                 int  GetSelEnd(void) const;
86                 int  GetSelStart(void) const;
87    inline       int  GetTickFreq(void) const { return m_nTickFreq; }
88                 int  GetThumbLength(void) const ;
89
90                 void SetLineSize(int nLineSize);
91                 void SetPageSize(int nPageSize);
92                 void SetSelection( int nMinPos
93                                   ,int nMaxPos
94                                  );
95                 void SetThumbLength(int nLen) ;
96                 void SetTick(int ntickPos) ;
97                 void SetTickFreq( int n
98                                  ,int nPos
99                                 );
100
101    //
102    // IMPLEMENTATION
103    //
104    inline         WXHWND   GetStaticMin(void) const { return m_hStaticMin; }
105    inline         WXHWND   GetStaticMax(void) const { return m_hStaticMax; }
106    inline         WXHWND   GetEditValue(void) const { return m_hStaticValue; }
107           virtual bool     ContainsHWND(WXHWND hWnd) const;
108                   void     AdjustSubControls( int  nX
109                                              ,int  nY
110                                              ,int  nWidth
111                                              ,int  nHeight
112                                              ,int  nSizeFlags
113                                             );
114    inline         int      GetSizeFlags(void) { return m_nSizeFlags; }
115                   void     Command(wxCommandEvent& rEvent);
116           virtual WXHBRUSH OnCtlColor( WXHDC    hDC
117                                       ,WXHWND   hWnd
118                                       ,WXUINT   uCtlColor
119                                       ,WXUINT   uMessage
120                                       ,WXWPARAM wParam
121                                       ,WXLPARAM lParam
122                                      );
123           virtual bool     OS2OnScroll( int    nOrientation
124                                        ,WXWORD wParam
125                                        ,WXWORD wPos
126                                        ,WXHWND hControl
127                                       );
128
129protected:
130    WXHWND                          m_hStaticMin;
131    WXHWND                          m_hStaticMax;
132    WXHWND                          m_hStaticValue;
133    int                             m_nRangeMin;
134    int                             m_nRangeMax;
135    int                             m_nPageSize;
136    int                             m_nLineSize;
137    int                             m_nTickFreq;
138    double                          m_dPixelToRange;
139    int                             m_nThumbLength;
140    int                             m_nSizeFlags;
141
142    virtual void DoGetSize( int* pnWidth
143                           ,int* pnHeight
144                          ) const;
145    virtual void DoSetSize( int  nX
146                           ,int  nY
147                           ,int  nWidth
148                           ,int  nHeight
149                           ,int  nSizeFlags = wxSIZE_AUTO
150                          );
151private:
152    DECLARE_DYNAMIC_CLASS(wxSlider)
153}; // end of CLASS wxSlider
154
155#endif
156    // _WX_SLIDER_H_
157