slider.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/slider.h
  3. // Purpose:
  4. // Author: Robert Roebling
  5. // Copyright: (c) 1998 Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_GTK_SLIDER_H_
  9. #define _WX_GTK_SLIDER_H_
  10. // ----------------------------------------------------------------------------
  11. // wxSlider
  12. // ----------------------------------------------------------------------------
  13. class WXDLLIMPEXP_CORE wxSlider : public wxSliderBase
  14. {
  15. public:
  16. wxSlider();
  17. wxSlider(wxWindow *parent,
  18. wxWindowID id,
  19. int value, int minValue, int maxValue,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. long style = wxSL_HORIZONTAL,
  23. const wxValidator& validator = wxDefaultValidator,
  24. const wxString& name = wxSliderNameStr)
  25. {
  26. Create( parent, id, value, minValue, maxValue,
  27. pos, size, style, validator, name );
  28. }
  29. ~wxSlider();
  30. bool Create(wxWindow *parent,
  31. wxWindowID id,
  32. int value, int minValue, int maxValue,
  33. const wxPoint& pos = wxDefaultPosition,
  34. const wxSize& size = wxDefaultSize,
  35. long style = wxSL_HORIZONTAL,
  36. const wxValidator& validator = wxDefaultValidator,
  37. const wxString& name = wxSliderNameStr);
  38. // implement the base class pure virtuals
  39. virtual int GetValue() const;
  40. virtual void SetValue(int value);
  41. virtual void SetRange(int minValue, int maxValue);
  42. virtual int GetMin() const;
  43. virtual int GetMax() const;
  44. virtual void SetLineSize(int lineSize);
  45. virtual void SetPageSize(int pageSize);
  46. virtual int GetLineSize() const;
  47. virtual int GetPageSize() const;
  48. virtual void SetThumbLength(int lenPixels);
  49. virtual int GetThumbLength() const;
  50. static wxVisualAttributes
  51. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  52. // implementation
  53. void GTKDisableEvents();
  54. void GTKEnableEvents();
  55. bool GTKEventsDisabled() const;
  56. double m_pos;
  57. int m_scrollEventType;
  58. bool m_needThumbRelease;
  59. GtkWidget *m_scale;
  60. protected:
  61. GtkWidget *m_minLabel,*m_maxLabel;
  62. bool m_blockScrollEvent;
  63. virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
  64. // set the slider value unconditionally
  65. void GTKSetValue(int value);
  66. DECLARE_DYNAMIC_CLASS(wxSlider)
  67. };
  68. #endif // _WX_GTK_SLIDER_H_