mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 17:59:26 +02:00
Cocoa: Control supported in TCocoaWidgetSet.GetWindowRect()
This commit is contained in:
parent
4f0ec7cefa
commit
aab12c6c54
@ -1063,21 +1063,30 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TCocoaWidgetSet.GetWindowRect(Handle: hwnd; var ARect: TRect): Integer;
|
function TCocoaWidgetSet.GetWindowRect(Handle: hwnd; var ARect: TRect): Integer;
|
||||||
var
|
var
|
||||||
contentView: TCocoaWindowContent;
|
view: NSObject;
|
||||||
|
contentView: TCocoaWindowContent absolute view;
|
||||||
|
dx, dy: Integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if Handle=0 then
|
if Handle=0 then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if not NSObject(Handle).isKindOfClass(TCocoaWindowContent) then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
contentView := TCocoaWindowContent(Handle);
|
|
||||||
if (not contentView.isembedded) and Assigned(contentView.window) then
|
|
||||||
ARect := ScreenRectFromNSToLCL( contentView.window.frame )
|
|
||||||
else
|
|
||||||
ARect := contentView.lclFrame;
|
|
||||||
Result := 1;
|
Result := 1;
|
||||||
|
view := NSObject(Handle);
|
||||||
|
if view.isKindOfClass(TCocoaWindowContent) then begin
|
||||||
|
// handle is Form / Window
|
||||||
|
if (not contentView.isembedded) and Assigned(contentView.window) then
|
||||||
|
ARect := ScreenRectFromNSToLCL( contentView.window.frame )
|
||||||
|
else
|
||||||
|
ARect := contentView.lclFrame;
|
||||||
|
end else begin
|
||||||
|
// handle is Control
|
||||||
|
ARect := view.lclFrame;
|
||||||
|
dx := 0;
|
||||||
|
dy := 0;
|
||||||
|
view.lclLocalToScreen( dx, dy );
|
||||||
|
MoveRect( ARect, dx, dy );
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCocoaWidgetSet.IsWindowEnabled(Handle: HWND): boolean;
|
function TCocoaWidgetSet.IsWindowEnabled(Handle: HWND): boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user