mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 07:13:59 +02:00
cocoa: getting rid of GetNSObjectView
git-svn-id: trunk@61766 -
This commit is contained in:
parent
f4ad53c071
commit
6a0eef0c01
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user