]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: gauge.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | ||
11 | #ifndef __GTKGAUGEH__ | |
12 | #define __GTKGAUGEH__ | |
13 | ||
14 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
15 | #pragma interface | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | ||
20 | #if wxUSE_GAUGE | |
21 | ||
22 | #include "wx/object.h" | |
23 | #include "wx/list.h" | |
24 | #include "wx/control.h" | |
25 | ||
26 | //----------------------------------------------------------------------------- | |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
30 | class wxGauge; | |
31 | ||
32 | //----------------------------------------------------------------------------- | |
33 | // global data | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
36 | extern const wxChar* wxGaugeNameStr; | |
37 | ||
38 | //----------------------------------------------------------------------------- | |
39 | // wxGaugeBox | |
40 | //----------------------------------------------------------------------------- | |
41 | ||
42 | class wxGauge: public wxControl | |
43 | { | |
44 | public: | |
45 | wxGauge() { Init(); } | |
46 | ||
47 | wxGauge( wxWindow *parent, | |
48 | wxWindowID id, | |
49 | int range, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | long style = wxGA_HORIZONTAL, | |
53 | const wxValidator& validator = wxDefaultValidator, | |
54 | const wxString& name = wxGaugeNameStr ) | |
55 | { | |
56 | Init(); | |
57 | ||
58 | Create(parent, id, range, pos, size, style, validator, name); | |
59 | } | |
60 | ||
61 | bool Create( wxWindow *parent, | |
62 | wxWindowID id, int range, | |
63 | const wxPoint& pos = wxDefaultPosition, | |
64 | const wxSize& size = wxDefaultSize, | |
65 | long style = wxGA_HORIZONTAL, | |
66 | const wxValidator& validator = wxDefaultValidator, | |
67 | const wxString& name = wxGaugeNameStr ); | |
68 | ||
69 | void SetShadowWidth( int WXUNUSED(w) ) { } | |
70 | void SetBezelFace( int WXUNUSED(w) ) { } | |
71 | void SetRange( int r ); | |
72 | void SetValue( int pos ); | |
73 | int GetShadowWidth() const { return 0; }; | |
74 | int GetBezelFace() const { return 0; }; | |
75 | int GetRange() const; | |
76 | int GetValue() const; | |
77 | ||
78 | bool IsVertical() const { return HasFlag(wxGA_VERTICAL); } | |
79 | ||
80 | // implementation | |
81 | // ------------- | |
82 | ||
83 | void ApplyWidgetStyle(); | |
84 | ||
85 | // the max and current gauge values | |
86 | int m_rangeMax, | |
87 | m_gaugePos; | |
88 | ||
89 | // obsolete functions, don't use | |
90 | #if WXWIN_COMPATIBILITY_2_2 | |
91 | bool GetProgressBar() const { return true; } | |
92 | #endif // WXWIN_COMPATIBILITY_2_2 | |
93 | ||
94 | protected: | |
95 | // common part of all ctors | |
96 | void Init() { m_rangeMax = m_gaugePos = 0; } | |
97 | ||
98 | // set the gauge value to the value of m_gaugePos | |
99 | void DoSetGauge(); | |
100 | ||
101 | virtual wxSize DoGetBestSize() const; | |
102 | ||
103 | private: | |
104 | DECLARE_DYNAMIC_CLASS(wxGauge) | |
105 | }; | |
106 | ||
107 | #endif | |
108 | ||
109 | #endif // __GTKGAUGEH__ |