gauge.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/univ/gauge.h
  3. // Purpose: wxUniversal wxGauge declaration
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 20.02.01
  7. // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_UNIV_GAUGE_H_
  11. #define _WX_UNIV_GAUGE_H_
  12. // ----------------------------------------------------------------------------
  13. // wxGauge: a progress bar
  14. // ----------------------------------------------------------------------------
  15. class WXDLLIMPEXP_CORE wxGauge : public wxGaugeBase
  16. {
  17. public:
  18. wxGauge() { Init(); }
  19. wxGauge(wxWindow *parent,
  20. wxWindowID id,
  21. int range,
  22. const wxPoint& pos = wxDefaultPosition,
  23. const wxSize& size = wxDefaultSize,
  24. long style = wxGA_HORIZONTAL,
  25. const wxValidator& validator = wxDefaultValidator,
  26. const wxString& name = wxGaugeNameStr)
  27. {
  28. Init();
  29. (void)Create(parent, id, range, pos, size, style, validator, name);
  30. }
  31. bool Create(wxWindow *parent,
  32. wxWindowID id,
  33. int range,
  34. const wxPoint& pos = wxDefaultPosition,
  35. const wxSize& size = wxDefaultSize,
  36. long style = wxGA_HORIZONTAL,
  37. const wxValidator& validator = wxDefaultValidator,
  38. const wxString& name = wxGaugeNameStr);
  39. // implement base class virtuals
  40. virtual void SetRange(int range);
  41. virtual void SetValue(int pos);
  42. // wxUniv-specific methods
  43. // is it a smooth progress bar or a discrete one?
  44. bool IsSmooth() const { return (GetWindowStyle() & wxGA_SMOOTH) != 0; }
  45. // is it a vertica; progress bar or a horizontal one?
  46. bool IsVertical() const { return (GetWindowStyle() & wxGA_VERTICAL) != 0; }
  47. protected:
  48. // common part of all ctors
  49. void Init();
  50. // return the def border for a progress bar
  51. virtual wxBorder GetDefaultBorder() const;
  52. // return the default size
  53. virtual wxSize DoGetBestClientSize() const;
  54. // draw the control
  55. virtual void DoDraw(wxControlRenderer *renderer);
  56. DECLARE_DYNAMIC_CLASS(wxGauge)
  57. };
  58. #endif // _WX_UNIV_GAUGE_H_