You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Added Views Framework support #244
Added ToolBoxBrowser2 demo Added TCEFBrowserViewComponent. Added TCEFLabelButtonComponent. Added TCEFMenuButtonComponent. Added TCEFPanelComponent. Added TCEFTextfieldComponent. Added TCEFScrollViewComponent. Added TCEFWindowComponent.
This commit is contained in:
@@ -50,7 +50,8 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFWindowParent, uCEFWinControl;
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFWindowParent, uCEFWinControl,
|
||||
uCEFChromiumCore;
|
||||
|
||||
type
|
||||
TChildForm = class(TForm)
|
||||
|
||||
18
demos/Delphi_VCL/ToolBoxBrowser2/00-DeleteDCUs.bat
Normal file
18
demos/Delphi_VCL/ToolBoxBrowser2/00-DeleteDCUs.bat
Normal file
@@ -0,0 +1,18 @@
|
||||
del /s /q *.dcu
|
||||
del /s /q *.exe
|
||||
del /s /q *.res
|
||||
del /s /q *.rsm
|
||||
del /s /q *.log
|
||||
del /s /q *.dsk
|
||||
del /s /q *.identcache
|
||||
del /s /q *.stat
|
||||
del /s /q *.local
|
||||
del /s /q *.~*
|
||||
rmdir Win32\Debug
|
||||
rmdir Win32\Release
|
||||
rmdir Win32
|
||||
rmdir Win64\Debug
|
||||
rmdir Win64\Release
|
||||
rmdir Win64
|
||||
rmdir __history
|
||||
rmdir __recovery
|
||||
30
demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr
Normal file
30
demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr
Normal file
@@ -0,0 +1,30 @@
|
||||
program ToolBoxBrowser2;
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Vcl.Forms,
|
||||
WinApi.Windows,
|
||||
{$ELSE}
|
||||
Forms,
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
uCEFApplication,
|
||||
uMainForm in 'uMainForm.pas' {MainForm};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.MainFormOnTaskbar := True;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
1004
demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dproj
Normal file
1004
demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dproj
Normal file
File diff suppressed because it is too large
Load Diff
409
demos/Delphi_VCL/ToolBoxBrowser2/cef.inc
Normal file
409
demos/Delphi_VCL/ToolBoxBrowser2/cef.inc
Normal file
@@ -0,0 +1,409 @@
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 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 � 2017 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.
|
||||
*
|
||||
*)
|
||||
|
||||
// The complete list of compiler versions is here :
|
||||
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||
|
||||
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||
|
||||
// Delphi 5
|
||||
{$IFDEF VER130}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi 6
|
||||
{$IFDEF VER140}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi 7
|
||||
{$IFDEF VER150}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi 8
|
||||
{$IFDEF VER160}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi 2005
|
||||
{$IFDEF VER170}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER180}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
// Delphi 2007
|
||||
{$IFDEF VER185}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
// Delphi 2006
|
||||
{$ELSE}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi 2009
|
||||
{$IFDEF VER200}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$ENDIF}
|
||||
|
||||
//Delphi 2010
|
||||
{$IFDEF VER210}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE
|
||||
{$IFDEF VER220}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||
{$IFDEF VER230}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE3
|
||||
{$IFDEF VER240}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE4
|
||||
{$IFDEF VER250}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE5
|
||||
{$IFDEF VER260}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE6
|
||||
{$IFDEF VER270}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE7
|
||||
{$IFDEF VER280}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Delphi XE8
|
||||
{$IFDEF VER290}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$ENDIF VER290}
|
||||
|
||||
// Rad Studio 10 - Delphi Seattle
|
||||
{$IFDEF VER300}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$DEFINE DELPHI23_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Rad Studio 10.1 - Delphi Berlin
|
||||
{$IFDEF VER310}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$DEFINE DELPHI23_UP}
|
||||
{$DEFINE DELPHI24_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Rad Studio 10.2 - Delphi Tokyo
|
||||
{$IFDEF VER320}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$DEFINE DELPHI23_UP}
|
||||
{$DEFINE DELPHI24_UP}
|
||||
{$DEFINE DELPHI25_UP}
|
||||
{$ENDIF}
|
||||
|
||||
// Rad Studio 10.3 - Delphi Rio
|
||||
{$IFDEF VER330}
|
||||
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$DEFINE DELPHI23_UP}
|
||||
{$DEFINE DELPHI24_UP}
|
||||
{$DEFINE DELPHI25_UP}
|
||||
{$DEFINE DELPHI26_UP}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$DEFINE SUPPORTS_INLINE}
|
||||
{$ELSE}
|
||||
{$IFDEF DELPHI_VERSION_UNKNOW}
|
||||
{$DEFINE DELPHI5_UP}
|
||||
{$DEFINE DELPHI6_UP}
|
||||
{$DEFINE DELPHI7_UP}
|
||||
{$DEFINE DELPHI8_UP}
|
||||
{$DEFINE DELPHI9_UP}
|
||||
{$DEFINE DELPHI10_UP}
|
||||
{$DEFINE DELPHI11_UP}
|
||||
{$DEFINE DELPHI12_UP}
|
||||
{$DEFINE DELPHI14_UP}
|
||||
{$DEFINE DELPHI15_UP}
|
||||
{$DEFINE DELPHI16_UP}
|
||||
{$DEFINE DELPHI17_UP}
|
||||
{$DEFINE DELPHI18_UP}
|
||||
{$DEFINE DELPHI19_UP}
|
||||
{$DEFINE DELPHI20_UP}
|
||||
{$DEFINE DELPHI21_UP}
|
||||
{$DEFINE DELPHI22_UP}
|
||||
{$DEFINE DELPHI23_UP}
|
||||
{$DEFINE DELPHI24_UP}
|
||||
{$DEFINE DELPHI25_UP}
|
||||
{$DEFINE DELPHI26_UP}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF DELPHI9_UP}
|
||||
{$DEFINE SUPPORTS_INLINE}
|
||||
{$ENDIF}
|
||||
|
||||
64
demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.dfm
Normal file
64
demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.dfm
Normal file
@@ -0,0 +1,64 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'ToolBox Browser 2'
|
||||
ClientHeight = 37
|
||||
ClientWidth = 357
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object ButtonPnl: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 357
|
||||
Height = 37
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
object Edit1: TEdit
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 286
|
||||
Height = 21
|
||||
TabOrder = 0
|
||||
Text = 'https://www.google.com'
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 300
|
||||
Top = 6
|
||||
Width = 51
|
||||
Height = 25
|
||||
Caption = 'Open'
|
||||
TabOrder = 1
|
||||
OnClick = Button1Click
|
||||
end
|
||||
end
|
||||
object CEFWindowComponent1: TCEFWindowComponent
|
||||
OnGetPreferredSize = CEFWindowComponent1GetPreferredSize
|
||||
OnWindowCreated = CEFWindowComponent1WindowCreated
|
||||
OnWindowDestroyed = CEFWindowComponent1WindowDestroyed
|
||||
OnCanClose = CEFWindowComponent1CanClose
|
||||
Left = 48
|
||||
end
|
||||
object CEFBrowserViewComponent1: TCEFBrowserViewComponent
|
||||
Left = 152
|
||||
Top = 65528
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnTitleChange = Chromium1TitleChange
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
Left = 256
|
||||
Top = 8
|
||||
end
|
||||
end
|
||||
215
demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas
Normal file
215
demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas
Normal file
@@ -0,0 +1,215 @@
|
||||
unit uMainForm;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
||||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls,
|
||||
{$ELSE}
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFInterfaces, uCEFTypes, uCEFConstants, uCEFViewComponent,
|
||||
uCEFPanelComponent, uCEFWindowComponent,
|
||||
uCEFBrowserViewComponent, uCEFChromiumCore, uCEFChromium;
|
||||
|
||||
const
|
||||
CEFBROWSER_INITIALIZED = WM_APP + $100;
|
||||
|
||||
DEFAULT_WINDOW_VIEW_WIDTH = 800;
|
||||
DEFAULT_WINDOW_VIEW_HEIGHT = 600;
|
||||
|
||||
type
|
||||
TMainForm = class(TForm)
|
||||
ButtonPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
Button1: TButton;
|
||||
CEFWindowComponent1: TCEFWindowComponent;
|
||||
CEFBrowserViewComponent1: TCEFBrowserViewComponent;
|
||||
Chromium1: TChromium;
|
||||
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
|
||||
procedure CEFWindowComponent1GetPreferredSize(const Sender: TObject; const view: ICefView; var aResult: TCefSize);
|
||||
procedure CEFWindowComponent1WindowCreated(const Sender: TObject; const window: ICefWindow);
|
||||
procedure CEFWindowComponent1WindowDestroyed(const Sender: TObject; const window: ICefWindow);
|
||||
procedure CEFWindowComponent1CanClose(const Sender: TObject; const window: ICefWindow; var aResult: Boolean);
|
||||
|
||||
procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
||||
procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean);
|
||||
|
||||
protected
|
||||
procedure CEFInitializedMsg(var aMessage : TMessage); message CEFBROWSER_INITIALIZED;
|
||||
|
||||
procedure EnableInterface;
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses
|
||||
uCEFApplication;
|
||||
|
||||
// This demo uses the Views Framework in CEF to create a child window with a
|
||||
// web browser.
|
||||
|
||||
// CEF4Delphi has several components to facilitate the creation of several views
|
||||
// and this demo uses these :
|
||||
|
||||
// TCEFWindowComponent : Has a ICefWindow and a ICefWindowDelegate to call
|
||||
// the methods of a "CefWindow" and the events from the "CefWindowDelegate".
|
||||
// Read the linked documents bellow for more details about them.
|
||||
|
||||
// TCEFBrowserViewComponent : Has a ICefBrowserView and a ICefBrowserViewDelegate
|
||||
// to call the methods of a "CefBrowserView" and the events from the
|
||||
// "CefBrowserViewDelegate".
|
||||
|
||||
// TChromium : Is used to create the browser and to handle all its events.
|
||||
|
||||
// All the views have a hierarchy and they inherit methods or events from their
|
||||
// parents. See the diagram in the uCEFTypes.pas file (line 2900 aprox.)
|
||||
|
||||
// This demo creates a window when the user clicks on the "Open" button.
|
||||
// Most of the methods in the Views Framework must be used in the CEF UI thread
|
||||
// but most of the procedures used to create the CEF4Delphi components create a
|
||||
// task if they are called in a different thread. The rest of the methods *MUST*
|
||||
// be called in the CEF UI thread or they won't work.
|
||||
|
||||
// TCEFWindowComponent.CreateTopLevelWindow triggers the
|
||||
// TCEFWindowComponent.OnWindowCreated event which is executed in the CEF UI
|
||||
// thread and you can use it to create the child views in the window, in this
|
||||
// case a browser view.
|
||||
|
||||
// TCEFWindowComponent.OnGetPreferredSize will alse be triggered when you create
|
||||
// the window to get the window size in DIPs.
|
||||
|
||||
// REFERENCES :
|
||||
// ------------
|
||||
// https://bitbucket.org/chromiumembedded/cef/issues/1749
|
||||
// https://www.chromium.org/developers/design-documents/chromeviews
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefView.html
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefViewDelegate.html
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindow.html
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindowDelegate.html
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserView.html
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserViewDelegate.html
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
begin
|
||||
if (MainForm <> nil) and MainForm.HandleAllocated then
|
||||
PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Button1Click(Sender: TObject);
|
||||
begin
|
||||
CEFWindowComponent1.CreateTopLevelWindow;
|
||||
ButtonPnl.Enabled := False;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFInitializedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
EnableInterface;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFWindowComponent1CanClose(const Sender: TObject;
|
||||
const window: ICefWindow; var aResult: Boolean);
|
||||
begin
|
||||
aResult := Chromium1.TryCloseBrowser;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFWindowComponent1GetPreferredSize(const Sender: TObject;
|
||||
const view: ICefView; var aResult: TCefSize);
|
||||
begin
|
||||
// This is the initial window size
|
||||
aResult.width := DEFAULT_WINDOW_VIEW_WIDTH;
|
||||
aResult.height := DEFAULT_WINDOW_VIEW_HEIGHT;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFWindowComponent1WindowCreated(const Sender: TObject;
|
||||
const window: ICefWindow);
|
||||
var
|
||||
TempURL : ustring;
|
||||
TempWorkArea : TCefRect;
|
||||
TempPosition : TCefPoint;
|
||||
TempDisplay : ICefDisplay;
|
||||
begin
|
||||
TempURL := trim(Edit1.Text);
|
||||
if (length(TempURL) = 0) then TempURL := 'about:blank';
|
||||
|
||||
// This event is executed in the CEF UI thread and we can call all these other
|
||||
// functions on this thread. In fact, all of these functions only work when
|
||||
// you call them on this thread.
|
||||
|
||||
if Chromium1.CreateBrowser(TempURL, CEFBrowserViewComponent1) then
|
||||
begin
|
||||
CEFWindowComponent1.AddChildView(CEFBrowserViewComponent1.BrowserView);
|
||||
CEFWindowComponent1.Show;
|
||||
|
||||
// This centers the window on the screen
|
||||
TempDisplay := CEFWindowComponent1.Display;
|
||||
if (TempDisplay <> nil) then
|
||||
begin
|
||||
TempWorkArea := TempDisplay.WorkArea;
|
||||
TempPosition.x := ((TempWorkArea.width - DEFAULT_WINDOW_VIEW_WIDTH) div 2) + TempWorkArea.x;
|
||||
TempPosition.y := ((TempWorkArea.height - DEFAULT_WINDOW_VIEW_HEIGHT) div 2) + TempWorkArea.y;
|
||||
|
||||
CEFWindowComponent1.Position := TempPosition;
|
||||
end;
|
||||
|
||||
CEFBrowserViewComponent1.RequestFocus;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFWindowComponent1WindowDestroyed(const Sender: TObject;
|
||||
const window: ICefWindow);
|
||||
begin
|
||||
ButtonPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforePopup(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||
var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue;
|
||||
var noJavascriptAccess, Result: Boolean);
|
||||
begin
|
||||
// For simplicity, this demo blocks all popup windows and new tabs
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1TitleChange(Sender: TObject;
|
||||
const browser: ICefBrowser; const title: ustring);
|
||||
begin
|
||||
CEFWindowComponent1.Title := title;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.GlobalContextInitialized then
|
||||
EnableInterface;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EnableInterface;
|
||||
begin
|
||||
Caption := 'ToolBox Browser 2';
|
||||
ButtonPnl.Enabled := True;
|
||||
cursor := crDefault;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user