mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-01 21:20:28 +02:00
Cocoa: fix the setting of Custom Control with Flipped coordinates
Note that on Cocoa: 1. Not Flipped: opposite to win32 2. Flipped: like win32
This commit is contained in:
parent
ef1838e6d2
commit
d6afcd1953
@ -505,9 +505,15 @@ begin
|
||||
end;
|
||||
|
||||
procedure SetViewDefaults(AView: NSView);
|
||||
var
|
||||
mask: NSUInteger;
|
||||
begin
|
||||
if not Assigned(AView) then Exit;
|
||||
AView.setAutoresizingMask(NSViewMinYMargin or NSViewMaxXMargin);
|
||||
if Assigned(AView.superview) and AView.superview.isFlipped then
|
||||
mask:= NSViewMaxYMargin or NSViewMaxXMargin
|
||||
else
|
||||
mask:= NSViewMinYMargin or NSViewMaxXMargin;
|
||||
AView.setAutoresizingMask(mask);
|
||||
end;
|
||||
|
||||
function CheckMainThread: Boolean;
|
||||
@ -627,6 +633,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCocoaCustomControl.addSubView(aview: NSView);
|
||||
var
|
||||
mask: NSUInteger;
|
||||
begin
|
||||
inherited addSubView(aview);
|
||||
|
||||
@ -639,7 +647,11 @@ begin
|
||||
{$else}
|
||||
setAutoresizesSubviews(true);
|
||||
{$endif}
|
||||
aview.setAutoresizingMask(NSViewMaxXMargin or NSViewMinYMargin);
|
||||
if self.isFlipped then
|
||||
mask:= NSViewMaxYMargin or NSViewMaxXMargin
|
||||
else
|
||||
mask:= NSViewMinYMargin or NSViewMaxXMargin;
|
||||
aview.setAutoresizingMask(mask);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1360,7 +1372,7 @@ begin
|
||||
if (AParams.WndParent <> 0) then
|
||||
p := NSView(AParams.WndParent).lclContentView;
|
||||
|
||||
if Assigned(p) then
|
||||
if Assigned(p) and p.isFlipped then
|
||||
LCLToNSRect(Types.Bounds(AParams.X, AParams.Y, AParams.Width, AParams.Height),
|
||||
p.frame.size.height, ns)
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user