gauge.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk1/gauge.h
  3. // Purpose:
  4. // Author: Robert Roebling
  5. // Copyright: (c) 1998 Robert Roebling
  6. // Licence: wxWindows licence
  7. /////////////////////////////////////////////////////////////////////////////
  8. #ifndef __GTKGAUGEH__
  9. #define __GTKGAUGEH__
  10. //-----------------------------------------------------------------------------
  11. // wxGaugeBox
  12. //-----------------------------------------------------------------------------
  13. class WXDLLIMPEXP_CORE wxGauge: public wxGaugeBase
  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. void SetRange( int r );
  39. void SetValue( int pos );
  40. int GetShadowWidth() const { return 0; }
  41. int GetBezelFace() const { return 0; }
  42. int GetRange() const;
  43. int GetValue() const;
  44. bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
  45. static wxVisualAttributes
  46. GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
  47. // implementation
  48. // -------------
  49. // the max and current gauge values
  50. int m_rangeMax,
  51. m_gaugePos;
  52. protected:
  53. // common part of all ctors
  54. void Init() { m_rangeMax = m_gaugePos = 0; }
  55. // set the gauge value to the value of m_gaugePos
  56. void DoSetGauge();
  57. virtual wxSize DoGetBestSize() const;
  58. virtual wxVisualAttributes GetDefaultAttributes() const;
  59. private:
  60. DECLARE_DYNAMIC_CLASS(wxGauge)
  61. };
  62. #endif
  63. // __GTKGAUGEH__