- m_needParent = TRUE;
-
- PreCreation( parent, id, pos, size, style, name );
-
- SetValidator( validator );
-
- m_oldPos = 0.0;
-
- if (style & wxSB_VERTICAL == wxSB_VERTICAL)
- m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
- else
- m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
-
- m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
-
- gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
- (GtkSignalFunc) gtk_scrollbar_callback, (gpointer) this );
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_press_event",
- (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "button_release_event",
- (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
-
- PostCreation();
-
- SetBackgroundColour( parent->GetBackgroundColour() );
-
- Show( TRUE );
-
- return TRUE;
+ m_needParent = TRUE;
+ m_acceptsFocus = TRUE;
+
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, validator, name ))
+ {
+ wxFAIL_MSG( wxT("wxScrollBar creation failed") );
+ return FALSE;
+ }
+
+ m_oldPos = 0.0;
+
+ if ((style & wxSB_VERTICAL) == wxSB_VERTICAL)
+ m_widget = gtk_vscrollbar_new( (GtkAdjustment *) NULL );
+ else
+ m_widget = gtk_hscrollbar_new( (GtkAdjustment *) NULL );
+
+ m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
+
+ gtk_signal_connect( GTK_OBJECT(m_adjust),
+ "value_changed",
+ (GtkSignalFunc) gtk_scrollbar_callback,
+ (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_press_event",
+ (GtkSignalFunc)gtk_scrollbar_button_press_callback,
+ (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(m_widget),
+ "button_release_event",
+ (GtkSignalFunc)gtk_scrollbar_button_release_callback,
+ (gpointer) this );
+
+ m_parent->DoAddChild( this );
+
+ PostCreation(size);
+
+ return TRUE;