You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Added GlobalCEFApp.TouchEvents property
- Added TChromium.ExecuteTaskOnCefThread function. - Added TChromium.OnExecuteTaskOnCefThread event.
This commit is contained in:
@@ -252,6 +252,7 @@ type
|
||||
FOnCertificateExceptionsCleared : TNotifyEvent;
|
||||
FOnHttpAuthCredentialsCleared : TNotifyEvent;
|
||||
FOnAllConnectionsClosed : TNotifyEvent;
|
||||
FOnExecuteTaskOnCefThread : TOnExecuteTaskOnCefThread;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
@@ -500,6 +501,7 @@ type
|
||||
procedure doCertificateExceptionsCleared; virtual;
|
||||
procedure doHttpAuthCredentialsCleared; virtual;
|
||||
procedure doAllConnectionsClosed; virtual;
|
||||
procedure doOnExecuteTaskOnCefThread(aTaskID : cardinal); virtual;
|
||||
function MustCreateLoadHandler : boolean; virtual;
|
||||
function MustCreateFocusHandler : boolean; virtual;
|
||||
function MustCreateContextMenuHandler : boolean; virtual;
|
||||
@@ -570,6 +572,7 @@ type
|
||||
procedure ResolveHost(const aURL : ustring);
|
||||
function TakeSnapshot(var aBitmap : TBitmap) : boolean;
|
||||
function IsSameBrowser(const aBrowser : ICefBrowser) : boolean;
|
||||
function ExecuteTaskOnCefThread(aCefThreadId : TCefThreadId; aTaskID : cardinal; aDelayMs : Int64 = 0) : boolean;
|
||||
|
||||
procedure ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl);
|
||||
procedure CloseDevTools(const aDevTools : TWinControl = nil);
|
||||
@@ -715,6 +718,7 @@ type
|
||||
property OnCertificateExceptionsCleared : TNotifyEvent read FOnCertificateExceptionsCleared write FOnCertificateExceptionsCleared;
|
||||
property OnHttpAuthCredentialsCleared : TNotifyEvent read FOnHttpAuthCredentialsCleared write FOnHttpAuthCredentialsCleared;
|
||||
property OnAllConnectionsClosed : TNotifyEvent read FOnAllConnectionsClosed write FOnAllConnectionsClosed;
|
||||
property OnExecuteTaskOnCefThread : TOnExecuteTaskOnCefThread read FOnExecuteTaskOnCefThread write FOnExecuteTaskOnCefThread;
|
||||
{$IFNDEF FPC}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
@@ -1220,6 +1224,7 @@ begin
|
||||
FOnCertificateExceptionsCleared := nil;
|
||||
FOnHttpAuthCredentialsCleared := nil;
|
||||
FOnAllConnectionsClosed := nil;
|
||||
FOnExecuteTaskOnCefThread := nil;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg := nil;
|
||||
FOnWidgetCompMsg := nil;
|
||||
@@ -2633,6 +2638,33 @@ begin
|
||||
Result := Initialized and (aBrowser <> nil) and FBrowser.IsSame(aBrowser);
|
||||
end;
|
||||
|
||||
// Calling ExecuteTaskOnCefThread function will trigger the TChromium.OnExecuteTaskOnCefThread event.
|
||||
// "aCefThreadId" indicates the CEF thread on which TChromium.OnExecuteTaskOnCefThread will be executed.
|
||||
// "aTaskID" is a custom ID used to identify the task that triggered the TChromium.OnExecuteTaskOnCefThread event.
|
||||
// "aDelayMs" is an optional delay in milliseconds to trigger the TChromium.OnExecuteTaskOnCefThread event.
|
||||
function TChromium.ExecuteTaskOnCefThread(aCefThreadId : TCefThreadId; aTaskID : cardinal; aDelayMs : Int64) : boolean;
|
||||
var
|
||||
TempTask : ICefTask;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
try
|
||||
if Initialized then
|
||||
begin
|
||||
TempTask := TCefGenericTask.Create(self, aTaskID);
|
||||
|
||||
if (aDelayMs <> 0) then
|
||||
CefPostDelayedTask(aCefThreadId, TempTask, aDelayMs)
|
||||
else
|
||||
CefPostTask(aCefThreadId, TempTask);
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
finally
|
||||
TempTask := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChromium.SimulateMouseWheel(aDeltaX, aDeltaY : integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
@@ -3261,6 +3293,11 @@ begin
|
||||
if assigned(FOnAllConnectionsClosed) then FOnAllConnectionsClosed(self);
|
||||
end;
|
||||
|
||||
procedure TChromium.doOnExecuteTaskOnCefThread(aTaskID : cardinal);
|
||||
begin
|
||||
if assigned(FOnExecuteTaskOnCefThread) then FOnExecuteTaskOnCefThread(self, aTaskID);
|
||||
end;
|
||||
|
||||
function TChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
||||
Reference in New Issue
Block a user