From c8f58afbfd79341bca1a9106f83f114ed40b3e28 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 27 Oct 2016 19:29:49 +0000 Subject: [PATCH] cocoa: Patch from Zoe Peterson to allow customizing Cocoa-LCL git-svn-id: trunk@53239 - --- lcl/interfaces/cocoa/cocoawsforms.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/cocoa/cocoawsforms.pp b/lcl/interfaces/cocoa/cocoawsforms.pp index c3d6be4610..7adcdc57da 100644 --- a/lcl/interfaces/cocoa/cocoawsforms.pp +++ b/lcl/interfaces/cocoa/cocoawsforms.pp @@ -99,6 +99,7 @@ type class function GetWindowFromHandle(const ACustomForm: TCustomForm): TCocoaWindow; class function GetWindowContentFromHandle(const ACustomForm: TCustomForm): TCocoaWindowContent; published + class function AllocWindowHandle: TCocoaWindow; virtual; class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override; @@ -439,6 +440,12 @@ begin Result := TCocoaWindowContent(ACustomForm.Handle); end; +// Some projects that use the LCL need to override this +class function TCocoaWSCustomForm.AllocWindowHandle: TCocoaWindow; +begin + Result := TCocoaWindow(TCocoaWindow.alloc); +end; + class function TCocoaWSCustomForm.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; var @@ -461,7 +468,7 @@ var if (AParams.Style and WS_CHILD) = 0 then begin - win := TCocoaWindow(TCocoaWindow.alloc); + win := AllocWindowHandle; if not Assigned(win) then begin