]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/gauge.cpp
ff974edef9af2ff96b6c28b6ce8ae8a613aa4d0a
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "gauge.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxGauge
,wxControl
)
24 bool wxGauge::Create( wxWindow
*parent
, wxWindowID id
, int range
,
25 const wxPoint
& pos
, const wxSize
& size
,
26 long style
, const wxValidator
& validator
, const wxString
& name
)
30 PreCreation( parent
, id
, pos
, size
, style
, name
);
32 SetValidator( validator
);
36 m_useProgressBar
= TRUE
;
38 m_widget
= gtk_progress_bar_new();
40 m_parent
->DoAddChild( this );
49 void wxGauge::SetRange( int r
)
52 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
54 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), ((float)m_gaugePos
)/m_rangeMax
);
57 void wxGauge::SetValue( int pos
)
60 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
62 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), ((float)m_gaugePos
)/m_rangeMax
);
65 int wxGauge::GetRange(void) const
70 int wxGauge::GetValue(void) const
75 void wxGauge::ApplyWidgetStyle()
78 gtk_widget_set_style( m_widget
, m_widgetStyle
);