Cocoa/CrossRef: Remove unit cross-references between CocoaInt and CocoaWSCommon

This commit is contained in:
rich2014 2023-11-19 17:50:53 +08:00
parent 365360bd90
commit 1adaff6dae
4 changed files with 35 additions and 50 deletions

View File

@ -28,14 +28,14 @@ interface
uses
// rtl+ftl
Types, Classes, SysUtils, Math, GraphMath,
// carbon bindings
MacOSAll,
// interfacebase
LCLPlatformDef, InterfaceBase, GraphType,
// darwin bindings
MacOSAll,
// private
CocoaAll, CocoaConfig, CocoaPrivate, CocoaUtils, CocoaGDIObjects, CocoaCursor,
cocoa_extra, CocoaMenus, CocoaWindows, CocoaScrollers,
CocoaWSClipboard, CocoaTextEdits, CocoaWSCommon,
CocoaWSClipboard, CocoaTextEdits,
// LCL
LMessages, LCLProc, LCLIntf, LCLType,
Controls, Forms, Themes, Menus,
@ -283,6 +283,27 @@ const
var
MainPool : NSAutoreleasePool = nil;
function HWNDToTargetObject(AFormHandle: HWND): TObject;
var
cb : ICommonCallback;
begin
Result := nil;
if AFormHandle = 0 then Exit;
cb := NSObject(AFormHandle).lclGetCallback;
if not Assigned(cb) then Exit;
Result := cb.GetTarget;
end;
function HWNDToForm(AFormHandle: HWND): TCustomForm;
var
obj : TObject;
begin
obj := HWNDToTargetObject(AFormHandle);
if Assigned(obj) and (obj is TCustomForm)
then Result := TCustomForm(obj)
else Result := nil;
end;
procedure InternalInit;
begin
// MacOSX 10.6 reports a lot of warnings during initialization process

View File

@ -1443,9 +1443,7 @@ begin
Result := Assigned(cbi);
if not Result then Exit;
obj := cbi.GetCallbackObject;
Result := (obj is TLCLCommonCallback)
and (HWND(TLCLCommonCallback(obj).HandleFrame)=handle);
Result:= NSObject(handle).isKindOfClass(TCocoaWindowContent);
end
else
Result := False;
@ -2138,7 +2136,7 @@ var
view : NSView;
dl : NSObject;
cb : ICommonCallback;
cbobj : TObject;
lclobj : TObject;
begin
Result := 0;
win := NSApp.keyWindow;
@ -2164,16 +2162,9 @@ begin
end
else
begin
cb := rsp.lclGetCallback;
if Assigned(cb) then
cbobj := cb.GetCallbackObject
else
cbobj := nil;
if (cbobj is TLCLCommonCallback) then
Result := HWND(TLCLCommonCallback(cbobj).HandleFrame)
else
Result := 0;
lclobj := rsp.lclGetTarget;
if lclobj is TWinControl then
Result := TWinControl(lclobj).Handle;
end;
end;

View File

@ -27,7 +27,7 @@ uses
Types, Classes, SysUtils,
CGGeometry,
// Libs
MacOSAll, CocoaAll, CocoaUtils, CocoaCursor, CocoaWScommon,
MacOSAll, CocoaAll, CocoaUtils, CocoaCursor,
cocoa_extra, CocoaPrivate, CocoaTextEdits, CocoaScrollers,
// LCL
//Forms,

View File

@ -8,13 +8,10 @@ unit CocoaWSCommon;
interface
uses
Types,
CocoaAll, cocoa_extra,
Classes, Controls, SysUtils,
//
WSControls, LCLType, LMessages, LCLProc, LCLIntf, Graphics, Forms,
CocoaConfig, CocoaPrivate, CocoaGDIObjects, CocoaCursor, CocoaCaret, CocoaUtils, LCLMessageGlue,
CocoaScrollers;
Types, Classes, Controls, SysUtils,
WSControls, LCLType, LCLMessageGlue, LMessages, LCLProc, LCLIntf, Graphics, Forms,
CocoaAll, CocoaInt, CocoaConfig, CocoaPrivate, CocoaUtils,
CocoaGDIObjects, CocoaCursor, CocoaCaret, CocoaScrollers, cocoa_extra;
type
{ TLCLCommonCallback }
@ -182,9 +179,6 @@ function EmbedInScrollView(AView: NSView; AReleaseView: Boolean = true): TCocoaS
function EmbedInManualScrollView(AView: NSView): TCocoaManualScrollView;
function EmbedInManualScrollHost(AView: TCocoaManualScrollView): TCocoaManualScrollHost;
function HWNDToTargetObject(AFormHandle: HWND): TObject;
function HWNDToForm(AFormHandle: HWND): TCustomForm;
procedure ScrollViewSetBorderStyle(sv: NSScrollView; astyle: TBorderStyle);
procedure UpdateFocusRing(v: NSView; astyle: TBorderStyle);
@ -200,7 +194,7 @@ procedure DebugDumpParents(fromView: NSView);
implementation
uses
Math, CocoaInt;
Math;
var
LastMouse: TLastMouseInfo;
@ -2038,27 +2032,6 @@ begin
ScrollViewSetBorderStyle( TCocoaManualScrollHost(AWinControl.Handle), ABorderStyle );
end;
function HWNDToTargetObject(AFormHandle: HWND): TObject;
var
cb : ICommonCallback;
begin
Result := nil;
if AFormHandle = 0 then Exit;
cb := NSObject(AFormHandle).lclGetCallback;
if not Assigned(cb) then Exit;
Result := cb.GetTarget;
end;
function HWNDToForm(AFormHandle: HWND): TCustomForm;
var
obj : TObject;
begin
obj := HWNDToTargetObject(AFormHandle);
if Assigned(obj) and (obj is TCustomForm)
then Result := TCustomForm(obj)
else Result := nil;
end;
function NSObjectDebugStr(obj: NSObject): string;
begin
Result := IntToStr(PtrUInt(obj));