scrolbar.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/scrolbar.h
  3. // Purpose: wxScrollBar base header
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created:
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_SCROLBAR_H_BASE_
  11. #define _WX_SCROLBAR_H_BASE_
  12. #include "wx/defs.h"
  13. #if wxUSE_SCROLLBAR
  14. #include "wx/control.h"
  15. extern WXDLLIMPEXP_DATA_CORE(const char) wxScrollBarNameStr[];
  16. // ----------------------------------------------------------------------------
  17. // wxScrollBar: a scroll bar control
  18. // ----------------------------------------------------------------------------
  19. class WXDLLIMPEXP_CORE wxScrollBarBase : public wxControl
  20. {
  21. public:
  22. wxScrollBarBase() { }
  23. /*
  24. Derived classes should provide the following method and ctor with the
  25. same parameters:
  26. bool Create(wxWindow *parent,
  27. 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. */
  34. // accessors
  35. virtual int GetThumbPosition() const = 0;
  36. virtual int GetThumbSize() const = 0;
  37. virtual int GetPageSize() const = 0;
  38. virtual int GetRange() const = 0;
  39. bool IsVertical() const { return (m_windowStyle & wxVERTICAL) != 0; }
  40. // operations
  41. virtual void SetThumbPosition(int viewStart) = 0;
  42. virtual void SetScrollbar(int position, int thumbSize,
  43. int range, int pageSize,
  44. bool refresh = true) = 0;
  45. // implementation-only
  46. bool IsNeeded() const { return GetRange() > GetThumbSize(); }
  47. private:
  48. wxDECLARE_NO_COPY_CLASS(wxScrollBarBase);
  49. };
  50. #if defined(__WXUNIVERSAL__)
  51. #include "wx/univ/scrolbar.h"
  52. #elif defined(__WXMSW__)
  53. #include "wx/msw/scrolbar.h"
  54. #elif defined(__WXMOTIF__)
  55. #include "wx/motif/scrolbar.h"
  56. #elif defined(__WXGTK20__)
  57. #include "wx/gtk/scrolbar.h"
  58. #elif defined(__WXGTK__)
  59. #include "wx/gtk1/scrolbar.h"
  60. #elif defined(__WXMAC__)
  61. #include "wx/osx/scrolbar.h"
  62. #elif defined(__WXCOCOA__)
  63. #include "wx/cocoa/scrolbar.h"
  64. #elif defined(__WXPM__)
  65. #include "wx/os2/scrolbar.h"
  66. #endif
  67. #endif // wxUSE_SCROLLBAR
  68. #endif
  69. // _WX_SCROLBAR_H_BASE_