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 11 #ifndef _WX_GAUGE_H_BASE_ 12 #define _WX_GAUGE_H_BASE_ 13 14 #include "wx/defs.h" 15 16 #if wxUSE_GAUGE 17 18 #include "wx/control.h" 19 20 // ---------------------------------------------------------------------------- 21 // wxGauge style flags 22 // ---------------------------------------------------------------------------- 23 24 #define wxGA_HORIZONTAL wxHORIZONTAL 25 #define wxGA_VERTICAL wxVERTICAL 26 27 // Available since Windows 7 only. With this style, the value of gauge will 28 // reflect on the taskbar button. 29 #define wxGA_PROGRESS 0x0010 30 // Win32 only, is default (and only) on some other platforms 31 #define wxGA_SMOOTH 0x0020 32 // QT only, display current completed percentage (text default format "%p%") 33 #define wxGA_TEXT 0x0040 34 35 // GTK and Mac always have native implementation of the indeterminate mode 36 // wxMSW has native implementation only if comctl32.dll >= 6.00 37 #if !defined(__WXGTK20__) && !defined(__WXMAC__) 38 #define wxGAUGE_EMULATE_INDETERMINATE_MODE 1 39 #else 40 #define wxGAUGE_EMULATE_INDETERMINATE_MODE 0 41 #endif 42 43 extern WXDLLIMPEXP_DATA_CORE(const char) wxGaugeNameStr[]; 44 45 class WXDLLIMPEXP_FWD_CORE wxAppProgressIndicator; 46 47 // ---------------------------------------------------------------------------- 48 // wxGauge: a progress bar 49 // ---------------------------------------------------------------------------- 50 51 class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl 52 { 53 public: wxGaugeBase()54 wxGaugeBase() : m_rangeMax(0), m_gaugePos(0), 55 #if wxGAUGE_EMULATE_INDETERMINATE_MODE 56 m_nDirection(wxRIGHT), 57 #endif 58 m_appProgressIndicator(NULL) { } 59 60 virtual ~wxGaugeBase(); 61 62 bool Create(wxWindow *parent, 63 wxWindowID id, 64 int range, 65 const wxPoint& pos = wxDefaultPosition, 66 const wxSize& size = wxDefaultSize, 67 long style = wxGA_HORIZONTAL, 68 const wxValidator& validator = wxDefaultValidator, 69 const wxString& name = wxASCII_STR(wxGaugeNameStr)); 70 71 // determinate mode API 72 73 // set/get the control range 74 virtual void SetRange(int range); 75 virtual int GetRange() const; 76 77 virtual void SetValue(int pos); 78 virtual int GetValue() const; 79 80 // indeterminate mode API 81 virtual void Pulse(); 82 83 // simple accessors IsVertical()84 bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } 85 86 // overridden base class virtuals AcceptsFocus()87 virtual bool AcceptsFocus() const wxOVERRIDE { return false; } 88 89 // Deprecated methods not doing anything since a long time. 90 wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") SetShadowWidth(int WXUNUSED (w))91 void SetShadowWidth(int WXUNUSED(w)) { } 92 93 wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") GetShadowWidth()94 int GetShadowWidth() const { return 0; } 95 96 wxDEPRECATED_MSG("Remove calls to this method, it doesn't do anything") SetBezelFace(int WXUNUSED (w))97 void SetBezelFace(int WXUNUSED(w)) { } 98 99 wxDEPRECATED_MSG("Remove calls to this method, it always returns 0") GetBezelFace()100 int GetBezelFace() const { return 0; } 101 102 protected: GetDefaultBorder()103 virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; } 104 105 // Initialize m_appProgressIndicator if necessary, i.e. if this object has 106 // wxGA_PROGRESS style. This method is supposed to be called from the 107 // derived class Create() if it doesn't call the base class Create(), which 108 // already does it, after initializing the window style and range. 109 void InitProgressIndicatorIfNeeded(); 110 111 112 // the max position 113 int m_rangeMax; 114 115 // the current position 116 int m_gaugePos; 117 118 #if wxGAUGE_EMULATE_INDETERMINATE_MODE 119 int m_nDirection; // can be wxRIGHT or wxLEFT 120 #endif 121 122 wxAppProgressIndicator *m_appProgressIndicator; 123 124 wxDECLARE_NO_COPY_CLASS(wxGaugeBase); 125 }; 126 127 #if defined(__WXUNIVERSAL__) 128 #include "wx/univ/gauge.h" 129 #elif defined(__WXMSW__) 130 #include "wx/msw/gauge.h" 131 #elif defined(__WXMOTIF__) 132 #include "wx/motif/gauge.h" 133 #elif defined(__WXGTK20__) 134 #include "wx/gtk/gauge.h" 135 #elif defined(__WXGTK__) 136 #include "wx/gtk1/gauge.h" 137 #elif defined(__WXMAC__) 138 #include "wx/osx/gauge.h" 139 #elif defined(__WXQT__) 140 #include "wx/qt/gauge.h" 141 #endif 142 143 #endif // wxUSE_GAUGE 144 145 #endif 146 // _WX_GAUGE_H_BASE_ 147