1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00
Files
.github
bin
demos
packages
source
res
00-DeleteDCUs.bat
cef.inc
uCEFAccessibilityHandler.pas
uCEFApp.pas
uCEFApplication.pas
uCEFApplicationCore.pas
uCEFArgCopy.pas
uCEFAudioHandler.pas
uCEFAuthCallback.pas
uCEFBaseRefCounted.pas
uCEFBaseScopedWrapper.pas
uCEFBeforeDownloadCallback.pas
uCEFBinaryValue.pas
uCEFBitmapBitBuffer.pas
uCEFBoxLayout.pas
uCEFBrowser.pas
uCEFBrowserProcessHandler.pas
uCEFBrowserView.pas
uCEFBrowserViewComponent.pas
uCEFBrowserViewDelegate.pas
uCEFBrowserWindow.pas
uCEFBufferPanel.pas
uCEFButton.pas
uCEFButtonComponent.pas
uCEFButtonDelegate.pas
uCEFCallback.pas
uCEFChromium.pas
uCEFChromiumCore.pas
uCEFChromiumEvents.pas
uCEFChromiumFontOptions.pas
uCEFChromiumOptions.pas
uCEFChromiumWindow.pas
uCEFClient.pas
uCEFCommandHandler.pas
uCEFCommandLine.pas
uCEFCompletionCallback.pas
uCEFConstants.pas
uCEFContextMenuHandler.pas
uCEFContextMenuParams.pas
uCEFCookieAccessFilter.pas
uCEFCookieManager.pas
uCEFCookieVisitor.pas
uCEFCustomStreamReader.pas
uCEFDeleteCookiesCallback.pas
uCEFDevToolsMessageObserver.pas
uCEFDialogHandler.pas
uCEFDictionaryValue.pas
uCEFDisplay.pas
uCEFDisplayHandler.pas
uCEFDomDocument.pas
uCEFDomNode.pas
uCEFDomVisitor.pas
uCEFDownLoadItem.pas
uCEFDownloadHandler.pas
uCEFDownloadImageCallBack.pas
uCEFDownloadItemCallback.pas
uCEFDragAndDropMgr.pas
uCEFDragData.pas
uCEFDragHandler.pas
uCEFEndTracingCallback.pas
uCEFExtension.pas
uCEFExtensionHandler.pas
uCEFFMXBufferPanel.pas
uCEFFMXChromium.pas
uCEFFMXWindowParent.pas
uCEFFMXWorkScheduler.pas
uCEFFileDialogCallback.pas
uCEFFileDialogInfo.pas
uCEFFillLayout.pas
uCEFFindHandler.pas
uCEFFocusHandler.pas
uCEFFrame.pas
uCEFFrameHandler.pas
uCEFGetExtensionResourceCallback.pas
uCEFImage.pas
uCEFInterfaces.pas
uCEFJsDialogCallback.pas
uCEFJsDialogHandler.pas
uCEFJson.pas
uCEFKeyboardHandler.pas
uCEFLabelButton.pas
uCEFLabelButtonComponent.pas
uCEFLayout.pas
uCEFLibFunctions.pas
uCEFLifeSpanHandler.pas
uCEFLinkedWinControlBase.pas
uCEFLinkedWindowParent.pas
uCEFLinuxConstants.pas
uCEFLinuxEventPipe.pas
uCEFLinuxFunctions.pas
uCEFLinuxTypes.pas
uCEFListValue.pas
uCEFLoadHandler.pas
uCEFMacOSConstants.pas
uCEFMacOSCustomCocoaTimer.pas
uCEFMacOSFunctions.pas
uCEFMacOSInterfaces.pas
uCEFMediaObserver.pas
uCEFMediaRoute.pas
uCEFMediaRouteCreateCallback.pas
uCEFMediaRouter.pas
uCEFMediaSink.pas
uCEFMediaSinkDeviceInfoCallback.pas
uCEFMediaSource.pas
uCEFMenuButton.pas
uCEFMenuButtonComponent.pas
uCEFMenuButtonDelegate.pas
uCEFMenuButtonPressedLock.pas
uCEFMenuModel.pas
uCEFMenuModelDelegate.pas
uCEFMiscFunctions.pas
uCEFNavigationEntry.pas
uCEFNavigationEntryVisitor.pas
uCEFOAuth2Helper.pas
uCEFOLEDragAndDrop.pas
uCEFOSRIMEHandler.pas
uCEFOsrBrowserWindow.pas
uCEFOverlayController.pas
uCEFPDFPrintCallback.pas
uCEFPDFPrintOptions.pas
uCEFPanel.pas
uCEFPanelComponent.pas
uCEFPanelDelegate.pas
uCEFPostData.pas
uCEFPostDataElement.pas
uCEFPrintDialogCallback.pas
uCEFPrintHandler.pas
uCEFPrintJobCallback.pas
uCEFPrintSettings.pas
uCEFProcessMessage.pas
uCEFRegistration.pas
uCEFRenderHandler.pas
uCEFRenderProcessHandler.pas
uCEFRequest.pas
uCEFRequestContext.pas
uCEFRequestContextHandler.pas
uCEFRequestHandler.pas
uCEFResolveCallback.pas
uCEFResourceBundle.pas
uCEFResourceBundleHandler.pas
uCEFResourceHandler.pas
uCEFResourceReadCallback.pas
uCEFResourceRequestHandler.pas
uCEFResourceSkipCallback.pas
uCEFResponse.pas
uCEFResponseFilter.pas
uCEFRunContextMenuCallback.pas
uCEFRunFileDialogCallback.pas
uCEFSSLStatus.pas
uCEFSchemeHandlerFactory.pas
uCEFSchemeRegistrar.pas
uCEFScrollView.pas
uCEFScrollViewComponent.pas
uCEFSelectClientCertificateCallback.pas
uCEFSentinel.pas
uCEFServer.pas
uCEFServerComponent.pas
uCEFServerEvents.pas
uCEFServerHandler.pas
uCEFSetCookieCallback.pas
uCEFSslInfo.pas
uCEFStreamReader.pas
uCEFStreamWriter.pas
uCEFStringList.pas
uCEFStringMap.pas
uCEFStringMultimap.pas
uCEFStringVisitor.pas
uCEFTask.pas
uCEFTaskRunner.pas
uCEFTextfield.pas
uCEFTextfieldComponent.pas
uCEFTextfieldDelegate.pas
uCEFThread.pas
uCEFTimerWorkScheduler.pas
uCEFTypes.pas
uCEFUrlRequest.pas
uCEFUrlRequestClientComponent.pas
uCEFUrlRequestClientEvents.pas
uCEFUrlrequestClient.pas
uCEFValue.pas
uCEFView.pas
uCEFViewComponent.pas
uCEFViewDelegate.pas
uCEFViewsFrameworkEvents.pas
uCEFWaitableEvent.pas
uCEFWinControl.pas
uCEFWindow.pas
uCEFWindowComponent.pas
uCEFWindowDelegate.pas
uCEFWindowParent.pas
uCEFWorkScheduler.pas
uCEFWorkSchedulerQueueThread.pas
uCEFWorkSchedulerThread.pas
uCEFWriteHandler.pas
uCEFX509CertPrincipal.pas
uCEFX509Certificate.pas
uCEFXmlReader.pas
uCEFZipReader.pas
uCEFv8Accessor.pas
uCEFv8ArrayBufferReleaseCallback.pas
uCEFv8Context.pas
uCEFv8Exception.pas
uCEFv8Handler.pas
uCEFv8Interceptor.pas
uCEFv8StackFrame.pas
uCEFv8StackTrace.pas
uCEFv8Value.pas
uceflazaruscocoa.pas
tools
.gitignore
Delphinus.Info.json
Delphinus.Install.json
LICENSE.md
README.md
update_CEF4Delphi.json
CEF4Delphi/source/uCEFMacOSCustomCocoaTimer.pas
salvadordf 03f9e9a1b9 Update to CEF 98.2.0
Fixed issue  : Memory leak with empty TChromiumDefaultUrl
Fixed crash in RasperryPi OS 64 bits
2022-02-19 18:56:41 +01:00

