scrolbar.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/scrolbar.h
  3. // Purpose: wxScrollBar class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_SCROLBAR_H_
  11. #define _WX_SCROLBAR_H_
  12. // Scrollbar item
  13. class WXDLLIMPEXP_CORE wxScrollBar: public wxScrollBarBase
  14. {
  15. public:
  16. wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
  17. virtual ~wxScrollBar();
  18. wxScrollBar(wxWindow *parent, wxWindowID id,
  19. const wxPoint& pos = wxDefaultPosition,
  20. const wxSize& size = wxDefaultSize,
  21. long style = wxSB_HORIZONTAL,
  22. const wxValidator& validator = wxDefaultValidator,
  23. const wxString& name = wxScrollBarNameStr)
  24. {
  25. Create(parent, id, pos, size, style, validator, name);
  26. }
  27. bool Create(wxWindow *parent, wxWindowID id,
  28. const wxPoint& pos = wxDefaultPosition,
  29. const wxSize& size = wxDefaultSize,
  30. long style = wxSB_HORIZONTAL,
  31. const wxValidator& validator = wxDefaultValidator,
  32. const wxString& name = wxScrollBarNameStr);
  33. int GetThumbPosition() const ;
  34. int GetThumbSize() const { return m_pageSize; }
  35. int GetPageSize() const { return m_viewSize; }
  36. int GetRange() const { return m_objectSize; }
  37. virtual void SetThumbPosition(int viewStart);
  38. virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
  39. bool refresh = true);
  40. // needed for RTTI
  41. void SetThumbSize( int s ) { SetScrollbar( GetThumbPosition() , s , GetRange() , GetPageSize() , true ) ; }
  42. void SetPageSize( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , GetRange() , s , true ) ; }
  43. void SetRange( int s ) { SetScrollbar( GetThumbPosition() , GetThumbSize() , s , GetPageSize() , true ) ; }
  44. void Command(wxCommandEvent& event);
  45. virtual bool MSWOnScroll(int orientation, WXWORD wParam,
  46. WXWORD pos, WXHWND control);
  47. // override wxControl version to not use solid background here
  48. virtual WXHBRUSH MSWControlColor(WXHDC pDC, WXHWND hWnd);
  49. virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
  50. // returns true if the platform should explicitly apply a theme border
  51. virtual bool CanApplyThemeBorder() const { return false; }
  52. protected:
  53. virtual wxSize DoGetBestSize() const;
  54. int m_pageSize;
  55. int m_viewSize;
  56. int m_objectSize;
  57. DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrollBar)
  58. };
  59. #endif
  60. // _WX_SCROLBAR_H_