]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "gauge.h"
16 //-----------------------------------------------------------------------------
18 //-----------------------------------------------------------------------------
20 IMPLEMENT_DYNAMIC_CLASS(wxGauge
,wxControl
)
22 bool wxGauge::Create( wxWindow
*parent
, wxWindowID id
, int range
,
23 const wxPoint
& pos
, const wxSize
& size
,
24 long style
, const wxValidator
& validator
, const wxString
& name
)
28 PreCreation( parent
, id
, pos
, size
, style
, name
);
30 SetValidator( validator
);
34 m_useProgressBar
= TRUE
;
36 m_widget
= gtk_progress_bar_new();
45 void wxGauge::SetRange( int r
)
48 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
50 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), ((float)m_gaugePos
)/m_rangeMax
);
53 void wxGauge::SetValue( int pos
)
56 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
58 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), ((float)m_gaugePos
)/m_rangeMax
);
61 int wxGauge::GetRange(void) const
66 int wxGauge::GetValue(void) const
71 void wxGauge::ApplyWidgetStyle()
74 gtk_widget_set_style( m_widget
, m_widgetStyle
);