]>
Commit | Line | Data |
---|---|---|
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 | // Win32 only, is default (and only) on some other platforms | |
28 | #define wxGA_SMOOTH 0x0020 | |
29 | ||
30 | #if WXWIN_COMPATIBILITY_2_6 | |
31 | // obsolete style | |
32 | #define wxGA_PROGRESSBAR 0 | |
33 | #endif // WXWIN_COMPATIBILITY_2_6 | |
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__) && !defined(__WXCOCOA__) | |
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 | // ---------------------------------------------------------------------------- | |
46 | // wxGauge: a progress bar | |
47 | // ---------------------------------------------------------------------------- | |
48 | ||
49 | class WXDLLIMPEXP_CORE wxGaugeBase : public wxControl | |
50 | { | |
51 | public: | |
52 | wxGaugeBase() { m_rangeMax = m_gaugePos = 0; } | |
53 | virtual ~wxGaugeBase(); | |
54 | ||
55 | bool Create(wxWindow *parent, | |
56 | wxWindowID id, | |
57 | int range, | |
58 | const wxPoint& pos = wxDefaultPosition, | |
59 | const wxSize& size = wxDefaultSize, | |
60 | long style = wxGA_HORIZONTAL, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxGaugeNameStr); | |
63 | ||
64 | // determinate mode API | |
65 | ||
66 | // set/get the control range | |
67 | virtual void SetRange(int range); | |
68 | virtual int GetRange() const; | |
69 | ||
70 | virtual void SetValue(int pos); | |
71 | virtual int GetValue() const; | |
72 | ||
73 | // indeterminate mode API | |
74 | virtual void Pulse(); | |
75 | ||
76 | // simple accessors | |
77 | bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } | |
78 | ||
79 | // appearance params (not implemented for most ports) | |
80 | virtual void SetShadowWidth(int w); | |
81 | virtual int GetShadowWidth() const; | |
82 | ||
83 | virtual void SetBezelFace(int w); | |
84 | virtual int GetBezelFace() const; | |
85 | ||
86 | // overridden base class virtuals | |
87 | virtual bool AcceptsFocus() const { return false; } | |
88 | ||
89 | protected: | |
90 | virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } | |
91 | ||
92 | // the max position | |
93 | int m_rangeMax; | |
94 | ||
95 | // the current position | |
96 | int m_gaugePos; | |
97 | ||
98 | #if wxGAUGE_EMULATE_INDETERMINATE_MODE | |
99 | int m_nDirection; // can be wxRIGHT or wxLEFT | |
100 | #endif | |
101 | ||
102 | wxDECLARE_NO_COPY_CLASS(wxGaugeBase); | |
103 | }; | |
104 | ||
105 | #if defined(__WXUNIVERSAL__) | |
106 | #include "wx/univ/gauge.h" | |
107 | #elif defined(__WXMSW__) | |
108 | #include "wx/msw/gauge.h" | |
109 | #elif defined(__WXMOTIF__) | |
110 | #include "wx/motif/gauge.h" | |
111 | #elif defined(__WXGTK20__) | |
112 | #include "wx/gtk/gauge.h" | |
113 | #elif defined(__WXGTK__) | |
114 | #include "wx/gtk1/gauge.h" | |
115 | #elif defined(__WXMAC__) | |
116 | #include "wx/osx/gauge.h" | |
117 | #elif defined(__WXCOCOA__) | |
118 | #include "wx/cocoa/gauge.h" | |
119 | #elif defined(__WXPM__) | |
120 | #include "wx/os2/gauge.h" | |
121 | #endif | |
122 | ||
123 | #endif // wxUSE_GAUGE | |
124 | ||
125 | #endif | |
126 | // _WX_GAUGE_H_BASE_ |