GTK2 ScrollWindowEx / flag and prcUpdate

git-svn-id: trunk@34889 -
This commit is contained in:
martin 2012-01-23 20:33:24 +00:00
parent 61e36cdd59
commit 53db968eab

View File

@ -7409,6 +7409,9 @@ begin
if Widget = nil then exit; if Widget = nil then exit;
Window:=GetControlWindow(Widget); Window:=GetControlWindow(Widget);
if Window = nil then exit; if Window = nil then exit;
Result := true;
{$ifdef GTK_2_8} {$ifdef GTK_2_8}
RClient.Left := 0;//Widget^.Allocation.Left; RClient.Left := 0;//Widget^.Allocation.Left;
RClient.Top := 0; //Widget^.Allocation.Top; RClient.Top := 0; //Widget^.Allocation.Top;
@ -7488,74 +7491,84 @@ begin
Region := gdk_region_rectangle(@Rect1); Region := gdk_region_rectangle(@Rect1);
gdk_window_move_region(Window, Region, dx, dy); gdk_window_move_region(Window, Region, dx, dy);
//invalidate if (flags and SW_INVALIDATE) <> 0 then begin
If RUsableTarget.Left > RFullSource.Left then begin //invalidate
Rect2 := RFullSource; If RUsableTarget.Left > RFullSource.Left then begin
Rect2.Right:= RUsableTarget.Left; Rect2 := RFullSource;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Left', dbgs(Rect2)]);{$ENDIF} Rect2.Right:= RUsableTarget.Left;
InvalidateRect(hWnd, @Rect2, false); {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Left', dbgs(Rect2)]);{$ENDIF}
end; InvalidateRect(hWnd, @Rect2, false);
if (prcUpdate <> nil) and (dx > 0) then prcUpdate^ := Rect2;
end;
If RUsableTarget.Right < RFullSource.Right then begin If RUsableTarget.Right < RFullSource.Right then begin
Rect2 := RFullSource; Rect2 := RFullSource;
Rect2.Left:= RUsableTarget.Right; Rect2.Left:= RUsableTarget.Right;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Right', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Right', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; if (prcUpdate <> nil) and (dx < 0) then prcUpdate^ := Rect2;
end;
If RUsableTarget.Top > RFullSource.Top then begin If RUsableTarget.Top > RFullSource.Top then begin
Rect2 := RFullSource; Rect2 := RFullSource;
Rect2.Bottom:= RUsableTarget.Top; Rect2.Bottom:= RUsableTarget.Top;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Top', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Top', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; if (prcUpdate <> nil) and (dy > 0) then prcUpdate^ := Rect2;
end;
If RUsableTarget.Bottom < RFullSource.Bottom then begin If RUsableTarget.Bottom < RFullSource.Bottom then begin
Rect2 := RFullSource; Rect2 := RFullSource;
Rect2.Top:= RUsableTarget.Bottom; Rect2.Top:= RUsableTarget.Bottom;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Bottom', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate Src Bottom', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; if (prcUpdate <> nil) and (dy < 0) then prcUpdate^ := Rect2;
end;
If RUsableTarget.Left > RTarget.Left then begin If RUsableTarget.Left > RTarget.Left then begin
Rect2 := RTarget; Rect2 := RTarget;
Rect2.Right:= RUsableTarget.Left; Rect2.Right:= RUsableTarget.Left;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Left', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Left', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; end;
If RUsableTarget.Right < RTarget.Right then begin If RUsableTarget.Right < RTarget.Right then begin
Rect2 := RTarget; Rect2 := RTarget;
Rect2.Left:= RUsableTarget.Right; Rect2.Left:= RUsableTarget.Right;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Right', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Right', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; end;
If RUsableTarget.Top > RTarget.Top then begin If RUsableTarget.Top > RTarget.Top then begin
Rect2 := RTarget; Rect2 := RTarget;
Rect2.Bottom:= RUsableTarget.Top; Rect2.Bottom:= RUsableTarget.Top;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Top', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Top', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end; end;
If RUsableTarget.Bottom < RTarget.Bottom then begin If RUsableTarget.Bottom < RTarget.Bottom then begin
Rect2 := RTarget; Rect2 := RTarget;
Rect2.Top:= RUsableTarget.Bottom; Rect2.Top:= RUsableTarget.Bottom;
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Bottom', dbgs(Rect2)]);{$ENDIF} {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate TARGET Bottom', dbgs(Rect2)]);{$ENDIF}
InvalidateRect(hWnd, @Rect2, false); InvalidateRect(hWnd, @Rect2, false);
end;
end; end;
end end
else begin else begin
// invalidate, nothing to scroll if (flags and SW_INVALIDATE) <> 0 then begin
{$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate all', dbgs(RUsableSource)]);{$ENDIF} // invalidate, nothing to scroll
InvalidateRect(hWnd, @RFullSource, false); {$ifdef VerboseScrollWindowEx}DebugLn(['ScrollWindowEx Invalidate all', dbgs(RUsableSource)]);{$ENDIF}
InvalidateRect(hWnd, @RTarget, false); InvalidateRect(hWnd, @RFullSource, false);
InvalidateRect(hWnd, @RTarget, false);
end
else
Result := False;
end; end;
{$ELSE} {$ELSE}
gdk_window_scroll(Window, dx, dy); gdk_window_scroll(Window, dx, dy);
{$ENDIF}
Result := true; Result := true;
{$ENDIF}
end; end;