+//-----------------------------------------------------------------------------
+// "changed" from m_hAdjust
+//-----------------------------------------------------------------------------
+
+static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (g_blockEventsOnDrag) return;
+ if (!win->m_hasVMT) return;
+
+ wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
+ int value = (int)(win->m_hAdjust->value+0.5);
+
+ wxScrollWinEvent event( command, value, wxHORIZONTAL );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+}
+
+//-----------------------------------------------------------------------------
+// "button_press_event" from scrollbar
+//-----------------------------------------------------------------------------
+
+static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
+ GdkEventButton *WXUNUSED(gdk_event),
+ wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+// don't test here as we can release the mouse while being over
+// a different window then the slider
+//
+// if (gdk_event->window != widget->slider) return FALSE;
+
+ win->SetScrolling( TRUE );
+
+ return FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "button_release_event" from scrollbar
+//-----------------------------------------------------------------------------
+
+static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
+ GdkEventButton *WXUNUSED(gdk_event),
+ wxWindow *win )
+{
+
+// don't test here as we can release the mouse while being over
+// a different window then the slider
+//
+// if (gdk_event->window != widget->slider) return FALSE;
+
+ GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->m_widget);
+
+ if (widget == GTK_RANGE(scrolledWindow->vscrollbar))
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_hAdjust), "value_changed" );
+ else
+ gtk_signal_emit_by_name( GTK_OBJECT(win->m_vAdjust), "value_changed" );
+
+ win->SetScrolling( FALSE );
+
+ return FALSE;
+}
+
+// ----------------------------------------------------------------------------
+// this wxWindowBase function is implemented here (in platform-specific file)
+// because it is static and so couldn't be made virtual
+// ----------------------------------------------------------------------------
+
+wxWindow *wxWindowBase::FindFocus()
+{
+ return g_focusWindow;
+}
+
+//-----------------------------------------------------------------------------
+// "realize" from m_widget
+//-----------------------------------------------------------------------------
+
+/* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+
+static gint
+gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
+{
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ if (win->m_delayedFont)
+ win->SetFont( win->GetFont() );
+
+ if (win->m_delayedBackgroundColour)
+ win->SetBackgroundColour( win->GetBackgroundColour() );
+
+ if (win->m_delayedForegroundColour)
+ win->SetForegroundColour( win->GetForegroundColour() );
+
+ win->SetCursor( win->GetCursor() );
+
+ wxWindowCreateEvent event( win );
+ event.SetEventObject( win );
+ win->GetEventHandler()->ProcessEvent( event );
+
+ return FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// InsertChild for wxWindow.
+//-----------------------------------------------------------------------------
+
+/* Callback for wxWindow. This very strange beast has to be used because
+ * C++ has no virtual methods in a constructor. We have to emulate a
+ * virtual function here as wxNotebook requires a different way to insert
+ * a child in it. I had opted for creating a wxNotebookPage window class
+ * which would have made this superfluous (such in the MDI window system),
+ * but no-one was listening to me... */
+
+static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
+{
+ gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
+ GTK_WIDGET(child->m_widget),
+ child->m_x,
+ child->m_y,
+ child->m_width,
+ child->m_height );
+
+ if (parent->HasFlag(wxTAB_TRAVERSAL))
+ {
+ /* we now allow a window to get the focus as long as it
+ doesn't have any children. */
+ GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
+ }
+}
+
+//-----------------------------------------------------------------------------
+// global functions
+//-----------------------------------------------------------------------------
+
+wxWindow* wxGetActiveWindow()
+{
+ return g_focusWindow;
+}
+
+//-----------------------------------------------------------------------------
+// wxWindow
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxWindowBase)
+
+void wxWindow::Init()
+{
+ // common init
+ InitBase();
+
+ // GTK specific
+ m_widget = (GtkWidget *) NULL;
+ m_wxwindow = (GtkWidget *) NULL;
+
+ // position/size
+ m_x = 0;
+ m_y = 0;
+ m_width = 0;
+ m_height = 0;
+
+ m_sizeSet = FALSE;
+ m_hasVMT = FALSE;
+ m_needParent = TRUE;
+ m_isBeingDeleted = FALSE;
+
+ m_hasScrolling = FALSE;
+ m_isScrolling = FALSE;
+
+ m_hAdjust = (GtkAdjustment*) NULL;
+ m_vAdjust = (GtkAdjustment*) NULL;
+ m_oldHorizontalPos = 0.0;
+ m_oldVerticalPos = 0.0;
+
+ m_resizing = FALSE;
+ m_scrollGC = (GdkGC*) NULL;
+ m_widgetStyle = (GtkStyle*) NULL;
+
+ m_insertCallback = (wxInsertChildFunction) NULL;
+
+ m_isStaticBox = FALSE;
+ m_isRadioButton = FALSE;
+ m_acceptsFocus = FALSE;
+}
+
+wxWindow::wxWindow()
+{
+ Init();
+}
+
+wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
+ const wxPoint &pos, const wxSize &size,
+ long style, const wxString &name )
+{
+ Init();
+
+ Create( parent, id, pos, size, style, name );
+}
+
+bool wxWindow::Create( wxWindow *parent, wxWindowID id,
+ const wxPoint &pos, const wxSize &size,
+ long style, const wxString &name )
+{
+ if (!PreCreation( parent, pos, size ) ||
+ !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+ {
+ wxFAIL_MSG( _T("wxWindow creation failed") );
+ return FALSE;
+ }
+
+ m_insertCallback = wxInsertChildInWindow;
+
+ m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
+ GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+
+#ifdef __WXDEBUG__
+ debug_focus_in( m_widget, _T("wxWindow::m_widget"), name );
+#endif
+
+ GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
+
+#ifdef __WXDEBUG__
+ debug_focus_in( scrolledWindow->hscrollbar, _T("wxWindow::hsrcollbar"), name );
+ debug_focus_in( scrolledWindow->vscrollbar, _T("wxWindow::vsrcollbar"), name );
+#endif
+
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+ 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_myfixed_new();
+
+#ifdef __WXDEBUG__
+ debug_focus_in( m_wxwindow, _T("wxWindow::m_wxwindow"), name );
+#endif
+
+ gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+
+#if (GTK_MINOR_VERSION > 0)
+ GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
+
+ if (HasFlag(wxRAISED_BORDER))
+ {
+ gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_OUT );
+ }
+ else if (HasFlag(wxSUNKEN_BORDER))
+ {
+ gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_IN );
+ }
+ else
+ {
+ gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_NONE );
+ }
+#else // GTK_MINOR_VERSION == 0
+ GtkViewport *viewport = GTK_VIEWPORT(scrolledWindow->viewport);
+
+ if (HasFlag(wxRAISED_BORDER))
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_OUT );
+ }
+ else if (HasFlag(wxSUNKEN_BORDER))
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_IN );
+ }
+ else
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
+ }
+#endif // GTK_MINOR_VERSION
+
+ if (HasFlag(wxTAB_TRAVERSAL))
+ {
+ /* we now allow a window to get the focus as long as it
+ doesn't have any children. */
+ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+ m_acceptsFocus = FALSE;
+ }
+ else
+ {
+ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+ m_acceptsFocus = TRUE;
+ }
+
+#if (GTK_MINOR_VERSION == 0)
+ // shut the viewport up
+ gtk_viewport_set_hadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+ gtk_viewport_set_vadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+#endif // GTK_MINOR_VERSION == 0
+
+ // 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;
+ m_vAdjust->page_size = 5.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;
+ m_hAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
+
+ // 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 );
+
+ // these handlers get notified when screen updates are required either when
+ // scrolling or when the window size (and therefore scrollbar configuration)
+ // has changed
+
+ gtk_signal_connect( GTK_OBJECT(m_hAdjust), "value_changed",
+ (GtkSignalFunc) gtk_window_hscroll_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
+ (GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
+ (GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
+ gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
+ (GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
+
+ gtk_widget_show( m_wxwindow );
+
+ if (m_parent)
+ m_parent->DoAddChild( this );
+
+ PostCreation();
+
+ Show( TRUE );
+
+ return TRUE;
+}
+
+wxWindow::~wxWindow()
+{
+ m_isBeingDeleted = TRUE;
+ m_hasVMT = FALSE;
+
+ if (m_widget)
+ Show( FALSE );
+
+ DestroyChildren();
+
+ if (m_parent)
+ m_parent->RemoveChild( this );
+
+ if (m_widgetStyle)
+ {
+ gtk_style_unref( m_widgetStyle );
+ m_widgetStyle = (GtkStyle*) NULL;
+ }
+
+ if (m_scrollGC)
+ {
+ gdk_gc_unref( m_scrollGC );
+ m_scrollGC = (GdkGC*) NULL;
+ }
+
+ if (m_wxwindow)
+ {
+ gtk_widget_destroy( m_wxwindow );
+ m_wxwindow = (GtkWidget*) NULL;
+ }
+
+ if (m_widget)
+ {
+ gtk_widget_destroy( m_widget );
+ m_widget = (GtkWidget*) NULL;
+ }
+}
+
+bool wxWindow::PreCreation( wxWindow *parent, const wxPoint &pos, const wxSize &size )
+{
+ wxCHECK_MSG( !m_needParent || parent, FALSE, _T("Need complete parent.") );
+
+ /* this turns -1 into 20 so that a minimal window is
+ visible even although -1,-1 has been given as the
+ size of the window. the same trick is used in other
+ ports and should make debugging easier */
+ m_width = WidthDefault(size.x);
+ m_height = HeightDefault(size.y);
+
+ m_x = (int)pos.x;
+ m_y = (int)pos.y;
+
+ /* some reasonable defaults */
+ if (!parent)
+ {
+ if (m_x == -1)
+ {
+ m_x = (gdk_screen_width () - m_width) / 2;
+ if (m_x < 10) m_x = 10;
+ }
+ if (m_y == -1)
+ {
+ m_y = (gdk_screen_height () - m_height) / 2;
+ if (m_y < 10) m_y = 10;
+ }
+ }
+
+ return TRUE;
+}
+
+void wxWindow::PostCreation()
+{
+ wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
+
+ if (m_wxwindow)
+ {
+ /* these get reported to wxWindows -> wxPaintEvent */
+ gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
+ GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
+ GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+
+#if (GTK_MINOR_VERSION > 0)
+ /* these are called when the "sunken" or "raised" borders are drawn */
+ gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
+ GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(m_widget), "draw",
+ GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
+#endif
+ }
+
+ GtkWidget *connect_widget = GetConnectWidget();
+
+ ConnectWidget( connect_widget );
+
+ /* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
+ GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
+
+ m_hasVMT = TRUE;
+}
+
+void wxWindow::ConnectWidget( GtkWidget *widget )
+{
+ gtk_signal_connect( GTK_OBJECT(widget), "key_press_event",
+ GTK_SIGNAL_FUNC(gtk_window_key_press_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "key_release_event",
+ GTK_SIGNAL_FUNC(gtk_window_key_release_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "button_press_event",
+ GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "button_release_event",
+ GTK_SIGNAL_FUNC(gtk_window_button_release_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event",
+ GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
+ GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_out_event",
+ GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event",
+ GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
+
+ gtk_signal_connect( GTK_OBJECT(widget), "leave_notify_event",
+ GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
+}
+
+bool wxWindow::Destroy()
+{
+ wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
+
+ m_hasVMT = FALSE;
+
+ return wxWindowBase::Destroy();
+}
+
+void wxWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
+{
+ wxASSERT_MSG( (m_widget != NULL), _T("invalid window") );
+ wxASSERT_MSG( (m_parent != NULL), _T("wxWindow::SetSize requires parent.\n") );
+
+ if (m_resizing) return; /* I don't like recursions */
+ m_resizing = TRUE;
+
+ if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
+ {
+ /* don't set the size for children of wxNotebook, just take the values. */
+ m_x = x;
+ m_y = y;
+ m_width = width;
+ m_height = height;
+ }
+ else
+ {
+ if ((sizeFlags & wxSIZE_ALLOW_MINUS_ONE) == 0)
+ {
+ if (x != -1) m_x = x;
+ if (y != -1) m_y = y;
+ if (width != -1) m_width = width;
+ if (height != -1) m_height = height;
+ }
+ else
+ {
+ m_x = x;
+ m_y = y;
+ m_width = width;
+ m_height = height;
+ }
+
+ if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
+ {
+ if (width == -1) m_width = 80;
+ }
+
+ if ((sizeFlags & wxSIZE_AUTO_HEIGHT) == wxSIZE_AUTO_HEIGHT)
+ {
+ if (height == -1) m_height = 26;
+ }
+
+ if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
+ if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
+ if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
+ if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+
+ int border = 0;
+ int bottom_border = 0;
+
+ if (GTK_WIDGET_CAN_DEFAULT(m_widget))
+ {
+ /* the default button has a border around it */
+ border = 6;
+ bottom_border = 5;
+ }
+
+ /* this is the result of hours of debugging: the following code
+ means that if we have a m_wxwindow and we set the size of
+ m_widget, m_widget (which is a GtkScrolledWindow) does NOT
+ automatically propagate its size down to its m_wxwindow,
+ which is its client area. therefore, we have to tell the
+ client area directly that it has to resize itself.
+ this will lead to that m_widget (GtkScrolledWindow) will
+ calculate how much size it needs for scrollbars etc and
+ it will then call XXX_size_allocate of its child, which
+ is m_wxwindow. m_wxwindow in turn will do the same with its
+ children and so on. problems can arise if this happens
+ before all the children have been realized as some widgets
+ stupidy need to be realized during XXX_size_allocate (e.g.
+ GtkNotebook) and they will segv if called otherwise. this
+ emergency is tested in gtk_myfixed_size_allocate. Normally
+ this shouldn't be needed and only gtk_widget_queue_resize()
+ should be enough to provoke a resize at the next appropriate
+ moment, but this seems to fail, e.g. when a wxNotebook contains
+ a wxSplitterWindow: the splitter window's children won't
+ show up properly resized then. */
+
+ gtk_myfixed_set_size( GTK_MYFIXED(m_parent->m_wxwindow),
+ m_widget,
+ m_x-border,
+ m_y-border,
+ m_width+2*border,
+ m_height+border+bottom_border );
+ }
+
+ m_sizeSet = TRUE;
+
+ wxSizeEvent event( wxSize(m_width,m_height), GetId() );
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( event );
+
+ m_resizing = FALSE;
+}
+
+void wxWindow::OnInternalIdle()
+{
+ wxCursor cursor = m_cursor;
+ if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+ if (cursor.Ok() && m_currentGdkCursor != cursor)
+ {
+ m_currentGdkCursor = cursor;
+
+ if (m_wxwindow)
+ {
+ GdkWindow *window = m_wxwindow->window;
+ if (window)
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+
+ if (!g_globalCursor.Ok())
+ cursor = *wxSTANDARD_CURSOR;
+
+ window = m_widget->window;
+ if (window)
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+ }
+ else
+ {
+ GdkWindow *window = m_widget->window;
+ if (window)
+ gdk_window_set_cursor( window, cursor.GetCursor() );
+ }
+ }
+
+ UpdateWindowUI();
+}
+
+void wxWindow::DoGetSize( int *width, int *height ) const
+{
+ wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+
+ if (width) (*width) = m_width;
+ if (height) (*height) = m_height;
+}
+
+void wxWindow::DoSetClientSize( int width, int height )
+{
+ wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
+
+ if (!m_wxwindow)
+ {
+ SetSize( width, height );
+ }
+ else
+ {
+ int dw = 0;
+ int dh = 0;
+
+#if (GTK_MINOR_VERSION == 0)
+ if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+ {
+ if (HasScrolling())
+ {
+ GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+
+ GtkWidget *viewport = scroll_window->viewport;
+ GtkStyleClass *viewport_class = viewport->style->klass;
+
+ dw += 2 * viewport_class->xthickness;
+ dh += 2 * viewport_class->ythickness;
+ }
+ }
+#else
+ if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER))
+ {
+ /* when using GTK 1.2 we set the border size to 2 */
+ dw += 2 * 2;
+ dh += 2 * 2;
+ }
+#endif
+
+ if (HasScrolling())
+ {
+/*
+ GtkWidget *hscrollbar = scroll_window->hscrollbar;
+ GtkWidget *vscrollbar = scroll_window->vscrollbar;
+
+ we use this instead: range.slider_width = 11 + 2*2pts edge
+*/
+
+ GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+
+ if (scroll_window->vscrollbar_visible)
+ {
+ dw += 15; /* dw += vscrollbar->allocation.width; */
+ dw += scroll_class->scrollbar_spacing;
+ }