mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 12:01:27 +01:00 
			
		
		
		
	Cocoa: remove circle references between CocoaInt and CocoaWSCommon
This commit is contained in:
		
							parent
							
								
									e16acf9623
								
							
						
					
					
						commit
						1c81206a45
					
				| @ -82,6 +82,8 @@ type | |||||||
| 
 | 
 | ||||||
|     procedure InputClientInsertText(const utf8: string); |     procedure InputClientInsertText(const utf8: string); | ||||||
| 
 | 
 | ||||||
|  |     function HandleFrame: NSView; | ||||||
|  | 
 | ||||||
|     // properties |     // properties | ||||||
|     property HasCaret: Boolean read GetHasCaret write SetHasCaret; |     property HasCaret: Boolean read GetHasCaret write SetHasCaret; | ||||||
|     property IsOpaque: Boolean read GetIsOpaque write SetIsOpaque; |     property IsOpaque: Boolean read GetIsOpaque write SetIsOpaque; | ||||||
|  | |||||||
| @ -278,7 +278,7 @@ implementation | |||||||
| 
 | 
 | ||||||
| uses | uses | ||||||
|   dl,dynlibs, |   dl,dynlibs, | ||||||
|   CocoaWSCommon, CocoaCaret, CocoaThemes; |   CocoaCaret, CocoaThemes; | ||||||
| 
 | 
 | ||||||
| const | const | ||||||
|   // Lack of documentation, provisional definition |   // Lack of documentation, provisional definition | ||||||
|  | |||||||
| @ -1517,21 +1517,18 @@ end; | |||||||
| 
 | 
 | ||||||
| function TCocoaWidgetSet.IsWindow(handle: HWND): boolean; | function TCocoaWidgetSet.IsWindow(handle: HWND): boolean; | ||||||
| var | var | ||||||
|   cbi : ICommonCallback; |   cb: ICommonCallback; | ||||||
|   obj : TObject; |  | ||||||
| begin | begin | ||||||
|   if handle <> 0 then |   Result:= False; | ||||||
|   begin |  | ||||||
|     cbi := NSObject(handle).lclGetCallback; |  | ||||||
|     Result := Assigned(cbi); |  | ||||||
|     if not Result then Exit; |  | ||||||
| 
 | 
 | ||||||
|     obj := cbi.GetCallbackObject; |   if handle = 0 then | ||||||
|     Result :=  (obj is TLCLCommonCallback) |     Exit; | ||||||
|        and (HWND(TLCLCommonCallback(obj).HandleFrame)=handle); | 
 | ||||||
|   end |   cb:= NSObject(handle).lclGetCallback; | ||||||
|   else |   if NOT Assigned(cb) then | ||||||
|     Result := False; |     Exit; | ||||||
|  | 
 | ||||||
|  |   Result:= ( HWND(cb.HandleFrame) = handle ); | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| function TCocoaWidgetSet.WindowFromPoint(Point: TPoint): HWND; | function TCocoaWidgetSet.WindowFromPoint(Point: TPoint): HWND; | ||||||
|  | |||||||
| @ -45,6 +45,7 @@ type | |||||||
|     _isCocoaOnlyState: Boolean; |     _isCocoaOnlyState: Boolean; | ||||||
|     _UTF8Character : array [0..7] of TUTF8Char; |     _UTF8Character : array [0..7] of TUTF8Char; | ||||||
|     _UTF8Charcount : Integer; |     _UTF8Charcount : Integer; | ||||||
|  |     _handleFrame: NSView; // HWND and "frame" (rectangle) of the a control | ||||||
|   private |   private | ||||||
|     procedure send_UTF8KeyPress(); |     procedure send_UTF8KeyPress(); | ||||||
|     procedure send_CN_CHAR_Message(); |     procedure send_CN_CHAR_Message(); | ||||||
| @ -60,7 +61,6 @@ type | |||||||
|     procedure KeyEvPrepare(Event: NSEvent); virtual; |     procedure KeyEvPrepare(Event: NSEvent); virtual; | ||||||
|   public |   public | ||||||
|     Owner: NSObject; |     Owner: NSObject; | ||||||
|     HandleFrame: NSView; // HWND and "frame" (rectangle) of the a control |  | ||||||
|     BlockCocoaUpDown: Boolean; |     BlockCocoaUpDown: Boolean; | ||||||
|     BlockCocoaKeyBeep: Boolean; |     BlockCocoaKeyBeep: Boolean; | ||||||
|     BlockCocoaMouseMove: Boolean; |     BlockCocoaMouseMove: Boolean; | ||||||
| @ -113,6 +113,9 @@ type | |||||||
| 
 | 
 | ||||||
