fix scrolling (win32)

git-svn-id: trunk@6601 -
This commit is contained in:
micha 2005-01-15 13:25:29 +00:00
parent b1cb0e902c
commit 32c65f7004
4 changed files with 49 additions and 2 deletions

View File

@ -133,7 +133,21 @@ begin
end; end;
procedure TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer); procedure TScrollingWinControl.ScrollBy(DeltaX, DeltaY: Integer);
var
Control: TControl;
I: integer;
begin begin
TWSScrollingWinControlClass(WidgetSetClass).ScrollBy(Self, DeltaX, DeltaY);
for I := 0 to ControlCount - 1 do
begin
Control := Controls[I];
if not (Control is TWinControl) or not TWinControl(Control).HandleAllocated then
begin
// widgetset does not know about this control
Control.SetBounds(Control.Left+DeltaX, Control.Top+DeltaY,
Control.Width, Control.Height);
end;
end;
Invalidate; Invalidate;
end; end;

View File

@ -40,6 +40,8 @@ type
private private
protected protected
public public
class procedure ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer); override;
end; end;
{ TGtkWSScrollBox } { TGtkWSScrollBox }
@ -115,6 +117,13 @@ implementation
{ TGtkWSCustomForm } { TGtkWSCustomForm }
procedure TGtkWSScrollingWinControl.ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer);
begin
end;
{ TGtkWSCustomForm }
procedure TGtkWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm; procedure TGtkWSCustomForm.SetFormBorderStyle(const AForm: TCustomForm;
const AFormBorderStyle: TFormBorderStyle); const AFormBorderStyle: TFormBorderStyle);
begin begin
@ -168,7 +177,7 @@ initialization
// To improve speed, register only classes // To improve speed, register only classes
// which actually implement something // which actually implement something
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// RegisterWSComponent(TScrollingWinControl, TGtkWSScrollingWinControl); RegisterWSComponent(TScrollingWinControl, TGtkWSScrollingWinControl);
// RegisterWSComponent(TScrollBox, TGtkWSScrollBox); // RegisterWSComponent(TScrollBox, TGtkWSScrollBox);
// RegisterWSComponent(TCustomFrame, TGtkWSCustomFrame); // RegisterWSComponent(TCustomFrame, TGtkWSCustomFrame);
// RegisterWSComponent(TFrame, TGtkWSFrame); // RegisterWSComponent(TFrame, TGtkWSFrame);

View File

@ -46,6 +46,8 @@ type
private private
protected protected
public public
class procedure ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer); override;
end; end;
{ TWin32WSScrollBox } { TWin32WSScrollBox }
@ -186,7 +188,19 @@ begin
Result := Params.Window; Result := Params.Window;
end; end;
{ TWin32WSScrollingWinControl }
function ScrollWindowPtr(hWnd:HWND; XAmount:longint; YAmount:longint; lpRect: pointer; lpClipRect: pointer):WINBOOL; stdcall; external 'user32' name 'ScrollWindow';
procedure TWin32WSScrollingWinControl.ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer);
var
lVisible: boolean;
begin
lVisible := AWinControl.HandleAllocated and Windows.IsWindowVisible(AWinControl.Handle);
if lVisible then
ScrollWindowPtr(AWinControl.Handle, DeltaX, DeltaY, nil, nil);
end;
{ TWin32WSCustomForm } { TWin32WSCustomForm }
@ -340,7 +354,7 @@ initialization
// To improve speed, register only classes // To improve speed, register only classes
// which actually implement something // which actually implement something
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// RegisterWSComponent(TScrollingWinControl, TWin32WSScrollingWinControl); RegisterWSComponent(TScrollingWinControl, TWin32WSScrollingWinControl);
RegisterWSComponent(TScrollBox, TWin32WSScrollBox); RegisterWSComponent(TScrollBox, TWin32WSScrollBox);
// RegisterWSComponent(TCustomFrame, TWin32WSCustomFrame); // RegisterWSComponent(TCustomFrame, TWin32WSCustomFrame);
// RegisterWSComponent(TFrame, TWin32WSFrame); // RegisterWSComponent(TFrame, TWin32WSFrame);

View File

@ -51,7 +51,10 @@ uses
type type
{ TWSScrollingWinControl } { TWSScrollingWinControl }
TWSScrollingWinControlClass = class of TWSScrollingWinControl;
TWSScrollingWinControl = class(TWSWinControl) TWSScrollingWinControl = class(TWSWinControl)
class procedure ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer); virtual;
end; end;
{ TWSScrollBox } { TWSScrollBox }
@ -105,6 +108,13 @@ type
implementation implementation
{ TWSScrollingWinControl }
procedure TWSScrollingWinControl.ScrollBy(const AWinControl: TScrollingWinControl;
const DeltaX, DeltaY: integer);
begin
end;
{ TWSCustomForm } { TWSCustomForm }
procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm); procedure TWSCustomForm.CloseModal(const ACustomForm: TCustomForm);