cocoa: debugging routines

git-svn-id: trunk@61301 -
This commit is contained in:
dmitry 2019-05-30 03:08:20 +00:00
parent d884d16510
commit 949c132c96

View File

@ -157,6 +157,9 @@ function CocoaModifiersToKeyState(AModifiers: NSUInteger): PtrInt;
function CocoaPressedMouseButtonsToKeyState(AMouseButtons: NSUInteger): PtrInt;
function CocoaModifiersToShiftState(AModifiers: NSUInteger; AMouseButtons: NSUInteger): TShiftState;
function NSObjectDebugStr(obj: NSObject): string;
function CallbackDebugStr(cb: ICommonCallback): string;
implementation
uses
@ -1734,5 +1737,30 @@ begin
Result := cb.GetTarget;
end;
function NSObjectDebugStr(obj: NSObject): string;
begin
Result := IntToStr(PtrUInt(obj));
if Assigned(obj) then
Result := Result +' '+obj.lclClassName+' lcl: '+CallbackDebugStr(obj.lclGetCallback);
end;
function CallbackDebugStr(cb: ICommonCallback): string;
var
trg : TObject;
begin
Result := IntToStr(PtrUInt(cb));
if Assigned(cb) then
begin
trg := cb.GetTarget;
Result := Result + ' trg: '+IntToStr(PtrUInt(trg));
if Assigned(trg) then
begin
Result := Result + ' '+trg.ClassName;
if trg is TWinControl then
Result := Result +' '+TWinControl(trg).Name;
end;
end;
end;
end.