]>
git.saurik.com Git - wxWidgets.git/blob - src/common/gaugecmn.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/gaugecmn.cpp
3 // Purpose: wxGaugeBase: common to all ports methods of wxGauge
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
33 const char wxGaugeNameStr
[] = "gauge";
35 // ============================================================================
37 // ============================================================================
39 wxGaugeBase::~wxGaugeBase()
41 // this destructor is required for Darwin
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 wxDEFINE_FLAGS( wxGaugeStyle
)
49 wxBEGIN_FLAGS( wxGaugeStyle
)
50 // new style border flags, we put them first to
51 // use them for streaming out
52 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
53 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
54 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
55 wxFLAGS_MEMBER(wxBORDER_RAISED
)
56 wxFLAGS_MEMBER(wxBORDER_STATIC
)
57 wxFLAGS_MEMBER(wxBORDER_NONE
)
59 // old style border flags
60 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
61 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
62 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
63 wxFLAGS_MEMBER(wxRAISED_BORDER
)
64 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
65 wxFLAGS_MEMBER(wxBORDER
)
67 // standard window styles
68 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
69 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
70 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
71 wxFLAGS_MEMBER(wxWANTS_CHARS
)
72 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
73 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
74 wxFLAGS_MEMBER(wxVSCROLL
)
75 wxFLAGS_MEMBER(wxHSCROLL
)
77 wxFLAGS_MEMBER(wxGA_HORIZONTAL
)
78 wxFLAGS_MEMBER(wxGA_VERTICAL
)
79 #if WXWIN_COMPATIBILITY_2_6
80 wxFLAGS_MEMBER(wxGA_PROGRESSBAR
)
81 #endif // WXWIN_COMPATIBILITY_2_6
82 wxFLAGS_MEMBER(wxGA_SMOOTH
)
83 wxEND_FLAGS( wxGaugeStyle
)
85 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxGauge
, wxControl
, "wx/gauge.h")
87 wxBEGIN_PROPERTIES_TABLE(wxGauge
)
88 wxPROPERTY( Value
, int, SetValue
, GetValue
, 0, 0 /*flags*/, \
89 wxT("Helpstring"), wxT("group"))
90 wxPROPERTY( Range
, int, SetRange
, GetRange
, 0, 0 /*flags*/, \
91 wxT("Helpstring"), wxT("group"))
92 wxPROPERTY( ShadowWidth
, int, SetShadowWidth
, GetShadowWidth
, \
93 0, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
94 wxPROPERTY( BezelFace
, int, SetBezelFace
, GetBezelFace
, \
95 0, 0 /*flags*/, wxT("Helpstring"), wxT("group"))
97 wxPROPERTY_FLAGS( WindowStyle
, wxGaugeStyle
, long, SetWindowStyleFlag
, \
98 GetWindowStyleFlag
, wxEMPTY_PARAMETER_VALUE
, 0 /*flags*/, \
99 wxT("Helpstring"), wxT("group")) // style
100 wxEND_PROPERTIES_TABLE()
102 wxEMPTY_HANDLERS_TABLE(wxGauge
)
104 wxCONSTRUCTOR_6( wxGauge
, wxWindow
*, Parent
, wxWindowID
, Id
, int, Range
, \
105 wxPoint
, Position
, wxSize
, Size
, long, WindowStyle
)
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
111 bool wxGaugeBase::Create(wxWindow
*parent
,
117 const wxValidator
& validator
,
118 const wxString
& name
)
120 if ( !wxControl::Create(parent
, id
, pos
, size
, style
, validator
, name
) )
126 SetValidator(validator
);
127 #endif // wxUSE_VALIDATORS
131 #if wxGAUGE_EMULATE_INDETERMINATE_MODE
132 m_nDirection
= wxRIGHT
;
138 // ----------------------------------------------------------------------------
139 // wxGauge determinate mode range/position
140 // ----------------------------------------------------------------------------
142 void wxGaugeBase::SetRange(int range
)
147 int wxGaugeBase::GetRange() const
152 void wxGaugeBase::SetValue(int pos
)
157 int wxGaugeBase::GetValue() const
162 // ----------------------------------------------------------------------------
163 // wxGauge indeterminate mode
164 // ----------------------------------------------------------------------------
166 void wxGaugeBase::Pulse()
168 #if wxGAUGE_EMULATE_INDETERMINATE_MODE
169 // simulate indeterminate mode
170 int curr
= GetValue(), max
= GetRange();
172 if (m_nDirection
== wxRIGHT
)
179 m_nDirection
= wxLEFT
;
189 m_nDirection
= wxRIGHT
;
195 // ----------------------------------------------------------------------------
196 // wxGauge appearance params
197 // ----------------------------------------------------------------------------
199 void wxGaugeBase::SetShadowWidth(int WXUNUSED(w
))
203 int wxGaugeBase::GetShadowWidth() const
209 void wxGaugeBase::SetBezelFace(int WXUNUSED(w
))
213 int wxGaugeBase::GetBezelFace() const
218 #endif // wxUSE_GAUGE