gauge.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: gauge.h
  3. // Purpose: interface of wxGauge
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. // ----------------------------------------------------------------------------
  8. // wxGauge style flags
  9. // ----------------------------------------------------------------------------
  10. #define wxGA_HORIZONTAL wxHORIZONTAL
  11. #define wxGA_VERTICAL wxVERTICAL
  12. // Win32 only, is default (and only) on some other platforms
  13. #define wxGA_SMOOTH 0x0020
  14. /**
  15. @class wxGauge
  16. A gauge is a horizontal or vertical bar which shows a quantity (often
  17. time).
  18. wxGauge supports two working modes: determinate and indeterminate progress.
  19. The first is the usual working mode (see SetValue() and SetRange()) while
  20. the second can be used when the program is doing some processing but you
  21. don't know how much progress is being done. In this case, you can
  22. periodically call the Pulse() function to make the progress bar switch to
  23. indeterminate mode (graphically it's usually a set of blocks which move or
  24. bounce in the bar control).
  25. wxGauge supports dynamic switch between these two work modes.
  26. There are no user commands for the gauge.
  27. @beginStyleTable
  28. @style{wxGA_HORIZONTAL}
  29. Creates a horizontal gauge.
  30. @style{wxGA_VERTICAL}
  31. Creates a vertical gauge.
  32. @style{wxGA_SMOOTH}
  33. Creates smooth progress bar with one pixel wide update step (not
  34. supported by all platforms).
  35. @endStyleTable
  36. @library{wxcore}
  37. @category{ctrl}
  38. @appearance{gauge}
  39. @see wxSlider, wxScrollBar
  40. */
  41. class wxGauge : public wxControl
  42. {
  43. public:
  44. /**
  45. Default constructor.
  46. */
  47. wxGauge();
  48. /**
  49. Constructor, creating and showing a gauge.
  50. @param parent
  51. Window parent.
  52. @param id
  53. Window identifier.
  54. @param range
  55. Integer range (maximum value) of the gauge.
  56. See SetRange() for more details about the meaning of this value
  57. when using the gauge in indeterminate mode.
  58. @param pos
  59. Window position.
  60. @param size
  61. Window size.
  62. @param style
  63. Gauge style.
  64. @param validator
  65. Window validator.
  66. @param name
  67. Window name.
  68. @see Create()
  69. */
  70. wxGauge(wxWindow* parent, wxWindowID id, int range,
  71. const wxPoint& pos = wxDefaultPosition,
  72. const wxSize& size = wxDefaultSize,
  73. long style = wxGA_HORIZONTAL,
  74. const wxValidator& validator = wxDefaultValidator,
  75. const wxString& name = wxGaugeNameStr);
  76. /**
  77. Destructor, destroying the gauge.
  78. */
  79. virtual ~wxGauge();
  80. /**
  81. Creates the gauge for two-step construction. See wxGauge() for further
  82. details.
  83. */
  84. bool Create(wxWindow* parent, wxWindowID id, int range,
  85. const wxPoint& pos = wxDefaultPosition,
  86. const wxSize& size = wxDefaultSize, long style = wxGA_HORIZONTAL,
  87. const wxValidator& validator = wxDefaultValidator,
  88. const wxString& name = wxGaugeNameStr);
  89. /**
  90. Returns the width of the 3D bezel face.
  91. @remarks This method is not implemented (returns 0) for most platforms.
  92. @see SetBezelFace()
  93. */
  94. int GetBezelFace() const;
  95. /**
  96. Returns the maximum position of the gauge.
  97. @see SetRange()
  98. */
  99. int GetRange() const;
  100. /**
  101. Returns the 3D shadow margin width.
  102. @remarks This method is not implemented (returns 0) for most platforms.
  103. @see SetShadowWidth()
  104. */
  105. int GetShadowWidth() const;
  106. /**
  107. Returns the current position of the gauge.
  108. @see SetValue()
  109. */
  110. int GetValue() const;
  111. /**
  112. Returns @true if the gauge is vertical (has @c wxGA_VERTICAL style) and
  113. @false otherwise.
  114. */
  115. bool IsVertical() const;
  116. /**
  117. Switch the gauge to indeterminate mode (if required) and makes the
  118. gauge move a bit to indicate the user that some progress has been made.
  119. @note After calling this function the value returned by GetValue() is
  120. undefined and thus you need to explicitly call SetValue() if you
  121. want to restore the determinate mode.
  122. */
  123. virtual void Pulse();
  124. /**
  125. Sets the 3D bezel face width.
  126. @remarks This method is not implemented (doesn't do anything) for most
  127. platforms.
  128. @see GetBezelFace()
  129. */
  130. void SetBezelFace(int width);
  131. /**
  132. Sets the range (maximum value) of the gauge. This function makes the
  133. gauge switch to determinate mode, if it's not already.
  134. When the gauge is in indeterminate mode, under wxMSW the gauge
  135. repeatedly goes from zero to @a range and back; under other ports
  136. when in indeterminate mode, the @a range setting is ignored.
  137. @see GetRange()
  138. */
  139. void SetRange(int range);
  140. /**
  141. Sets the 3D shadow width.
  142. @remarks This method is not implemented (doesn't do anything) for most
  143. platforms.
  144. */
  145. void SetShadowWidth(int width);
  146. /**
  147. Sets the position of the gauge. The @a pos must be between 0 and the
  148. gauge range as returned by GetRange(), inclusive.
  149. This function makes the gauge switch to determinate mode, if it was in
  150. indeterminate mode before.
  151. @param pos
  152. Position for the gauge level.
  153. @see GetValue()
  154. */
  155. void SetValue(int pos);
  156. };