cocoa: getting rid of GetNSObjectView

git-svn-id: trunk@61766 -
This commit is contained in:
dmitry 2019-08-27 19:25:24 +00:00
parent f4ad53c071
commit 6a0eef0c01

View File

@ -48,7 +48,6 @@ function NSStringUtf8(s: PChar): NSString;
function NSStringUtf8(const s: String): NSString;
function NSStringToString(ns: NSString): String;
function GetNSObjectView(obj: NSObject): NSView;
function GetNSObjectWindow(obj: NSObject): NSWindow;
procedure SetNSText(text: NSText; const s: String); inline;
@ -449,36 +448,14 @@ begin
result:=CFStringToStr(AString);
end;
// Return the content view of a given non-view or
// for a view. For Window and Box and similar containers
// it returns the content view
function GetNSObjectView(obj: NSObject): NSView;
begin
Result := nil;
if not Assigned(obj) then Exit;
if obj.isKindOfClass_(NSBox) then
Result := NSBox(obj).contentView
else if obj.isKindOfClass_(NSView) then
Result := NSView(obj)
else if obj.isKindOfClass_(NSWindow) then
Result := NSWindow(obj).contentView
else if obj.isKindOfClass_(NSTabViewItem) then
Result := NSTabViewItem(obj).view;
end;
function GetNSObjectWindow(obj: NSObject): NSWindow;
var
lView: NSView;
begin
Result := nil;
if not Assigned(obj) then Exit;
if obj.isKindOfClass_(NSWindow) then
Result := NSWindow(obj)
else
begin
lView := GetNSObjectView(obj);
if lView <> nil then Result := lView.window;
end;
else if obj.isKindOfClass_(NSView) then
Result := NSView(obj).window;
end;
function GetNSSize(width, height: CGFloat): NSSize; inline;