- if (!PreCreation( parent, pos, size ) ||
- !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
- {
- wxFAIL_MSG( wxT("wxWindow creation failed") );
- return FALSE;
- }
-
- m_insertCallback = wxInsertChildInScrolledWindow;
-
- m_targetWindow = this;
-
- m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
- GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
-
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
-
- GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) );
- scroll_class->scrollbar_spacing = 0;
-
- gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
-
- m_hAdjust = gtk_range_get_adjustment( GTK_RANGE(scrolledWindow->hscrollbar) );
- m_vAdjust = gtk_range_get_adjustment( GTK_RANGE(scrolledWindow->vscrollbar) );
-
- m_wxwindow = gtk_pizza_new();
-
- gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
-
- GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
-
- if (HasFlag(wxRAISED_BORDER))
- {
- gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT );
- }
- else if (HasFlag(wxSUNKEN_BORDER))
- {
- gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_IN );
- }
- else if (HasFlag(wxSIMPLE_BORDER))
- {
- gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_THIN );
- }
- else
- {
- gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_NONE );
- }
-
- GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
- m_acceptsFocus = TRUE;
-
- // I _really_ don't want scrollbars in the beginning
- m_vAdjust->lower = 0.0;
- m_vAdjust->upper = 1.0;
- m_vAdjust->value = 0.0;
- m_vAdjust->step_increment = 1.0;
- m_vAdjust->page_increment = 1.0;
- gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
- m_hAdjust->lower = 0.0;
- m_hAdjust->upper = 1.0;
- m_hAdjust->value = 0.0;
- m_hAdjust->step_increment = 1.0;
- m_hAdjust->page_increment = 1.0;
- gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
-
- // Handlers for new scrollbar values
- GtkVConnectEvent();
- GtkHConnectEvent();
-
- // these handlers block mouse events to any window during scrolling such as
- // motion events and prevent GTK and wxWindows from fighting over where the
- // slider should be
-
- gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_press_event",
- (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
-
- gtk_signal_connect( GTK_OBJECT(scrolledWindow->hscrollbar), "button_press_event",
- (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
-
- gtk_signal_connect( GTK_OBJECT(scrolledWindow->vscrollbar), "button_release_event",
- (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
-
- gtk_signal_connect( GTK_OBJECT(scrolledWindow->hscrollbar), "button_release_event",
- (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
-
- gtk_widget_show( m_wxwindow );
-
- if (m_parent)
- m_parent->DoAddChild( this );
-
- m_focusWidget = m_wxwindow;
-
- PostCreation();
-
- Show( TRUE );
-
- return TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// setting scrolling parameters
-// ----------------------------------------------------------------------------
-
-/*
- * pixelsPerUnitX/pixelsPerUnitY: number of pixels per unit (e.g. pixels per text line)
- * noUnitsX/noUnitsY: : no. units per scrollbar
- */
-void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
- int noUnitsX, int noUnitsY,
- int xPos, int yPos, bool noRefresh )
-{
- int old_x = m_xScrollPixelsPerLine * m_xScrollPosition;
- int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
-