-//-----------------------------------------------------------------------------
-// data
-//-----------------------------------------------------------------------------
-
-extern bool g_blockEventsOnDrag;
-extern bool g_blockEventsOnScroll;
-
-//-----------------------------------------------------------------------------
-// idle system
-//-----------------------------------------------------------------------------
-
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
-//-----------------------------------------------------------------------------
-// "value_changed" from m_vAdjust
-//-----------------------------------------------------------------------------
-
-static void gtk_scrolled_window_vscroll_callback( GtkAdjustment *adjust,
- SCROLLBAR_CBACK_ARG
- wxScrolledWindow *win )
-{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (g_blockEventsOnDrag) return;
-
- if (!win->m_hasVMT) return;
-
- win->GtkVScroll( adjust->value,
- GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->vscrollbar) );
-}
-
-//-----------------------------------------------------------------------------
-// "value_changed" from m_hAdjust
-//-----------------------------------------------------------------------------
-
-static void gtk_scrolled_window_hscroll_callback( GtkAdjustment *adjust,
- SCROLLBAR_CBACK_ARG
- wxScrolledWindow *win )
-{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- if (g_blockEventsOnDrag) return;
- if (!win->m_hasVMT) return;
-
- win->GtkHScroll( adjust->value,
- GET_SCROLL_TYPE(GTK_SCROLLED_WINDOW(win->m_widget)->hscrollbar) );
-}
-
-//-----------------------------------------------------------------------------
-// "button_press_event" from scrollbar
-//-----------------------------------------------------------------------------
-
-static gint gtk_scrollbar_button_press_callback( GtkRange *widget,
- GdkEventButton *gdk_event,
- wxWindowGTK *win)
-{
- if (g_isIdle)
- wxapp_install_idle_handler();
-
- g_blockEventsOnScroll = TRUE;
-
- // FIXME: there is no slider field any more, what was meant here?
-#ifndef __WXGTK20__
- win->m_isScrolling = (gdk_event->window == widget->slider);
-#endif
-
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// "button_release_event" from scrollbar
-//-----------------------------------------------------------------------------
-
-static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
- GdkEventButton *WXUNUSED(gdk_event),
- wxWindowGTK *win)
-{
-// don't test here as we can release the mouse while being over
-// a different window than the slider
-//
-// if (gdk_event->window != widget->slider) return FALSE;
-
- g_blockEventsOnScroll = FALSE;
-
- if (win->m_isScrolling)
- {
- wxEventType command = wxEVT_SCROLLWIN_THUMBRELEASE;
- int value = -1;
- int dir = -1;
-
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(win->m_widget);
- if (widget == GTK_RANGE(scrolledWindow->hscrollbar))
- {
- value = (int)(win->m_hAdjust->value+0.5);
- dir = wxHORIZONTAL;
- }
- if (widget == GTK_RANGE(scrolledWindow->vscrollbar))
- {
- value = (int)(win->m_vAdjust->value+0.5);
- dir = wxVERTICAL;
- }
-
- wxScrollWinEvent event( command, value, dir );
- event.SetEventObject( win );
- win->GetEventHandler()->ProcessEvent( event );
- }
-
- win->m_isScrolling = FALSE;
-
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// InsertChild for wxScrolledWindow
-//-----------------------------------------------------------------------------
-
-static void wxInsertChildInScrolledWindow( wxWindow* parent, wxWindow* child )
-{
- // The window might have been scrolled already, do we
- // have to adapt the position.
- GtkPizza *pizza = GTK_PIZZA(parent->m_wxwindow);
- child->m_x += pizza->xoffset;
- child->m_y += pizza->yoffset;
-
- gtk_pizza_put( GTK_PIZZA(parent->m_wxwindow),
- GTK_WIDGET(child->m_widget),
- child->m_x,
- child->m_y,
- child->m_width,
- child->m_height );
-}
-