Cocoa: TCocoaWidgetSet.GetWindowRelativePosition() removed

TWidgetSet.GetWindowRelativePosition() works fine
This commit is contained in:
rich2014 2023-10-28 19:29:51 +08:00
parent e3a53a2a42
commit 408f836d14
4 changed files with 0 additions and 50 deletions

View File

@ -138,7 +138,6 @@ type
// Returns the position of the view or window, in the immediate
// parent (view or screen), relative to its client coordinates system
// Left and Top are always returned in LCL coordinate system.
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::';
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::';
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::';
function lclParent: id; message 'lclParent';
@ -177,7 +176,6 @@ type
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
procedure lclUpdate; message 'lclUpdate'; reintroduce;
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::'; reintroduce;
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
function lclParent: id; message 'lclParent'; reintroduce;
@ -1216,10 +1214,6 @@ procedure LCLObjectExtension.lclUpdate;
begin
end;
procedure LCLObjectExtension.lclRelativePos(var Left,Top: Integer);
begin
end;
procedure LCLObjectExtension.lclLocalToScreen(var X,Y: Integer);
begin
end;
@ -1481,22 +1475,6 @@ begin
//display;
end;
procedure LCLViewExtension.lclRelativePos(var Left, Top: Integer);
var
sv : NSView;
fr : NSRect;
begin
Left := Round(frame.origin.x);
sv := superview;
if Assigned(sv) and (not sv.isFlipped) then
begin
fr := frame;
Top := Round(sv.frame.size.height - fr.origin.y - fr.size.height);
end
else
Top := Round(frame.origin.y);
end;
procedure LCLViewExtension.lclLocalToScreen(var X, Y:Integer);
var
P: NSPoint;

View File

@ -1326,13 +1326,6 @@ begin
Result:=0;
end;
function TCocoaWidgetSet.GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean;
begin
Result := Handle <> 0;
if Result then
NSObject(handle).lclRelativePos(Left, Top);
end;
// 1. not only for Window, but also for other controls
// 2. for a Window, according to this function specification, Width and Height
// should be returned. but ClientWidth and ClientHeight were returned

View File

@ -122,7 +122,6 @@ function GetViewPortOrgEx(DC: HDC; P: PPoint): Integer; override;
{function GetWindowLong(Handle : hwnd; int: Integer): PtrInt; override;}
function GetWindowOrgEx(dc : hdc; P : PPoint): Integer; override;
function GetWindowRect(Handle: hwnd; var ARect: TRect): Integer; override;
function GetWindowRelativePosition(Handle: hwnd; var Left, Top: Integer): boolean; override;
function GetWindowSize(Handle: hwnd; var Width, Height: Integer): boolean; override;
function HideCaret(Handle: HWND): Boolean; override;

View File

@ -47,7 +47,6 @@ type
procedure lclInvalidateRect(const r: TRect); message 'lclInvalidateRect:'; reintroduce;
procedure lclInvalidate; message 'lclInvalidate'; reintroduce;
procedure lclUpdate; message 'lclUpdate'; reintroduce;
procedure lclRelativePos(var Left, Top: Integer); message 'lclRelativePos::'; reintroduce;
procedure lclLocalToScreen(var X, Y: Integer); message 'lclLocalToScreen::'; reintroduce;
procedure lclScreenToLocal(var X, Y: Integer); message 'lclScreenToLocal::'; reintroduce;
function lclFrame: TRect; message 'lclFrame'; reintroduce;
@ -222,7 +221,6 @@ type
function lclOwnWindow: NSWindow; message 'lclOwnWindow';
procedure lclSetFrame(const r: TRect); override;
function lclFrame: TRect; override;
procedure lclRelativePos(var Left, Top: Integer); override;
procedure viewDidMoveToSuperview; override;
procedure viewDidMoveToWindow; override;
procedure viewWillMoveToWindow(newWindow: CocoaAll.NSWindow); override;
@ -451,14 +449,6 @@ begin
end;
end;
procedure TCocoaWindowContent.lclRelativePos(var Left, Top: Integer);
begin
if isembedded then
inherited lclRelativePos(Left, Top)
else
window.lclRelativePos(Left, Top);
end;
procedure TCocoaWindowContent.viewDidMoveToSuperview;
begin
inherited viewDidMoveToSuperview;
@ -1234,16 +1224,6 @@ begin
contentView.lclUpdate;
end;
procedure LCLWindowExtension.lclRelativePos(var Left, Top: Integer);
var
f: NSRect;
begin
f:=frame;
Left := Round(f.origin.x);
Top := Round(NSGlobalScreenHeight - NSMaxY(f));
//debugln('Top:'+dbgs(Top));
end;
procedure LCLWindowExtension.lclLocalToScreen(var X, Y:Integer);
var
f: NSRect;