]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/gauge.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "gauge.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 IMPLEMENT_DYNAMIC_CLASS(wxGauge
,wxControl
)
23 bool wxGauge::Create( wxWindow
*parent
, const wxWindowID id
, const int range
,
24 const wxPoint
& pos
, const wxSize
& size
,
25 const long style
, const wxString
& name
)
29 wxSize newSize
= size
;
31 PreCreation( parent
, id
, pos
, size
, style
, name
);
35 m_useProgressBar
= TRUE
;
37 m_widget
= gtk_progress_bar_new();
46 void wxGauge::SetRange( const int r
)
49 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
51 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), (float)(m_rangeMax
/m_gaugePos
) );
54 void wxGauge::SetValue( const int pos
)
57 if (m_gaugePos
> m_rangeMax
) m_gaugePos
= m_rangeMax
;
59 gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget
), (float)(m_rangeMax
/m_gaugePos
) );
62 int wxGauge::GetRange(void) const
67 int wxGauge::GetValue(void) const