gauge.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gauge.h
  3. // Purpose: wxGauge interface
  4. // Author: Vadim Zeitlin
  5. // Modified by:
  6. // Created: 20.02.01
  7. // Copyright: (c) 1996-2001 wxWidgets team
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_GAUGE_H_BASE_
  11. #define _WX_GAUGE_H_BASE_
  12. #include "wx/defs.h"
  13. #if wxUSE_GAUGE
  14. #include "wx/control.h"
  15. // ----------------------------------------------------------------------------
  16. // wxGauge style flags
  17. // ----------------------------------------------------------------------------
  18. #define wxGA_HORIZONTAL wxHORIZONTAL
  19. #define wxGA_VERTICAL wxVERTICAL
  20. // Win32 only, is default (and only) on some other platforms
  21. #define wxGA_SMOOTH 0x0020
  22. #if WXWIN_COMPATIBILITY_2_6
  23. // obsolete style
  24. #define wxGA_PROGRESSBAR 0
  25. #endif // WXWIN_COMPATIBILITY_2_6
  26. // GTK and Mac always have native implementation of the indeterminate mode
  27. // wxMSW has native implementation only if comctl32.dll >= 6.00
  28. #if !defined(__WXGTK20__) && !defined(__WXMAC__) && !defined(__WXCOCOA__)
  29. #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1
  30. #else
  31. #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0
  32. #endif
  33. extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[];
  34. // ----------------------------------------------------------------------------
  35. // wxGauge: a progress bar
  36. // ----------------------------------------------------------------------------
  37. class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl
  38. {
  39. public:
  40. wxGaugeBase() { m_rangeMax = m_gaugePos = 0; }
  41. virtual ~wxGaugeBase();
  42. bool Create(wxWindow *parent,
  43. wxWindowID id,
  44. int range,
  45. const wxPoint& pos = wxDefaultPosition,
  46. const wxSize& size = wxDefaultSize,
  47. long style = wxGA_HORIZONTAL,
  48. const wxValidator& validator = wxDefaultValidator,
  49. const wxString& name = wxGaugeNameStr);
  50. // determinate mode API
  51. // set/get the control range
  52. virtual void SetRange(int range);
  53. virtual int GetRange() const;
  54. virtual void SetValue(int pos);
  55. virtual int GetValue() const;
  56. // indeterminate mode API
  57. virtual void Pulse();
  58. // simple accessors
  59. bool IsVertical() const { return HasFlag(wxGA_VERTICAL); }
  60. // appearance params (not implemented for most ports)
  61. virtual void SetShadowWidth(int w);
  62. virtual int GetShadowWidth() const;
  63. virtual void SetBezelFace(int w);
  64. virtual int GetBezelFace() const;
  65. // overridden base class virtuals
  66. virtual bool AcceptsFocus() const { return false; }
  67. protected:
  68. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  69. // the max position
  70. int m_rangeMax;
  71. // the current position
  72. int m_gaugePos;
  73. #if wxGAUGE_EMULATE_INDETERMINATE_MODE
  74. int m_nDirection; // can be wxRIGHT or wxLEFT
  75. #endif
  76. wxDECLARE_NO_COPY_CLASS(wxGaugeBase);
  77. };
  78. #if defined(__WXUNIVERSAL__)
  79. #include "wx/univ/gauge.h"
  80. #elif defined(__WXMSW__)
  81. #include "wx/msw/gauge.h"
  82. #elif defined(__WXMOTIF__)
  83. #include "wx/motif/gauge.h"
  84. #elif defined(__WXGTK20__)
  85. #include "wx/gtk/gauge.h"
  86. #elif defined(__WXGTK__)
  87. #include "wx/gtk1/gauge.h"
  88. #elif defined(__WXMAC__)
  89. #include "wx/osx/gauge.h"
  90. #elif defined(__WXCOCOA__)
  91. #include "wx/cocoa/gauge.h"
  92. #elif defined(__WXPM__)
  93. #include "wx/os2/gauge.h"
  94. #endif
  95. #endif // wxUSE_GAUGE
  96. #endif
  97. // _WX_GAUGE_H_BASE_