- int old_y = m_yScrollPosition;
- m_yScrollPosition = y_pos;
- m_vAdjust->value = y_pos;
-
- wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
- wxScrollWinEvent event( command, m_yScrollPosition, wxVERTICAL );
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
-
- m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
-
- gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "value_changed" );
- }
-}
-
-void wxScrolledWindow::GtkVScroll( float value )
-{
- if (!m_targetWindow)
- return;
-
- if (m_yScrollPixelsPerLine == 0)
- return;
-
- int y_pos = (int)(value+0.5);
-
- if (y_pos == m_yScrollPosition)
- return;
-
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
- GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar);
-
- wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
- if (range->scroll_type == GTK_SCROLL_STEP_BACKWARD) command = wxEVT_SCROLLWIN_LINEUP;
- else if (range->scroll_type == GTK_SCROLL_STEP_FORWARD) command = wxEVT_SCROLLWIN_LINEDOWN;
- else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLLWIN_PAGEUP;
- else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLLWIN_PAGEDOWN;
-
- wxScrollWinEvent event( command, y_pos, wxVERTICAL );
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
-
-/*
- int old_y = m_yScrollPosition;
- m_yScrollPosition = y_pos;
-
- m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine );
-*/
-}
-
-void wxScrolledWindow::GtkHScroll( float value )
-{
- if (!m_targetWindow)
- return;
-
- if (m_xScrollPixelsPerLine == 0)
- return;
-
- int x_pos = (int)(value+0.5);
-
- if (x_pos == m_xScrollPosition)
- return;
-
- GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
- GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar);
-
- wxEventType command = wxEVT_SCROLLWIN_THUMBTRACK;
- if (range->scroll_type == GTK_SCROLL_STEP_BACKWARD) command = wxEVT_SCROLLWIN_LINEUP;
- else if (range->scroll_type == GTK_SCROLL_STEP_FORWARD) command = wxEVT_SCROLLWIN_LINEDOWN;
- else if (range->scroll_type == GTK_SCROLL_PAGE_BACKWARD) command = wxEVT_SCROLLWIN_PAGEUP;
- else if (range->scroll_type == GTK_SCROLL_PAGE_FORWARD) command = wxEVT_SCROLLWIN_PAGEDOWN;
-
- wxScrollWinEvent event( command, x_pos, wxHORIZONTAL );
- event.SetEventObject( this );
- GetEventHandler()->ProcessEvent( event );
-
-/*
- int old_x = m_xScrollPosition;
- m_xScrollPosition = x_pos;
-
- m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0 );
-*/
-}
-
-void wxScrolledWindow::EnableScrolling (bool x_scroll, bool y_scroll)
-{
- m_xScrollingEnabled = x_scroll;
- m_yScrollingEnabled = y_scroll;
-}
-
-void wxScrolledWindow::GetVirtualSize (int *x, int *y) const
-{
- if ( x )
- *x = m_xScrollPixelsPerLine * m_xScrollLines;
- if ( y )
- *y = m_yScrollPixelsPerLine * m_yScrollLines;
-}
-
-// Where the current view starts from
-void wxScrolledWindow::GetViewStart (int *x, int *y) const
-{
- if ( x )
- *x = m_xScrollPosition;
- if ( y )
- *y = m_yScrollPosition;
-}
-
-void wxScrolledWindow::CalcScrolledPosition(int x, int y, int *xx, int *yy) const
-{
- if ( xx )
- *xx = x - m_xScrollPosition * m_xScrollPixelsPerLine;
- if ( yy )
- *yy = y - m_yScrollPosition * m_yScrollPixelsPerLine;
-}