Added new scrolling code.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2002-02-15 20:25:40 +00:00
parent 923d52d6fe
commit 4125131be6
3 changed files with 66 additions and 17 deletions

View File

@@ -763,6 +763,12 @@ int wxWindow::GetScrollRange(int orient) const
void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
{
#ifdef __WXX11__
wxWindowX11::ScrollWindow( dx, dy, rect );
#else
// before scrolling it, ensure that we don't have any unpainted areas
Update();
@@ -779,6 +785,8 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
r = ScrollNoRefresh(0, dy, rect);
Refresh(TRUE /* erase bkgnd */, &r);
}
#endif
}
wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal)

View File

@@ -405,7 +405,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
wxWindow* win = NULL;
Window window = event->xany.window;
Window actualWindow = window;
// Find the first wxWindow that corresponds to this event window
// Because we're receiving events after a window
// has been destroyed, assume a 1:1 match between
@@ -548,6 +548,26 @@ void wxApp::ProcessXEvent(WXEvent* _event)
return;
}
case GraphicsExpose:
{
if (win)
{
wxLogDebug( "GraphicsExpose from %s", win->GetName().c_str(),
event->xgraphicsexpose.x, event->xgraphicsexpose.y,
event->xgraphicsexpose.width, event->xgraphicsexpose.height);
win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
event->xgraphicsexpose.width, event->xgraphicsexpose.height);
win->GetClearRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y,
event->xgraphicsexpose.width, event->xgraphicsexpose.height);
// if (event->xgraphicsexpose.count == 0)
// win->Update();
}
return;
}
case EnterNotify:
case LeaveNotify:
case ButtonPress:
@@ -585,7 +605,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
if (win && event->xfocus.detail != NotifyPointer)
#endif
{
wxLogDebug( "FocusOut from %s\n", win->GetName().c_str() );
wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
focusEvent.SetEventObject(win);

View File

@@ -469,34 +469,55 @@ void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
GC xgc = XCreateGC( xdisplay, xwindow, 0, NULL );
XSetGraphicsExposures( xdisplay, xgc, True );
int cw = 0;
int ch = 0;
GetClientSize( &cw, &ch );
int s_x;
int s_y;
int cw;
int ch;
if (rect)
{
s_x = rect->x;
s_y = rect->y;
cw = rect->width;
ch = rect->height;
}
else
{
s_x = 0;
s_y = 0;
GetClientSize( &cw, &ch );
}
wxPoint offset = GetClientAreaOrigin();
s_x += offset.x;
s_y += offset.y;
int w = cw - abs(dx);
int h = ch - abs(dy);
if ((h < 0) || (w < 0))
{
Refresh();
}
else
{
int s_x = 0;
int s_y = 0;
if (dx < 0) s_x = -dx;
if (dy < 0) s_y = -dy;
int d_x = 0;
int d_y = 0;
wxRect rect;
if (dx < 0) rect.x = cw+dx; else rect.x = s_x;
if (dy < 0) rect.y = ch+dy; else rect.y = s_y;
if (dy != 0) rect.width = cw; else rect.width = abs(dx);
if (dx != 0) rect.height = ch; else rect.height = abs(dy);
int d_x = s_x;
int d_y = s_y;
if (dx < 0) s_x += -dx;
if (dy < 0) s_y += -dy;
if (dx > 0) d_x = dx;
if (dy > 0) d_y = dy;
XCopyArea( xdisplay, xwindow, xwindow, xgc, s_x, s_y, w, h, d_x, d_y );
// printf( "s_x %d s_y %d w %d h %d d_x %d d_y %d\n", s_x, s_y, w, h, d_x, d_y );
wxRect rect;
if (dx < 0) rect.x = cw+dx; else rect.x = 0;
if (dy < 0) rect.y = ch+dy; else rect.y = 0;
if (dy != 0) rect.width = cw; else rect.width = abs(dx);
if (dx != 0) rect.height = ch; else rect.height = abs(dy);
// printf( "rect %d %d %d %d\n", rect.x, rect.y, rect.width, rect.height );
m_updateRegion.Union( rect );
m_clearRegion.Union( rect );