- m_needParent = TRUE;
-
- PreCreation( parent, id, pos, size, style, name );
-
- SetValidator( validator );
-
- m_rangeMax = range;
- m_gaugePos = 0;
- m_useProgressBar = TRUE;
-
- m_widget = gtk_progress_bar_new();
-
- PostCreation();
-
- Show( TRUE );
-
- return TRUE;
+ m_needParent = true;
+
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, validator, name ))
+ {
+ wxFAIL_MSG( wxT("wxGauge creation failed") );
+ return false;
+ }
+
+ m_rangeMax = range;
+
+ m_widget = gtk_progress_bar_new();
+ if ( style & wxGA_VERTICAL )
+ {
+ gtk_progress_bar_set_orientation( GTK_PROGRESS_BAR(m_widget),
+ GTK_PROGRESS_BOTTOM_TO_TOP );
+ }
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+ SetBestSize(size);
+
+ return true;
+}
+
+void wxGauge::DoSetGauge()
+{
+ wxASSERT_MSG( 0 <= m_gaugePos && m_gaugePos <= m_rangeMax,
+ _T("invalid gauge position in DoSetGauge()") );
+
+ gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget),
+ m_rangeMax ? ((float)m_gaugePos)/m_rangeMax : 0.);