gauge.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/gauge.h
  3. // Purpose:
  4. // Author: Robert Roebling
  5. // Copyright: (c) 1998 Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef _WX_GTK_GAUGE_H_
  9. #define _WX_GTK_GAUGE_H_
  10. //-----------------------------------------------------------------------------
  11. // wxGauge
  12. //-----------------------------------------------------------------------------
  13. class WXDLLIMPEXP_CORE wxGauge: public wxControl
  14. {
  15. public:
  16. wxGauge() { Init(); }
  17. wxGauge( wxWindow *parent,
  18. wxWindowID id,
  19. int range,
  20. const wxPoint& pos = wxDefaultPosition,
  21. const wxSize& size = wxDefaultSize,
  22. long style = wxGA_HORIZONTAL,
  23. const wxValidator& validator = wxDefaultValidator,
  24. const wxString& name = wxGaugeNameStr )
  25. {
  26. Init();
  27. Create(parent, id, range, pos, size, style, validator, name);
  28. }
  29. bool Create( wxWindow *parent,
  30. wxWindowID id, int range,
  31. const wxPoint& pos = wxDefaultPosition,
  32. const wxSize& size = wxDefaultSize,
  33. long style = wxGA_HORIZONTAL,
  34. const wxValidator& validator = wxDefaultValidator,
  35. const wxString& name = wxGaugeNameStr );
  36. void SetShadowWidth( int WXUNUSED(w) ) { }
  37. void SetBezelFace( int WXUNUSED(w) ) { }
  38. int GetShadowWidth() const { return 0; }
  39. int GetBezelFace() const { return 0; }
  40. // determinate mode API
  41. void SetRange( int r );
  42. void SetValue( int pos );
  43. int GetRange() const;
  44. int GetValue() const;
  45. // indeterminate mode API
  46. virtual void Pulse();
  47. bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
  48. static wxVisualAttributes
  49. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  50. virtual wxVisualAttributes GetDefaultAttributes() const;
  51. // implementation
  52. // -------------
  53. // the max and current gauge values
  54. int m_rangeMax,
  55. m_gaugePos;
  56. protected:
  57. // set the gauge value to the value of m_gaugePos
  58. void DoSetGauge();
  59. virtual wxSize DoGetBestSize() const;
  60. private:
  61. void Init() { m_rangeMax = m_gaugePos = 0; }
  62. DECLARE_DYNAMIC_CLASS(wxGauge)
  63. };
  64. #endif
  65. // _WX_GTK_GAUGE_H_