1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "gauge.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 IMPLEMENT_DYNAMIC_CLASS(wxGauge
,wxControl
)
27 bool wxGauge::Create( wxWindow
*parent
, wxWindowID id
, int range
,
28 const wxPoint
& pos
, const wxSize
& size
,
29 long style
, const wxValidator
& validator
, const wxString
& name
)
33 if (!PreCreation( parent
, pos
, size
) ||
34 !CreateBase( parent
, id
, pos
, size
, style
, validator
, name
))
36 wxFAIL_MSG( wxT("wxGauge creation failed") );
42 m_useProgressBar
= TRUE
;
44 m_widget
= gtk_progress_bar_new();
45 if( style
& wxGA_VERTICAL
)
46 gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR(m_widget
) , GTK_PROGRESS_BOTTOM_TO_TOP
);
48 m_parent
->DoAddChild( this );
57 void wxGauge::SetRange( int r
)
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 void wxGauge::SetValue( int pos
)
68 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
70 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), ((float)m_gaugePos
)/m_rangeMax
);
73 int wxGauge::GetRange() const
78 int wxGauge::GetValue() const
83 void wxGauge::ApplyWidgetStyle()
86 gtk_widget_set_style( m_widget
, m_widgetStyle
);