|     procedure InputClientInsertText(const utf8: string); |     procedure InputClientInsertText(const utf8: string); | ||||||
| 
 | 
 | ||||||
|  |     function HandleFrame: NSView; | ||||||
|  |     procedure SetHandleFrame( AHandleFrame: NSView ); | ||||||
|  | 
 | ||||||
|     property HasCaret: Boolean read GetHasCaret write SetHasCaret; |     property HasCaret: Boolean read GetHasCaret write SetHasCaret; | ||||||
|     property Target: TWinControl read FTarget; |     property Target: TWinControl read FTarget; | ||||||
|     property IsOpaque: Boolean read GetIsOpaque write SetIsOpaque; |     property IsOpaque: Boolean read GetIsOpaque write SetIsOpaque; | ||||||
| @ -398,9 +401,9 @@ begin | |||||||
|   inherited Create; |   inherited Create; | ||||||
|   Owner := AOwner; |   Owner := AOwner; | ||||||
|   if Assigned(AHandleFrame) then |   if Assigned(AHandleFrame) then | ||||||
|     HandleFrame := AHandleFrame |     _handleFrame := AHandleFrame | ||||||
|   else if Owner.isKindOfClass(NSView) then |   else if Owner.isKindOfClass(NSView) then | ||||||
|     HandleFrame := NSView(AOwner); |     _handleFrame := NSView(AOwner); | ||||||
|   FTarget := ATarget; |   FTarget := ATarget; | ||||||
|   FContext := nil; |   FContext := nil; | ||||||
|   FHasCaret := False; |   FHasCaret := False; | ||||||
| @ -476,7 +479,7 @@ begin | |||||||
|   ContextMenuHandled := false; |   ContextMenuHandled := false; | ||||||
|   FillChar(MsgContext, SizeOf(MsgContext), #0); |   FillChar(MsgContext, SizeOf(MsgContext), #0); | ||||||
|   MsgContext.Msg := LM_CONTEXTMENU; |   MsgContext.Msg := LM_CONTEXTMENU; | ||||||
|   MsgContext.hWnd := HWND(HandleFrame); |   MsgContext.hWnd := HWND(_handleFrame); | ||||||
|   MousePos := Event.locationInWindow; |   MousePos := Event.locationInWindow; | ||||||
|   ScreenMousePos(MousePos); |   ScreenMousePos(MousePos); | ||||||
|   MsgContext.XPos := Round(MousePos.X); |   MsgContext.XPos := Round(MousePos.X); | ||||||
| @ -1557,6 +1560,16 @@ begin | |||||||
| 
 | 
 | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
|  | function TLCLCommonCallback.HandleFrame: NSView; | ||||||
|  | begin | ||||||
|  |   Result:= _handleFrame; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
|  | procedure TLCLCommonCallback.SetHandleFrame(AHandleFrame: NSView); | ||||||
|  | begin | ||||||
|  |   _handleFrame:= AHandleFrame; | ||||||
|  | end; | ||||||
|  | 
 | ||||||
| function TLCLCommonCallback.GetIsOpaque: Boolean; | function TLCLCommonCallback.GetIsOpaque: Boolean; | ||||||
| begin | begin | ||||||
|   Result:= FIsOpaque; |   Result:= FIsOpaque; | ||||||
| @ -2035,7 +2048,7 @@ begin | |||||||
| 
 | 
 | ||||||
|   hs := EmbedInManualScrollHost(sl); |   hs := EmbedInManualScrollHost(sl); | ||||||
|   hs.callback := ctrl.callback; |   hs.callback := ctrl.callback; | ||||||
|   lcl.HandleFrame:=hs; |   lcl.SetHandleFrame(hs); | ||||||
| 
 | 
 | ||||||
|   ScrollViewSetBorderStyle(hs, TCustomControl(AWinControl).BorderStyle ); |   ScrollViewSetBorderStyle(hs, TCustomControl(AWinControl).BorderStyle ); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -2565,7 +2565,7 @@ begin | |||||||
|     Result := 0; |     Result := 0; | ||||||
|     Exit; |     Exit; | ||||||
|   end; |   end; | ||||||
|   cb.HandleFrame := scroll; |   cb.SetHandleFrame(scroll); | ||||||
|   scroll.callback := list.callback; |   scroll.callback := list.callback; | ||||||
|   scroll.setHasVerticalScroller(true); |   scroll.setHasVerticalScroller(true); | ||||||
|   scroll.setHasHorizontalScroller(true); |   scroll.setHasHorizontalScroller(true); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 rich2014
						rich2014