mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-01-03 10:15:38 +02:00
commit
23bf854c28
@ -51,6 +51,7 @@
|
||||
program ExternalPumpBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I cef.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
|
@ -1,3 +1,40 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2021 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 GlobalCefApplication;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
@ -38,6 +38,7 @@
|
||||
unit uExternalPumpBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
|
@ -1,3 +1,40 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2021 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.
|
||||
*
|
||||
*)
|
||||
|
||||
program AppHelper;
|
||||
|
||||
(*
|
||||
@ -8,6 +45,8 @@ program AppHelper;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
|
@ -51,6 +51,7 @@
|
||||
program ExternalPumpBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I cef.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
|
@ -1,3 +1,40 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2021 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 GlobalCefApplication;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
|
@ -38,6 +38,7 @@
|
||||
unit InitSubProcess;
|
||||
|
||||
{$mode ObjFPC}{$H+}
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
unit uExternalPumpBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
|
||||
<License Value="MPL 1.1"/>
|
||||
<Version Major="88" Minor="2" Release="9"/>
|
||||
<Files Count="197">
|
||||
<Files Count="198">
|
||||
<Item1>
|
||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
<UnitName Value="uCEFAccessibilityHandler"/>
|
||||
@ -827,6 +827,10 @@
|
||||
<Filename Value="..\source\uCEFWorkSchedulerQueueThread.pas"/>
|
||||
<UnitName Value="uCEFWorkSchedulerQueueThread"/>
|
||||
</Item197>
|
||||
<Item198>
|
||||
<Filename Value="uCEFLinkedWinControlBase.pas"/>
|
||||
<UnitName Value="uCEFLinkedWinControlBase"/>
|
||||
</Item198>
|
||||
</Files>
|
||||
<RequiredPkgs Count="4">
|
||||
<Item1>
|
||||
|
@ -65,7 +65,7 @@ uses
|
||||
uCEFMediaSinkDeviceInfoCallback, uCEFJson, uCEFBitmapBitBuffer,
|
||||
uCEFPrintDialogCallback, uCEFPrintHandler, uCEFPrintJobCallback,
|
||||
uCEFLinuxFunctions, uCEFLinuxTypes, uCEFLinuxConstants,
|
||||
uCEFWorkSchedulerQueueThread, LazarusPackageIntf;
|
||||
uCEFWorkSchedulerQueueThread, uCEFLinkedWinControlBase, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
|
178
packages/uCEFLinkedWinControlBase.pas
Normal file
178
packages/uCEFLinkedWinControlBase.pas
Normal file
@ -0,0 +1,178 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2021 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 uCEFLinkedWinControlBase;
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$IFDEF MACOSX}
|
||||
{$ModeSwitch objectivec1}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
{$IFDEF MSWINDOWS}WinApi.Windows, {$ENDIF} System.Classes, Vcl.Controls, Vcl.Graphics,
|
||||
{$ELSE}
|
||||
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Controls,
|
||||
{$IFDEF FPC}
|
||||
LCLProc, LCLType, LCLIntf,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
uCEFTypes, uCEFInterfaces, uCEFWinControl, uCEFChromium;
|
||||
|
||||
type
|
||||
|
||||
{ TCEFLinkedWinControlBase }
|
||||
|
||||
TCEFLinkedWinControlBase = class(TCEFWinControl)
|
||||
protected
|
||||
function GetChromium: TChromium; virtual; abstract;
|
||||
function GetUseSetFocus: Boolean; virtual;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure SetVisible(Value: Boolean); override;
|
||||
{$ENDIF}
|
||||
function GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle; override;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure WndProc(var aMessage: TMessage); override;
|
||||
{$ENDIF}
|
||||
|
||||
property Chromium : TChromium read GetChromium;
|
||||
public
|
||||
procedure UpdateSize; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{ TCEFLinkedWinControlBase }
|
||||
|
||||
{$IFDEF FPC}
|
||||
|
||||
function TCEFLinkedWinControlBase.GetUseSetFocus: Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TCEFLinkedWinControlBase.SetVisible(Value: Boolean);
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
TempChanged : boolean;
|
||||
{$ENDIF}
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
TempChanged := (Visible <> Value);
|
||||
{$ENDIF}
|
||||
|
||||
inherited SetVisible(Value);
|
||||
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
TempChanged and
|
||||
(Chromium <> nil) and
|
||||
Chromium.Initialized then
|
||||
Chromium.UpdateXWindowVisibility(Visible);
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TCEFLinkedWinControlBase.GetChildWindowHandle: THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
if (Chromium <> nil) then Result := Chromium.WindowHandle;
|
||||
|
||||
if (Result = 0) then Result := inherited GetChildWindowHandle;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TCEFLinkedWinControlBase.WndProc(var aMessage: TMessage);
|
||||
var
|
||||
TempHandle : THandle;
|
||||
begin
|
||||
case aMessage.Msg of
|
||||
WM_SETFOCUS:
|
||||
begin
|
||||
if GetUseSetFocus and (Chromium <> nil) then
|
||||
Chromium.SetFocus(True)
|
||||
else
|
||||
begin
|
||||
TempHandle := ChildWindowHandle;
|
||||
if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
|
||||
end;
|
||||
|
||||
inherited WndProc(aMessage);
|
||||
end;
|
||||
|
||||
WM_ERASEBKGND:
|
||||
if (ChildWindowHandle = 0) then inherited WndProc(aMessage);
|
||||
|
||||
CM_WANTSPECIALKEY:
|
||||
if not(TWMKey(aMessage).CharCode in [VK_LEFT .. VK_DOWN, VK_RETURN, VK_ESCAPE]) then
|
||||
aMessage.Result := 1
|
||||
else
|
||||
inherited WndProc(aMessage);
|
||||
|
||||
WM_GETDLGCODE : aMessage.Result := DLGC_WANTARROWS or DLGC_WANTCHARS;
|
||||
|
||||
else inherited WndProc(aMessage);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TCEFLinkedWinControlBase.UpdateSize;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
(Chromium <> nil) and
|
||||
Chromium.Initialized then
|
||||
Chromium.UpdateBrowserSize(Left, Top, Width, Height);
|
||||
{$ELSE}
|
||||
inherited UpdateSize;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
@ -59,11 +59,15 @@ uses
|
||||
Messages,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
uCEFWindowParent, uCEFChromium, uCEFInterfaces, uCEFConstants, uCEFTypes, uCEFWinControl;
|
||||
uCEFWindowParent, uCEFChromium, uCEFInterfaces, uCEFConstants, uCEFTypes,
|
||||
uCEFWinControl, uCEFLinkedWinControlBase;
|
||||
|
||||
type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
|
||||
TChromiumWindow = class(TCEFWinControl)
|
||||
|
||||
{ TChromiumWindow }
|
||||
|
||||
TChromiumWindow = class(TCEFLinkedWinControlBase)
|
||||
protected
|
||||
FChromium : TChromium;
|
||||
FOnClose : TNotifyEvent;
|
||||
@ -71,14 +75,10 @@ type
|
||||
FOnAfterCreated : TNotifyEvent;
|
||||
FUseSetFocus : boolean;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure SetVisible(Value: Boolean); override;
|
||||
{$ENDIF}
|
||||
function GetBrowserInitialized : boolean;
|
||||
function GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle; override;
|
||||
function GetChromium: TChromium; override;
|
||||
function GetUseSetFocus: Boolean; override;
|
||||
function GetBrowserInitialized : boolean;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure WndProc(var aMessage: TMessage); override;
|
||||
|
||||
procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;
|
||||
procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
{$ENDIF}
|
||||
@ -101,9 +101,8 @@ type
|
||||
procedure CloseBrowser(aForceClose : boolean);
|
||||
procedure LoadURL(const aURL : ustring);
|
||||
procedure NotifyMoveOrResizeStarted;
|
||||
procedure UpdateSize; override;
|
||||
|
||||
property ChromiumBrowser : TChromium read FChromium;
|
||||
property ChromiumBrowser : TChromium read GetChromium;
|
||||
property Initialized : boolean read GetBrowserInitialized;
|
||||
|
||||
published
|
||||
@ -186,50 +185,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TChromiumWindow.GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
if (FChromium <> nil) then Result := FChromium.WindowHandle;
|
||||
|
||||
if (Result = 0) then Result := inherited GetChildWindowHandle;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TChromiumWindow.WndProc(var aMessage: TMessage);
|
||||
var
|
||||
TempHandle : THandle;
|
||||
begin
|
||||
case aMessage.Msg of
|
||||
WM_SETFOCUS:
|
||||
begin
|
||||
if FUseSetFocus and (FChromium <> nil) then
|
||||
FChromium.SetFocus(True)
|
||||
else
|
||||
begin
|
||||
TempHandle := ChildWindowHandle;
|
||||
if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
|
||||
end;
|
||||
|
||||
inherited WndProc(aMessage);
|
||||
end;
|
||||
|
||||
WM_ERASEBKGND:
|
||||
if (ChildWindowHandle = 0) then inherited WndProc(aMessage);
|
||||
|
||||
CM_WANTSPECIALKEY:
|
||||
if not(TWMKey(aMessage).CharCode in [VK_LEFT .. VK_DOWN, VK_RETURN, VK_ESCAPE]) then
|
||||
aMessage.Result := 1
|
||||
else
|
||||
inherited WndProc(aMessage);
|
||||
|
||||
WM_GETDLGCODE : aMessage.Result := DLGC_WANTARROWS or DLGC_WANTCHARS;
|
||||
|
||||
else inherited WndProc(aMessage);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TChromiumWindow.GetBrowserInitialized : boolean;
|
||||
begin
|
||||
Result := (FChromium <> nil) and FChromium.Initialized;
|
||||
@ -326,39 +281,14 @@ begin
|
||||
if (FChromium <> nil) then FChromium.NotifyMoveOrResizeStarted;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure TChromiumWindow.SetVisible(Value: Boolean);
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
TempChanged : boolean;
|
||||
{$ENDIF}
|
||||
function TChromiumWindow.GetChromium: TChromium;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
TempChanged := (Visible <> Value);
|
||||
{$ENDIF}
|
||||
|
||||
inherited SetVisible(Value);
|
||||
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
TempChanged and
|
||||
(FChromium <> nil) and
|
||||
FChromium.Initialized then
|
||||
FChromium.UpdateXWindowVisibility(Visible);
|
||||
{$ENDIF}
|
||||
result := FChromium;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TChromiumWindow.UpdateSize;
|
||||
function TChromiumWindow.GetUseSetFocus: Boolean;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
(FChromium <> nil) and
|
||||
FChromium.Initialized then
|
||||
FChromium.UpdateBrowserSize(Left, Top, Width, Height);
|
||||
{$ELSE}
|
||||
inherited UpdateSize;
|
||||
{$ENDIF}
|
||||
Result := FUseSetFocus;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -60,31 +60,28 @@ uses
|
||||
Messages,
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
uCEFWinControl, uCEFTypes, uCEFInterfaces, uCEFChromium;
|
||||
uCEFWinControl, uCEFTypes, uCEFInterfaces, uCEFChromium,
|
||||
uCEFLinkedWinControlBase;
|
||||
|
||||
type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
|
||||
TCEFLinkedWindowParent = class(TCEFWinControl)
|
||||
|
||||
{ TCEFLinkedWindowParent }
|
||||
|
||||
TCEFLinkedWindowParent = class(TCEFLinkedWinControlBase)
|
||||
protected
|
||||
FChromium : TChromium;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure SetVisible(Value: Boolean); override;
|
||||
{$ENDIF}
|
||||
function GetChromium: TChromium; override;
|
||||
procedure SetChromium(aValue : TChromium);
|
||||
|
||||
function GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle; override;
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure WndProc(var aMessage: TMessage); override;
|
||||
{$ENDIF}
|
||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||
|
||||
public
|
||||
constructor Create(AOwner : TComponent); override;
|
||||
procedure UpdateSize; override;
|
||||
|
||||
published
|
||||
property Chromium : TChromium read FChromium write SetChromium;
|
||||
property Chromium : TChromium read FChromium write SetChromium;
|
||||
end;
|
||||
|
||||
|
||||
@ -105,50 +102,6 @@ begin
|
||||
FChromium := nil;
|
||||
end;
|
||||
|
||||
function TCEFLinkedWindowParent.GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle;
|
||||
begin
|
||||
Result := 0;
|
||||
|
||||
if (FChromium <> nil) then Result := FChromium.WindowHandle;
|
||||
|
||||
if (Result = 0) then Result := inherited GetChildWindowHandle;
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
procedure TCEFLinkedWindowParent.WndProc(var aMessage: TMessage);
|
||||
var
|
||||
TempHandle : THandle;
|
||||
begin
|
||||
case aMessage.Msg of
|
||||
WM_SETFOCUS:
|
||||
begin
|
||||
if (FChromium <> nil) then
|
||||
FChromium.SetFocus(True)
|
||||
else
|
||||
begin
|
||||
TempHandle := ChildWindowHandle;
|
||||
if (TempHandle <> 0) then PostMessage(TempHandle, WM_SETFOCUS, aMessage.WParam, 0);
|
||||
end;
|
||||
|
||||
inherited WndProc(aMessage);
|
||||
end;
|
||||
|
||||
WM_ERASEBKGND:
|
||||
if (ChildWindowHandle = 0) then inherited WndProc(aMessage);
|
||||
|
||||
CM_WANTSPECIALKEY:
|
||||
if not(TWMKey(aMessage).CharCode in [VK_LEFT .. VK_DOWN, VK_RETURN, VK_ESCAPE]) then
|
||||
aMessage.Result := 1
|
||||
else
|
||||
inherited WndProc(aMessage);
|
||||
|
||||
WM_GETDLGCODE : aMessage.Result := DLGC_WANTARROWS or DLGC_WANTCHARS;
|
||||
|
||||
else inherited WndProc(aMessage);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TCEFLinkedWindowParent.Notification(AComponent: TComponent; Operation: TOperation);
|
||||
begin
|
||||
inherited Notification(AComponent, Operation);
|
||||
@ -156,39 +109,9 @@ begin
|
||||
if (Operation = opRemove) and (AComponent = FChromium) then FChromium := nil;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
procedure TCEFLinkedWindowParent.SetVisible(Value: Boolean);
|
||||
{$IFDEF LINUX}
|
||||
var
|
||||
TempChanged : boolean;
|
||||
{$ENDIF}
|
||||
function TCEFLinkedWindowParent.GetChromium: TChromium;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
TempChanged := (Visible <> Value);
|
||||
{$ENDIF}
|
||||
|
||||
inherited SetVisible(Value);
|
||||
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
TempChanged and
|
||||
(FChromium <> nil) and
|
||||
FChromium.Initialized then
|
||||
FChromium.UpdateXWindowVisibility(Visible);
|
||||
{$ENDIF}
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure TCEFLinkedWindowParent.UpdateSize;
|
||||
begin
|
||||
{$IFDEF LINUX}
|
||||
if not(csDesigning in ComponentState) and
|
||||
(FChromium <> nil) and
|
||||
FChromium.Initialized then
|
||||
FChromium.UpdateBrowserSize(Left, Top, Width, Height);
|
||||
{$ELSE}
|
||||
inherited UpdateSize;
|
||||
{$ENDIF}
|
||||
Result := FChromium;
|
||||
end;
|
||||
|
||||
procedure TCEFLinkedWindowParent.SetChromium(aValue : TChromium);
|
||||
|
Loading…
Reference in New Issue
Block a user