159 lines
4.1 KiB
ObjectPascal

// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2022 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMacOSCustomCocoaTimer;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$I cef.inc}
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
interface
{$IFDEF MACOS}
uses
System.Classes, System.TypInfo,
Macapi.ObjectiveC, Macapi.Foundation, Macapi.CocoaTypes, Macapi.ObjCRuntime,
uCEFMacOSInterfaces;
type
TCustomCocoaTimer = class(TOCLocal)
private
FTimer : NSTimer;
FOnTimer : TNotifyEvent;
FInterval : integer;
FEnabled : boolean;
procedure CreateNSTimer;
procedure DestroyNSTimer;
procedure SetEnabled(aValue : boolean);
public
constructor Create;
destructor Destroy; override;
function GetObjectiveCClass: PTypeInfo; override;
procedure timerTimeout(timer: NSTimer); cdecl;
property OnTimer : TNotifyEvent read FOnTimer write FOnTimer;
property Interval : integer read FInterval write FInterval;
property Enabled : boolean read FEnabled write SetEnabled;
end;
{$ENDIF}
implementation
{$IFDEF MACOS}
uses
uCEFMacOSFunctions;
constructor TCustomCocoaTimer.Create;
begin
inherited Create;
FTimer := nil;
FOnTimer := nil;
FInterval := 1000;
FEnabled := False;
end;
destructor TCustomCocoaTimer.Destroy;
begin
DestroyNSTimer;
inherited Destroy;
end;
procedure TCustomCocoaTimer.DestroyNSTimer;
begin
if (FTimer <> nil) then
begin
FTimer.invalidate;
FTimer := nil;
end;
FEnabled := False;
end;
procedure TCustomCocoaTimer.CreateNSTimer;
var
TempInterval : NSTimeInterval;
TempRunLoop : NSRunLoop;
begin
if (FTimer <> nil) then
DestroyNSTimer;
TempInterval := FInterval / 1000;
FTimer := TNSTimer.Wrap(TNSTimer.OCClass.timerWithTimeInterval(TempInterval, GetObjectID, sel_getUid('timerTimeout:'), nil, False));
if (FTimer <> nil) then
begin
TempRunLoop := TNSRunloop.Wrap(TNSRunLoop.OCClass.currentRunLoop);
TempRunLoop.addTimer(FTimer, NSRunLoopCommonModes);
//TempRunLoop.addTimer(FTimer, NSEventTrackingRunLoopMode);
FEnabled := True;
end;
end;
function TCustomCocoaTimer.GetObjectiveCClass: PTypeInfo;
begin
Result := TypeInfo(ICustomCocoaTimer);
end;
procedure TCustomCocoaTimer.timerTimeout(timer: NSTimer);
begin
if Assigned(FOnTimer) then
FOnTimer(self);
end;
procedure TCustomCocoaTimer.SetEnabled(aValue : boolean);
begin
if (FEnabled = aValue) then exit;
if aValue then
CreateNSTimer
else
DestroyNSTimer;
end;
{$ENDIF}
end.