mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 11:38:18 +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 NSStringUtf8(const s: String): NSString;
|
||||||
function NSStringToString(ns: NSString): String;
|
function NSStringToString(ns: NSString): String;
|
||||||
|
|
||||||
function GetNSObjectView(obj: NSObject): NSView;
|
|
||||||
function GetNSObjectWindow(obj: NSObject): NSWindow;
|
function GetNSObjectWindow(obj: NSObject): NSWindow;
|
||||||
|
|
||||||
procedure SetNSText(text: NSText; const s: String); inline;
|
procedure SetNSText(text: NSText; const s: String); inline;
|
||||||
@ -449,36 +448,14 @@ begin
|
|||||||
result:=CFStringToStr(AString);
|
result:=CFStringToStr(AString);
|
||||||
end;
|
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;
|
function GetNSObjectWindow(obj: NSObject): NSWindow;
|
||||||
var
|
|
||||||
lView: NSView;
|
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
if not Assigned(obj) then Exit;
|
if not Assigned(obj) then Exit;
|
||||||
if obj.isKindOfClass_(NSWindow) then
|
if obj.isKindOfClass_(NSWindow) then
|
||||||
Result := NSWindow(obj)
|
Result := NSWindow(obj)
|
||||||
else
|
else if obj.isKindOfClass_(NSView) then
|
||||||
begin
|
Result := NSView(obj).window;
|
||||||
lView := GetNSObjectView(obj);
|
|
||||||
if lView <> nil then Result := lView.window;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetNSSize(width, height: CGFloat): NSSize; inline;
|
function GetNSSize(width, height: CGFloat): NSSize; inline;
|
||||||
|
Loading…
Reference in New Issue
Block a user