1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00

Update to CEF 81.2.25

- Work in progress : Added many more units, classes and types to support the Views Framewrok.
This commit is contained in:
Salvador Díaz Fau 2020-04-29 19:14:44 +02:00
parent a3cab55a7c
commit ee831e85bd
36 changed files with 3452 additions and 63 deletions

View File

@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 81.2.24 which includes Chromium 81.0.4044.113.
CEF4Delphi uses CEF 81.2.25 which includes Chromium 81.0.4044.113.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.24%2Bgc0b313d%2Bchromium-81.0.4044.113_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.24%2Bgc0b313d%2Bchromium-81.0.4044.113_windows64.tar.bz2)
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.25%2Bg3afea62%2Bchromium-81.0.4044.113_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.25%2Bg3afea62%2Bchromium-81.0.4044.113_windows64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.3.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.8/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -4,7 +4,7 @@
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="9">
<Units Count="13">
<Unit0>
<Filename Value="MiniBrowser.lpr"/>
<IsPartOfProject Value="True"/>
@ -91,8 +91,36 @@
<CursorPos X="51" Y="290"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="..\..\..\source\uCEFInterfaces.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="2698"/>
<CursorPos X="39" Y="2713"/>
<UsageCount Value="10"/>
</Unit9>
<Unit10>
<Filename Value="..\..\..\source\uCEFButton.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="93"/>
<CursorPos X="74" Y="95"/>
<UsageCount Value="10"/>
</Unit10>
<Unit11>
<Filename Value="..\..\..\source\uCEFLabelButton.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="134"/>
<CursorPos X="74" Y="142"/>
<UsageCount Value="10"/>
</Unit11>
<Unit12>
<Filename Value="..\..\..\source\uCEFWindow.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="119"/>
<CursorPos X="62" Y="124"/>
<UsageCount Value="10"/>
</Unit12>
</Units>
<JumpHistory Count="4" HistoryIndex="3">
<JumpHistory Count="5" HistoryIndex="4">
<Position1>
<Filename Value="MiniBrowser.lpr"/>
<Caret Line="65" TopLine="46"/>
@ -109,6 +137,10 @@
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="461" TopLine="448"/>
</Position4>
<Position5>
<Filename Value="uMiniBrowser.pas"/>
<Caret Line="48" Column="37" TopLine="22"/>
</Position5>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@ -182,7 +182,28 @@ contains
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFMediaSink in '..\source\uCEFMediaSink.pas',
uCEFMediaSource in '..\source\uCEFMediaSource.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas';
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFDisplay in '..\source\uCEFDisplay.pas',
uCEFLayout in '..\source\uCEFLayout.pas',
uCEFBoxLayout in '..\source\uCEFBoxLayout.pas',
uCEFFillLayout in '..\source\uCEFFillLayout.pas',
uCEFView in '..\source\uCEFView.pas',
uCEFViewDelegate in '..\source\uCEFViewDelegate.pas',
uCEFTextfield in '..\source\uCEFTextfield.pas',
uCEFTextfieldDelegate in '..\source\uCEFTextfieldDelegate.pas',
uCEFScrollView in '..\source\uCEFScrollView.pas',
uCEFPanel in '..\source\uCEFPanel.pas',
uCEFPanelDelegate in '..\source\uCEFPanelDelegate.pas',
uCEFBrowserView in '..\source\uCEFBrowserView.pas',
uCEFBrowserViewDelegate in '..\source\uCEFBrowserViewDelegate.pas',
uCEFButton in '..\source\uCEFButton.pas',
uCEFButtonDelegate in '..\source\uCEFButtonDelegate.pas',
uCEFLabelButton in '..\source\uCEFLabelButton.pas',
uCEFMenuButton in '..\source\uCEFMenuButton.pas',
uCEFMenuButtonPressedLock in '..\source\uCEFMenuButtonPressedLock.pas',
uCEFMenuButtonDelegate in '..\source\uCEFMenuButtonDelegate.pas',
uCEFWindow in '..\source\uCEFWindow.pas',
uCEFWindowDelegate in '..\source\uCEFWindowDelegate.pas';
end.

View File

@ -277,6 +277,27 @@
<DCCReference Include="..\source\uCEFMediaSink.pas"/>
<DCCReference Include="..\source\uCEFMediaSource.pas"/>
<DCCReference Include="..\source\uCEFRegistration.pas"/>
<DCCReference Include="..\source\uCEFDisplay.pas"/>
<DCCReference Include="..\source\uCEFLayout.pas"/>
<DCCReference Include="..\source\uCEFBoxLayout.pas"/>
<DCCReference Include="..\source\uCEFFillLayout.pas"/>
<DCCReference Include="..\source\uCEFView.pas"/>
<DCCReference Include="..\source\uCEFViewDelegate.pas"/>
<DCCReference Include="..\source\uCEFTextfield.pas"/>
<DCCReference Include="..\source\uCEFTextfieldDelegate.pas"/>
<DCCReference Include="..\source\uCEFScrollView.pas"/>
<DCCReference Include="..\source\uCEFPanel.pas"/>
<DCCReference Include="..\source\uCEFPanelDelegate.pas"/>
<DCCReference Include="..\source\uCEFBrowserView.pas"/>
<DCCReference Include="..\source\uCEFBrowserViewDelegate.pas"/>
<DCCReference Include="..\source\uCEFButton.pas"/>
<DCCReference Include="..\source\uCEFButtonDelegate.pas"/>
<DCCReference Include="..\source\uCEFLabelButton.pas"/>
<DCCReference Include="..\source\uCEFMenuButton.pas"/>
<DCCReference Include="..\source\uCEFMenuButtonPressedLock.pas"/>
<DCCReference Include="..\source\uCEFMenuButtonDelegate.pas"/>
<DCCReference Include="..\source\uCEFWindow.pas"/>
<DCCReference Include="..\source\uCEFWindowDelegate.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

View File

@ -179,6 +179,27 @@ contains
uCEFMediaRoute in '..\source\uCEFMediaRoute.pas',
uCEFMediaObserver in '..\source\uCEFMediaObserver.pas',
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas';
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFDisplay in '..\source\uCEFDisplay.pas',
uCEFLayout in '..\source\uCEFLayout.pas',
uCEFBoxLayout in '..\source\uCEFBoxLayout.pas',
uCEFFillLayout in '..\source\uCEFFillLayout.pas',
uCEFView in '..\source\uCEFView.pas',
uCEFViewDelegate in '..\source\uCEFViewDelegate.pas',
uCEFTextfield in '..\source\uCEFTextfield.pas',
uCEFTextfieldDelegate in '..\source\uCEFTextfieldDelegate.pas',
uCEFScrollView in '..\source\uCEFScrollView.pas',
uCEFPanel in '..\source\uCEFPanel.pas',
uCEFPanelDelegate in '..\source\uCEFPanelDelegate.pas',
uCEFBrowserView in '..\source\uCEFBrowserView.pas',
uCEFBrowserViewDelegate in '..\source\uCEFBrowserViewDelegate.pas',
uCEFButton in '..\source\uCEFButton.pas',
uCEFButtonDelegate in '..\source\uCEFButtonDelegate.pas',
uCEFLabelButton in '..\source\uCEFLabelButton.pas',
uCEFMenuButton in '..\source\uCEFMenuButton.pas',
uCEFMenuButtonPressedLock in '..\source\uCEFMenuButtonPressedLock.pas',
uCEFMenuButtonDelegate in '..\source\uCEFMenuButtonDelegate.pas',
uCEFWindow in '..\source\uCEFWindow.pas',
uCEFWindowDelegate in '..\source\uCEFWindowDelegate.pas';
end.

View File

@ -187,7 +187,28 @@ contains
uCEFMediaRoute in '..\source\uCEFMediaRoute.pas',
uCEFMediaObserver in '..\source\uCEFMediaObserver.pas',
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas';
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFDisplay in '..\source\uCEFDisplay.pas',
uCEFLayout in '..\source\uCEFLayout.pas',
uCEFBoxLayout in '..\source\uCEFBoxLayout.pas',
uCEFFillLayout in '..\source\uCEFFillLayout.pas',
uCEFView in '..\source\uCEFView.pas',
uCEFViewDelegate in '..\source\uCEFViewDelegate.pas',
uCEFTextfield in '..\source\uCEFTextfield.pas',
uCEFTextfieldDelegate in '..\source\uCEFTextfieldDelegate.pas',
uCEFScrollView in '..\source\uCEFScrollView.pas',
uCEFPanel in '..\source\uCEFPanel.pas',
uCEFPanelDelegate in '..\source\uCEFPanelDelegate.pas',
uCEFBrowserView in '..\source\uCEFBrowserView.pas',
uCEFBrowserViewDelegate in '..\source\uCEFBrowserViewDelegate.pas',
uCEFButton in '..\source\uCEFButton.pas',
uCEFButtonDelegate in '..\source\uCEFButtonDelegate.pas',
uCEFLabelButton in '..\source\uCEFLabelButton.pas',
uCEFMenuButton in '..\source\uCEFMenuButton.pas',
uCEFMenuButtonPressedLock in '..\source\uCEFMenuButtonPressedLock.pas',
uCEFMenuButtonDelegate in '..\source\uCEFMenuButtonDelegate.pas',
uCEFWindow in '..\source\uCEFWindow.pas',
uCEFWindowDelegate in '..\source\uCEFWindowDelegate.pas';
end.

View File

@ -303,6 +303,27 @@
<DCCReference Include="..\source\uCEFMediaObserver.pas"/>
<DCCReference Include="..\source\uCEFMediaRouter.pas"/>
<DCCReference Include="..\source\uCEFRegistration.pas"/>
<DCCReference Include="..\source\uCEFDisplay.pas"/>
<DCCReference Include="..\source\uCEFLayout.pas"/>
<DCCReference Include="..\source\uCEFBoxLayout.pas"/>
<DCCReference Include="..\source\uCEFFillLayout.pas"/>
<DCCReference Include="..\source\uCEFView.pas"/>
<DCCReference Include="..\source\uCEFViewDelegate.pas"/>
<DCCReference Include="..\source\uCEFTextfield.pas"/>
<DCCReference Include="..\source\uCEFTextfieldDelegate.pas"/>
<DCCReference Include="..\source\uCEFScrollView.pas"/>
<DCCReference Include="..\source\uCEFPanel.pas"/>
<DCCReference Include="..\source\uCEFPanelDelegate.pas"/>
<DCCReference Include="..\source\uCEFBrowserView.pas"/>
<DCCReference Include="..\source\uCEFBrowserViewDelegate.pas"/>
<DCCReference Include="..\source\uCEFButton.pas"/>
<DCCReference Include="..\source\uCEFButtonDelegate.pas"/>
<DCCReference Include="..\source\uCEFLabelButton.pas"/>
<DCCReference Include="..\source\uCEFMenuButton.pas"/>
<DCCReference Include="..\source\uCEFMenuButtonPressedLock.pas"/>
<DCCReference Include="..\source\uCEFMenuButtonDelegate.pas"/>
<DCCReference Include="..\source\uCEFWindow.pas"/>
<DCCReference Include="..\source\uCEFWindowDelegate.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

View File

@ -21,8 +21,8 @@
</CompilerOptions>
<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="81" Minor="2" Release="24"/>
<Files Count="154">
<Version Major="81" Minor="2" Release="25"/>
<Files Count="175">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
<UnitName Value="uCEFAccessibilityHandler"/>
@ -648,6 +648,90 @@
<Filename Value="..\source\uCEFRegistration.pas"/>
<UnitName Value="uCEFRegistration"/>
</Item154>
<Item155>
<Filename Value="..\source\uCEFWindowDelegate.pas"/>
<UnitName Value="uCEFWindowDelegate"/>
</Item155>
<Item156>
<Filename Value="..\source\uCEFWindow.pas"/>
<UnitName Value="uCEFWindow"/>
</Item156>
<Item157>
<Filename Value="..\source\uCEFMenuButtonDelegate.pas"/>
<UnitName Value="uCEFMenuButtonDelegate"/>
</Item157>
<Item158>
<Filename Value="..\source\uCEFMenuButtonPressedLock.pas"/>
<UnitName Value="uCEFMenuButtonPressedLock"/>
</Item158>
<Item159>
<Filename Value="..\source\uCEFMenuButton.pas"/>
<UnitName Value="uCEFMenuButton"/>
</Item159>
<Item160>
<Filename Value="..\source\uCEFLabelButton.pas"/>
<UnitName Value="uCEFLabelButton"/>
</Item160>
<Item161>
<Filename Value="..\source\uCEFButtonDelegate.pas"/>
<UnitName Value="uCEFButtonDelegate"/>
</Item161>
<Item162>
<Filename Value="..\source\uCEFButton.pas"/>
<UnitName Value="uCEFButton"/>
</Item162>
<Item163>
<Filename Value="..\source\uCEFBrowserViewDelegate.pas"/>
<UnitName Value="uCEFBrowserViewDelegate"/>
</Item163>
<Item164>
<Filename Value="..\source\uCEFBrowserView.pas"/>
<UnitName Value="uCEFBrowserView"/>
</Item164>
<Item165>
<Filename Value="..\source\uCEFPanelDelegate.pas"/>
<UnitName Value="uCEFPanelDelegate"/>
</Item165>
<Item166>
<Filename Value="..\source\uCEFPanel.pas"/>
<UnitName Value="uCEFPanel"/>
</Item166>
<Item167>
<Filename Value="..\source\uCEFScrollView.pas"/>
<UnitName Value="uCEFScrollView"/>
</Item167>
<Item168>
<Filename Value="..\source\uCEFTextfieldDelegate.pas"/>
<UnitName Value="uCEFTextfieldDelegate"/>
</Item168>
<Item169>
<Filename Value="..\source\uCEFTextfield.pas"/>
<UnitName Value="uCEFTextfield"/>
</Item169>
<Item170>
<Filename Value="..\source\uCEFViewDelegate.pas"/>
<UnitName Value="uCEFViewDelegate"/>
</Item170>
<Item171>
<Filename Value="..\source\uCEFView.pas"/>
<UnitName Value="uCEFView"/>
</Item171>
<Item172>
<Filename Value="..\source\uCEFFillLayout.pas"/>
<UnitName Value="uCEFFillLayout"/>
</Item172>
<Item173>
<Filename Value="..\source\uCEFBoxLayout.pas"/>
<UnitName Value="uCEFBoxLayout"/>
</Item173>
<Item174>
<Filename Value="..\source\uCEFLayout.pas"/>
<UnitName Value="uCEFLayout"/>
</Item174>
<Item175>
<Filename Value="..\source\uCEFDisplay.pas"/>
<UnitName Value="uCEFDisplay"/>
</Item175>
</Files>
<RequiredPkgs Count="4">
<Item1>

View File

@ -52,7 +52,12 @@ uses
uCEFResourceSkipCallback, uCEFSentinel, uCEFApplicationCore,
uCEFOAuth2Helper, uCEFMediaObserver, uCEFMediaRoute,
uCEFMediaRouteCreateCallback, uCEFMediaRouter, uCEFMediaSink,
uCEFMediaSource, uCEFRegistration, LazarusPackageIntf;
uCEFMediaSource, uCEFRegistration, uCEFWindowDelegate, uCEFWindow,
uCEFMenuButtonDelegate, uCEFMenuButtonPressedLock, uCEFMenuButton,
uCEFLabelButton, uCEFButtonDelegate, uCEFButton, uCEFBrowserViewDelegate,
uCEFBrowserView, uCEFPanelDelegate, uCEFPanel, uCEFScrollView,
uCEFTextfieldDelegate, uCEFTextfield, uCEFViewDelegate, uCEFView,
uCEFFillLayout, uCEFBoxLayout, uCEFLayout, uCEFDisplay, LazarusPackageIntf;
implementation

View File

@ -62,7 +62,7 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 81;
CEF_SUPPORTED_VERSION_MINOR = 2;
CEF_SUPPORTED_VERSION_RELEASE = 24;
CEF_SUPPORTED_VERSION_RELEASE = 25;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 81;

96
source/uCEFBoxLayout.pas Normal file
View File

@ -0,0 +1,96 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFBoxLayout;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout;
type
TCefBoxLayoutRef = class(TCefLayoutRef, ICefBoxLayout)
protected
procedure SetFlexForView(const view: ICefView; flex: Integer);
procedure ClearFlexForView(const view: ICefView);
public
class function UnWrap(data: Pointer): ICefBoxLayout;
end;
implementation
uses
uCEFMiscFunctions;
procedure TCefBoxLayoutRef.SetFlexForView(const view: ICefView; flex: Integer);
begin
PCefBoxLayout(FData)^.set_flex_for_view(PCefBoxLayout(FData),
CefGetData(view),
ord(flex));
end;
procedure TCefBoxLayoutRef.ClearFlexForView(const view: ICefView);
begin
PCefBoxLayout(FData)^.clear_flex_for_view(PCefBoxLayout(FData),
CefGetData(view));
end;
class function TCefBoxLayoutRef.UnWrap(data: Pointer): ICefBoxLayout;
begin
if (data <> nil) then
Result := Create(data) as ICefBoxLayout
else
Result := nil;
end;
end.

120
source/uCEFBrowserView.pas Normal file
View File

@ -0,0 +1,120 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFBrowserView;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type
TCefBrowserViewRef = class(TCefViewRef, ICefBrowserView)
protected
function GetBrowser : ICefBrowser;
procedure SetPreferAccelerators(prefer_accelerators: boolean);
public
class function UnWrap(data: Pointer): ICefBrowserView;
class function CreateBrowserView(const client: ICefClient; const url: ustring; const settings: TCefBrowserSettings; const extra_info: ICefDictionaryValue; const request_context: ICefRequestContext; const delegate: ICefBrowserViewDelegate): ICefBrowserView;
class function GetForBrowser(const browser: ICefBrowser): ICefBrowserView;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFBrowser;
function TCefBrowserViewRef.GetBrowser : ICefBrowser;
begin
Result := TCefBrowserRef.UnWrap(PCefBrowserView(FData)^.get_browser(PCefBrowserView(FData)));
end;
procedure TCefBrowserViewRef.SetPreferAccelerators(prefer_accelerators: boolean);
begin
PCefBrowserView(FData)^.set_prefer_accelerators(PCefBrowserView(FData),
ord(prefer_accelerators));
end;
class function TCefBrowserViewRef.UnWrap(data: Pointer): ICefBrowserView;
begin
if (data <> nil) then
Result := Create(data) as ICefBrowserView
else
Result := nil;
end;
class function TCefBrowserViewRef.CreateBrowserView(const client : ICefClient;
const url : ustring;
const settings : TCefBrowserSettings;
const extra_info : ICefDictionaryValue;
const request_context : ICefRequestContext;
const delegate : ICefBrowserViewDelegate): ICefBrowserView;
var
TempURL : TCefString;
begin
TempURL := CefString(url);
Result := UnWrap(cef_browser_view_create(CefGetData(client),
@TempURL,
@settings,
CefGetData(extra_info),
CefGetData(request_context),
CefGetData(delegate)));
end;
class function TCefBrowserViewRef.GetForBrowser(const browser: ICefBrowser): ICefBrowserView;
begin
Result := UnWrap(cef_browser_view_get_for_browser(CefGetData(browser)));
end;
end.

View File

@ -0,0 +1,123 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFBrowserViewDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFViewDelegate;
type
TCefBrowserViewDelegateRef = class(TCefViewDelegateRef, ICefBrowserViewDelegate)
protected
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
function GetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean): ICefBrowserViewDelegate;
function OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean): boolean;
public
class function UnWrap(data: Pointer): ICefBrowserViewDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefBrowserViewDelegateRef.OnBrowserCreated(const browser_view : ICefBrowserView;
const browser : ICefBrowser);
begin
PCefBrowserViewDelegate(FData)^.on_browser_created(PCefBrowserViewDelegate(FData),
CefGetData(browser_view),
CefGetData(browser));
end;
procedure TCefBrowserViewDelegateRef.OnBrowserDestroyed(const browser_view : ICefBrowserView;
const browser : ICefBrowser);
begin
PCefBrowserViewDelegate(FData)^.on_browser_destroyed(PCefBrowserViewDelegate(FData),
CefGetData(browser_view),
CefGetData(browser));
end;
function TCefBrowserViewDelegateRef.GetDelegateForPopupBrowserView(const browser_view : ICefBrowserView;
const settings : TCefBrowserSettings;
const client : ICefClient;
is_devtools : boolean): ICefBrowserViewDelegate;
begin
Result := UnWrap((PCefBrowserViewDelegate(FData)^.get_delegate_for_popup_browser_view(PCefBrowserViewDelegate(FData),
CefGetData(browser_view),
@settings,
CefGetData(client),
ord(is_devtools))));
end;
function TCefBrowserViewDelegateRef.OnPopupBrowserViewCreated(const browser_view : ICefBrowserView;
const popup_browser_view : ICefBrowserView;
is_devtools : boolean): boolean;
begin
Result := (PCefBrowserViewDelegate(FData)^.on_popup_browser_view_created(PCefBrowserViewDelegate(FData),
CefGetData(browser_view),
CefGetData(popup_browser_view),
ord(is_devtools)) <> 0);
end;
class function TCefBrowserViewDelegateRef.UnWrap(data: Pointer): ICefBrowserViewDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefBrowserViewDelegate
else
Result := nil;
end;
end.

123
source/uCEFButton.pas Normal file
View File

@ -0,0 +1,123 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFButton;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type
TCefButtonRef = class(TCefViewRef, ICefButton)
protected
function AsLabelButton : ICefLabelButton;
procedure SetState(state_: TCefButtonState);
function GetState : TCefButtonState;
procedure SetInkDropEnabled(enabled_: boolean);
procedure SetTooltipText(const tooltip_text: ustring);
procedure SetAccessibleName(const name: ustring);
public
class function UnWrap(data: Pointer): ICefButton;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFLabelButton;
function TCefButtonRef.AsLabelButton : ICefLabelButton;
begin
Result := TCefLabelButtonRef.UnWrap(PCefButton(FData)^.as_label_button(PCefButton(FData)));
end;
procedure TCefButtonRef.SetState(state_: TCefButtonState);
begin
PCefButton(FData)^.set_state(PCefButton(FData), state_);
end;
function TCefButtonRef.GetState : TCefButtonState;
begin
Result := PCefButton(FData)^.get_state(PCefButton(FData));
end;
procedure TCefButtonRef.SetInkDropEnabled(enabled_: boolean);
begin
PCefButton(FData)^.set_ink_drop_enabled(PCefButton(FData), ord(enabled_));
end;
procedure TCefButtonRef.SetTooltipText(const tooltip_text: ustring);
var
TempText : TCefString;
begin
TempText := CefString(tooltip_text);
PCefButton(FData)^.set_tooltip_text(PCefButton(FData), @TempText);
end;
procedure TCefButtonRef.SetAccessibleName(const name: ustring);
var
TempName : TCefString;
begin
TempName := CefString(name);
PCefButton(FData)^.set_accessible_name(PCefButton(FData), @TempName);
end;
class function TCefButtonRef.UnWrap(data: Pointer): ICefButton;
begin
if (data <> nil) then
Result := Create(data) as ICefButton
else
Result := nil;
end;
end.

View File

@ -0,0 +1,95 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFButtonDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFViewDelegate;
type
TCefButtonDelegateRef = class(TCefViewDelegateRef, ICefButtonDelegate)
protected
procedure OnButtonPressed(const button: ICefButton);
procedure OnButtonStateChanged(const button: ICefButton);
public
class function UnWrap(data: Pointer): ICefButtonDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefButtonDelegateRef.OnButtonPressed(const button: ICefButton);
begin
PCefButtonDelegate(FData)^.on_button_pressed(PCefButtonDelegate(FData),
CefGetData(button));
end;
procedure TCefButtonDelegateRef.OnButtonStateChanged(const button: ICefButton);
begin
PCefButtonDelegate(FData)^.on_button_state_changed(PCefButtonDelegate(FData),
CefGetData(button));
end;
class function TCefButtonDelegateRef.UnWrap(data: Pointer): ICefButtonDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefButtonDelegate
else
Result := nil;
end;
end.

181
source/uCEFDisplay.pas Normal file
View File

@ -0,0 +1,181 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFDisplay;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefDisplayRef = class(TCefBaseRefCountedRef, ICefDisplay)
protected
function GetID : int64;
function GetDeviceScaleFactor : Single;
procedure ConvertPointToPixels(var point: TCefPoint);
procedure ConvertPointFromPixels(var point: TCefPoint);
function GetBounds : TCefRect;
function GetWorkArea : TCefRect;
function GetRotation : Integer;
public
class function UnWrap(data: Pointer): ICefDisplay;
class function Primary: ICefDisplay;
class function NearestPoint(const point: TCefPoint; input_pixel_coords: boolean): ICefDisplay;
class function MatchingBounds(const bounds: TCefRect; input_pixel_coords: boolean): ICefDisplay;
class function GetCount: NativeUInt;
class function GetAlls(var aDisplayArray : TCefDisplayArray) : boolean;
end;
implementation
uses
uCEFLibFunctions;
function TCefDisplayRef.GetID : int64;
begin
Result := PCefDisplay(FData)^.get_id(PCefDisplay(FData));
end;
function TCefDisplayRef.GetDeviceScaleFactor : Single;
begin
Result := PCefDisplay(FData)^.get_device_scale_factor(PCefDisplay(FData));
end;
procedure TCefDisplayRef.ConvertPointToPixels(var point: TCefPoint);
begin
PCefDisplay(FData)^.convert_point_to_pixels(PCefDisplay(FData), @point);
end;
procedure TCefDisplayRef.ConvertPointFromPixels(var point: TCefPoint);
begin
PCefDisplay(FData)^.convert_point_from_pixels(PCefDisplay(FData), @point);
end;
function TCefDisplayRef.GetBounds : TCefRect;
begin
Result := PCefDisplay(FData)^.get_bounds(PCefDisplay(FData));
end;
function TCefDisplayRef.GetWorkArea : TCefRect;
begin
Result := PCefDisplay(FData)^.get_work_area(PCefDisplay(FData));
end;
function TCefDisplayRef.GetRotation : Integer;
begin
Result := PCefDisplay(FData)^.get_rotation(PCefDisplay(FData));
end;
class function TCefDisplayRef.UnWrap(data: Pointer): ICefDisplay;
begin
if (data <> nil) then
Result := Create(data) as ICefDisplay
else
Result := nil;
end;
class function TCefDisplayRef.Primary: ICefDisplay;
begin
Result := UnWrap(cef_display_get_primary());
end;
class function TCefDisplayRef.NearestPoint(const point: TCefPoint; input_pixel_coords: boolean): ICefDisplay;
begin
Result := UnWrap(cef_display_get_nearest_point(@point, ord(input_pixel_coords)));
end;
class function TCefDisplayRef.MatchingBounds(const bounds: TCefRect; input_pixel_coords: boolean): ICefDisplay;
begin
Result := UnWrap(cef_display_get_matching_bounds(@bounds, ord(input_pixel_coords)));
end;
class function TCefDisplayRef.GetCount: NativeUInt;
begin
Result := cef_display_get_count();
end;
class function TCefDisplayRef.GetAlls(var aDisplayArray : TCefDisplayArray) : boolean;
type
TDisplayArray = array of PCefDisplay;
var
i, displaysCount: NativeUInt;
displays: PPCefDisplay;
TempSize : integer;
begin
Result := False;
displaysCount := GetCount;
if (displaysCount > 0) then
try
TempSize := SizeOf(TCefDisplay) * displaysCount;
GetMem(displays, TempSize);
FillChar(displays, TempSize, 0);
cef_display_get_alls(@displaysCount, displays);
SetLength(aDisplayArray, displaysCount);
i := 0;
while (i < displaysCount) do
begin
aDisplayArray[i] := TCefDisplayRef.UnWrap(TDisplayArray(displays)[i]);
inc(i);
end;
Result := True;
finally
FreeMem(displays);
end;
end;
end.

76
source/uCEFFillLayout.pas Normal file
View File

@ -0,0 +1,76 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFFillLayout;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout;
type
TCefFillLayoutRef = class(TCefLayoutRef, ICefFillLayout)
public
class function UnWrap(data: Pointer): ICefFillLayout;
end;
implementation
class function TCefFillLayoutRef.UnWrap(data: Pointer): ICefFillLayout;
begin
if (data <> nil) then
Result := Create(data) as ICefFillLayout
else
Result := nil;
end;
end.

View File

@ -158,6 +158,7 @@ type
TCefPostDataElementArray = array of ICefPostDataElement;
TCefMediaRouteArray = array of ICefMediaRoute;
TCefMediaSinkArray = array of ICefMediaSink;
TCefDisplayArray = array of ICefDisplay;
TCefMediaSinkInfo = record
ID : ustring;
@ -2405,6 +2406,12 @@ type
function GetBounds : TCefRect;
function GetWorkArea : TCefRect;
function GetRotation : Integer;
property ID : int64 read GetID;
property DeviceScaleFactor : Single read GetDeviceScaleFactor;
property Bounds : TCefRect read GetBounds;
property WorkArea : TCefRect read GetWorkArea;
property Rotation : Integer read GetRotation;
end;
// TCefLayout
@ -2414,6 +2421,8 @@ type
function AsBoxLayout : ICefBoxLayout;
function AsFillLayout : ICefFillLayout;
function IsValid : boolean;
property Valid : boolean read IsValid;
end;
// TCefBoxLayout
@ -2440,24 +2449,24 @@ type
function AsScrollView : ICefScrollView;
function AsTextfield : ICefTextfield;
function GetTypeString : ustring;
function ToString(include_children: boolean): ustring;
function ToStringEx(include_children: boolean): ustring;
function IsValid : boolean;
function IsAttached : boolean;
function IsSame(const that: ICefView): boolean;
function GetDelegate : ICefViewDelegate;
function GetWindow : ICefWindow;
function GetID : Integer;
procedure SetID(id: Integer);
procedure SetID(id_: Integer);
function GetGroupID : Integer;
procedure SetGroupID(group_id: Integer);
function GetParentView : ICefView;
function GetViewForID(id: Integer): ICefView;
procedure SetBounds(const bounds: PCefRect);
function GetViewForID(id_: Integer): ICefView;
procedure SetBounds(const bounds_: TCefRect);
function GetBounds : TCefRect;
function GetBoundsInScreen : TCefRect;
procedure SetSize(const size: PCefSize);
procedure SetSize(const size_: TCefSize);
function GetSize : TCefSize;
procedure SetPosition(const position: PCefPoint);
procedure SetPosition(const position_: TCefPoint);
function GetPosition : TCefPoint;
function GetPreferredSize : TCefSize;
procedure SizeToPreferredSize;
@ -2465,23 +2474,44 @@ type
function GetMaximumSize : TCefSize;
function GetHeightForWidth(width: Integer): Integer;
procedure InvalidateLayout;
procedure SetVisible(visible: boolean);
procedure SetVisible(visible_: boolean);
function IsVisible : boolean;
function IsDrawn : boolean;
procedure SetEnabled(enabled: boolean);
procedure SetEnabled(enabled_: boolean);
function IsEnabled : boolean;
procedure SetFocusable(focusable: boolean);
procedure SetFocusable(focusable_: boolean);
function IsFocusable : boolean;
function IsAccessibilityFocusable : boolean;
procedure RequestFocus;
procedure SetBackgroundColor(color: TCefColor);
function GetBackgroundColor : TCefColor;
function ConvertPointToScreen(point: PCefPoint): boolean;
function ConvertPointFromScreen(point: PCefPoint): boolean;
function ConvertPointToWindow(point: PCefPoint): boolean;
function ConvertPointFromWindow(point: PCefPoint): boolean;
function ConvertPointToView(const view : ICefView; point: PCefPoint): boolean;
function ConvertPointFromView(const view : ICefView; point: PCefPoint): boolean;
function ConvertPointToScreen(var point: TCefPoint): boolean;
function ConvertPointFromScreen(var point: TCefPoint): boolean;
function ConvertPointToWindow(var point: TCefPoint): boolean;
function ConvertPointFromWindow(var point: TCefPoint): boolean;
function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean;
function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean;
property Valid : boolean read IsValid;
property Attached : boolean read IsAttached;
property Delegate : ICefViewDelegate read GetDelegate;
property Window : ICefWindow read GetWindow;
property ParentView : ICefView read GetParentView;
property BoundsInScreen : TCefRect read GetBoundsInScreen;
property PreferredSize : TCefSize read GetPreferredSize;
property MinimumSize : TCefSize read GetMinimumSize;
property MaximumSize : TCefSize read GetMaximumSize;
property Visible : boolean read IsVisible write SetVisible;
property Drawn : boolean read IsDrawn;
property Enabled : boolean read IsEnabled write SetEnabled;
property Focusable : boolean read IsFocusable write SetFocusable;
property AccessibilityFocusable : boolean read IsAccessibilityFocusable;
property BackgroundColor : TCefColor read GetBackgroundColor write SetBackgroundColor;
property ID : integer read GetID write SetID;
property GroupID : integer read GetGroupID write SetGroupID;
property Bounds : TCefRect read GetBounds write SetBounds;
property Size : TCefSize read GetSize write SetSize;
property Position : TCefPoint read GetPosition write SetPosition;
end;
// TCefViewDelegate
@ -2507,15 +2537,15 @@ type
procedure SetReadOnly(read_only: boolean);
function IsReadOnly : boolean;
function GetText : ustring;
procedure SetText(const text: ustring);
procedure AppendText(const text: ustring);
procedure InsertOrReplaceText(const text: ustring);
procedure SetText(const text_: ustring);
procedure AppendText(const text_: ustring);
procedure InsertOrReplaceText(const text_: ustring);
function HasSelection : boolean;
function GetSelectedText : ustring;
procedure SelectAll(reversed: boolean);
procedure ClearSelection;
function GetSelectedRange : TCefRange;
procedure SelectRange(const range: PCefRange);
procedure SelectRange(const range: TCefRange);
function GetCursorPosition : NativeUInt;
procedure SetTextColor(color: TCefColor);
function GetTextColor : TCefColor;
@ -2524,22 +2554,31 @@ type
procedure SetSelectionBackgroundColor(color: TCefColor);
function GetSelectionBackgroundColor : TCefColor;
procedure SetFontList(const font_list: ustring);
procedure ApplyTextColor(color: TCefColor; const range: PCefRange);
procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: PCefRange);
procedure ApplyTextColor(color: TCefColor; const range: TCefRange);
procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange);
function IsCommandEnabled(command_id: Integer): boolean;
procedure ExecuteCommand(command_id: Integer);
procedure ClearEditHistory;
procedure SetPlaceholderText(const text: ustring);
function GgetPlaceholderText : ustring;
procedure SetPlaceholderText(const text_: ustring);
function GetPlaceholderText : ustring;
procedure SetPlaceholderTextColor(color: TCefColor);
procedure SetAccessibleName(const name: ustring);
property PasswordInput : boolean read IsPasswordInput write SetPasswordInput;
property ReadOnly : boolean read IsReadOnly write SetReadOnly;
property Text : ustring read GetText write SetText;
property SelectedText : ustring read GetSelectedText;
property TextColor : TCefColor read GetTextColor write SetTextColor;
property SelectionTextColor : TCefColor read GetSelectionTextColor write SetSelectionTextColor;
property SelectionBackgroundColor : TCefColor read GetSelectionBackgroundColor write SetSelectionBackgroundColor;
property PlaceholderText : ustring read GetPlaceholderText write SetPlaceholderText;
end;
// TCefTextfieldDelegate
// /include/capi/views/cef_textfield_delegate_capi.h (cef_textfield_delegate_t)
ICefTextfieldDelegate = interface(ICefViewDelegate)
['{72612994-92BB-4DE9-BB38-6F49FB45F94B}']
function OnKeyEvent(const textfield: ICefTextfield; const event: PCefKeyEvent): boolean;
function OnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent): boolean;
procedure OnAfterUserAction(const textfield: ICefTextfield);
end;
@ -2554,6 +2593,11 @@ type
function GetHorizontalScrollbarHeight : Integer;
function HasVerticalScrollbar : boolean;
function GetVerticalScrollbarWidth : Integer;
property ContentView : ICefView read GetContentView write SetContentView;
property VisibleContentRect : TCefRect read GetVisibleContentRect;
property HorizontalScrollbarHeight : Integer read GetHorizontalScrollbarHeight;
property VerticalScrollbarWidth : Integer read GetVerticalScrollbarWidth;
end;
// TCefPanel
@ -2562,7 +2606,7 @@ type
['{6F2F680A-3637-4438-81B8-79AD6C02252D}']
function AsWindow : ICefWindow;
function SetToFillLayout : ICefFillLayout;
function SetToBoxLayout(const settings: PCefBoxLayoutSettings): ICefBoxLayout;
function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout;
function GetLayout : ICefLayout;
procedure Layout;
procedure AddChildView(const view: ICefView);
@ -2594,7 +2638,7 @@ type
['{578A0DD4-2E7D-4061-B4DB-7C3CDC7A90C0}']
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
function GetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: PCefBrowserSettings; const client: ICefClient; is_devtools: boolean): ICefBrowserViewDelegate;
function GetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean): ICefBrowserViewDelegate;
function OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean): boolean;
end;
@ -2603,11 +2647,13 @@ type
ICefButton = interface(ICefView)
['{D3D2E8A0-9F9C-4BD8-B495-655976534281}']
function AsLabelButton : ICefLabelButton;
procedure SetState(state: TCefButtonState);
procedure SetState(state_: TCefButtonState);
function GetState : TCefButtonState;
procedure SetInkDropEnabled(enabled: boolean);
procedure SetInkDropEnabled(enabled_: boolean);
procedure SetTooltipText(const tooltip_text: ustring);
procedure SetAccessibleName(const name: ustring);
property State : TCefButtonState read GetState write SetState;
end;
// TCefButtonDelegate
@ -2622,8 +2668,8 @@ type
// /include/capi/views/cef_label_button_capi.h (cef_label_button_t)
ICefLabelButton = interface(ICefButton)
['{A99FD4F3-7EE6-4796-8BF6-EC367D51EED8}']
function GetState : ICefMenuButton;
procedure SetText(const text: ustring);
function AsMenuButton : ICefMenuButton;
procedure SetText(const text_: ustring);
function GetText : ustring;
procedure SetImage(button_state: TCefButtonState; const image: ICefImage);
function GetImage(button_state: TCefButtonState): ICefImage;
@ -2631,15 +2677,17 @@ type
procedure SetEnabledTextColors(color: TCefColor);
procedure SetFontList(const font_list: ustring);
procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment);
procedure SetMinimumSize(const size: PCefSize);
procedure SetMaximumSize(const size: PCefSize);
procedure SetMinimumSize(const size_: TCefSize);
procedure SetMaximumSize(const size_: TCefSize);
property Text : ustring read GetText write SetText;
end;
// TCefMenuButton
// /include/capi/views/cef_menu_button_capi.h (cef_menu_button_t)
ICefMenuButton = interface(ICefLabelButton)
['{62BFE81A-7810-400B-83C6-76D1DF133710}']
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: PCefPoint; anchor_position: TCefMenuAnchorPosition);
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition);
procedure TriggerMenu;
end;
@ -2653,7 +2701,7 @@ type
// /include/capi/views/cef_menu_button_delegate_capi.h (cef_menu_button_delegate_t)
ICefMenuButtonDelegate = interface(ICefButtonDelegate)
['{D0E89A75-463A-4766-8701-BD8D24B11E9F}']
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: PCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock);
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock);
end;
// TCefWindow
@ -2662,11 +2710,11 @@ type
['{C450C974-BF0A-4968-A6BE-153CEAD10DA6}']
procedure Show;
procedure Hide;
procedure CenterWindow(const size: PCefSize);
procedure CenterWindow(const size_: TCefSize);
procedure Close;
function IsClosed : boolean;
procedure Activate;
procedure deactivate;
procedure Deactivate;
function IsActive : boolean;
procedure BringToTop;
procedure SetAlwaysOnTop(on_top: boolean);
@ -2678,24 +2726,31 @@ type
function IsMaximized : boolean;
function IsMinimized : boolean;
function IsFullscreen : boolean;
procedure SetTitle(const title: ustring);
procedure SetTitle(const title_: ustring);
function GetTitle : ustring;
procedure SetWindowIcon(const image: ICefImage);
function GetWindowIcon : ICefImage;
procedure SetWindowAppIcon(const image: ICefImage);
function GetWindowAppIcon : ICefImage;
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: PCefPoint; anchor_position : TCefMenuAnchorPosition);
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition);
procedure CancelMenu;
function GetDisplay : ICefDisplay;
function GetClientAreaBoundsInScreen : TCefRect;
procedure SetDraggableRegions(regionsCount: NativeUInt; regions: PCefDraggableRegionArray);
procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);
function GetWindowHandle : TCefWindowHandle;
procedure SendKeyPress(key_code: Integer; event_flags: cardinal);
procedure SendKeyPress(key_code: Integer; event_flags: uint32);
procedure SendMouseMove(screen_x, screen_y: Integer);
procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: Integer);
procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean);
procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed: boolean);
procedure RemoveAccelerator(command_id: Integer);
procedure RemoveAllAccelerators;
property Title : ustring read GetTitle write SetTitle;
property WindowIcon : ICefImage read GetWindowIcon write SetWindowIcon;
property WindowAppIcon : ICefImage read GetWindowAppIcon write SetWindowAppIcon;
property Display : ICefDisplay read GetDisplay;
property ClientAreaBoundsInScreen : TCefRect read GetClientAreaBoundsInScreen;
property WindowHandle : TCefWindowHandle read GetWindowHandle;
end;
// TCefWindowDelegate
@ -2704,14 +2759,14 @@ type
['{52D4EE2C-303B-42B6-A35F-30D03834A23F}']
procedure OnWindowCreated(const window: ICefWindow);
procedure OnWindowDestroyed(const window: ICefWindow);
function GetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean): ICefWindow;
function GetParentWindow(const window: ICefWindow; is_menu, can_activate_menu: boolean): ICefWindow;
function IsFrameless(const window: ICefWindow): boolean;
function CanResize(const window: ICefWindow): boolean;
function CanMaximize(const window: ICefWindow): boolean;
function CanMinimize(const window: ICefWindow): boolean;
function CanClose(const window: ICefWindow): boolean;
function OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
function OnKeyEvent(const window: ICefWindow; const event: PCefKeyEvent): boolean;
function OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
end;
implementation

163
source/uCEFLabelButton.pas Normal file
View File

@ -0,0 +1,163 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFLabelButton;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFButton;
type
TCefLabelButtonRef = class(TCefButtonRef, ICefLabelButton)
protected
function AsMenuButton : ICefMenuButton;
procedure SetText(const text_: ustring);
function GetText : ustring;
procedure SetImage(button_state: TCefButtonState; const image: ICefImage);
function GetImage(button_state: TCefButtonState): ICefImage;
procedure SetTextColor(for_state: TCefButtonState; color: TCefColor);
procedure SetEnabledTextColors(color: TCefColor);
procedure SetFontList(const font_list: ustring);
procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment);
procedure SetMinimumSize(const size_: TCefSize);
procedure SetMaximumSize(const size_: TCefSize);
public
class function UnWrap(data: Pointer): ICefLabelButton;
class function CreateLabelButton(const delegate: ICefButtonDelegate; const text: ustring): ICefLabelButton;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFMenuButton, uCEFImage;
function TCefLabelButtonRef.AsMenuButton : ICefMenuButton;
begin
Result := TCefMenuButtonRef.UnWrap(PCefLabelButton(FData)^.as_menu_button(PCefLabelButton(FData)));
end;
procedure TCefLabelButtonRef.SetText(const text_: ustring);
var
TempText : TCefString;
begin
TempText := CefString(text_);
PCefLabelButton(FData)^.set_text(PCefLabelButton(FData), @TempText);
end;
function TCefLabelButtonRef.GetText : ustring;
begin
Result := CefStringFreeAndGet(PCefLabelButton(FData)^.get_text(PCefLabelButton(FData)));
end;
procedure TCefLabelButtonRef.SetImage(button_state: TCefButtonState; const image: ICefImage);
begin
PCefLabelButton(FData)^.set_image(PCefLabelButton(FData), button_state, CefGetData(image));
end;
function TCefLabelButtonRef.GetImage(button_state: TCefButtonState): ICefImage;
begin
Result := TCefImageRef.UnWrap(PCefLabelButton(FData)^.get_image(PCefLabelButton(FData), button_state));
end;
procedure TCefLabelButtonRef.SetTextColor(for_state: TCefButtonState; color: TCefColor);
begin
PCefLabelButton(FData)^.set_text_color(PCefLabelButton(FData), for_state, color);
end;
procedure TCefLabelButtonRef.SetEnabledTextColors(color: TCefColor);
begin
PCefLabelButton(FData)^.set_enabled_text_colors(PCefLabelButton(FData), color);
end;
procedure TCefLabelButtonRef.SetFontList(const font_list: ustring);
var
TempFontList : TCefString;
begin
TempFontList := CefString(font_list);
PCefLabelButton(FData)^.set_font_list(PCefLabelButton(FData), @TempFontList);
end;
procedure TCefLabelButtonRef.SetHorizontalAlignment(alignment: TCefHorizontalAlignment);
begin
PCefLabelButton(FData)^.set_horizontal_alignment(PCefLabelButton(FData), alignment);
end;
procedure TCefLabelButtonRef.SetMinimumSize(const size_: TCefSize);
begin
PCefLabelButton(FData)^.set_minimum_size(PCefLabelButton(FData), @size_);
end;
procedure TCefLabelButtonRef.SetMaximumSize(const size_: TCefSize);
begin
PCefLabelButton(FData)^.set_maximum_size(PCefLabelButton(FData), @size_);
end;
class function TCefLabelButtonRef.UnWrap(data: Pointer): ICefLabelButton;
begin
if (data <> nil) then
Result := Create(data) as ICefLabelButton
else
Result := nil;
end;
class function TCefLabelButtonRef.CreateLabelButton(const delegate : ICefButtonDelegate;
const text : ustring): ICefLabelButton;
var
TempText : TCefString;
begin
TempText := CefString(text);
UnWrap(cef_label_button_create(CefGetData(delegate), @TempText));
end;
end.

99
source/uCEFLayout.pas Normal file
View File

@ -0,0 +1,99 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFLayout;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefLayoutRef = class(TCefBaseRefCountedRef, ICefLayout)
protected
function AsBoxLayout : ICefBoxLayout;
function AsFillLayout : ICefFillLayout;
function IsValid : boolean;
public
class function UnWrap(data: Pointer): ICefLayout;
end;
implementation
uses
uCEFLibFunctions, uCEFBoxLayout, uCEFFillLayout;
function TCefLayoutRef.AsBoxLayout : ICefBoxLayout;
begin
Result := TCefBoxLayoutRef.UnWrap(PCefLayout(FData)^.as_box_layout(PCefLayout(FData)));
end;
function TCefLayoutRef.AsFillLayout : ICefFillLayout;
begin
Result := TCefFillLayoutRef.UnWrap(PCefLayout(FData)^.as_fill_layout(PCefLayout(FData)));
end;
function TCefLayoutRef.IsValid : boolean;
begin
Result := (PCefLayout(FData)^.is_valid(PCefLayout(FData)) <> 0);
end;
class function TCefLayoutRef.UnWrap(data: Pointer): ICefLayout;
begin
if (data <> nil) then
Result := Create(data) as ICefLayout
else
Result := nil;
end;
end.

View File

@ -228,6 +228,12 @@ var
// /include/capi/cef_zip_reader_capi.h
cef_zip_reader_create : function(stream: PCefStreamReader): PCefZipReader; cdecl;
// *********************************
// ************* VIEWS *************
// *********************************
// /include/capi/views/cef_browser_view_capi.h
cef_browser_view_create : function(client: PCefClient; const url: PCefString; const settings: PCefBrowserSettings; extra_info: PCefDictionaryValue; request_context: PCefRequestContext; delegate: PCefBrowserViewDelegate): PCefBrowserView; cdecl;
cef_browser_view_get_for_browser : function(browser: PCefBrowser): PCefBrowserView; cdecl;
@ -237,7 +243,7 @@ var
cef_display_get_nearest_point : function(const point: PCefPoint; input_pixel_coords: Integer): PCefDisplay; cdecl;
cef_display_get_matching_bounds : function(const bounds: PCefRect; input_pixel_coords: Integer): PCefDisplay; cdecl;
cef_display_get_count : function : NativeUInt; cdecl;
cef_display_get_alls : procedure(var displaysCount: NativeUInt; var displays: PCefDisplay); cdecl;
cef_display_get_alls : procedure(displaysCount: PNativeUInt; displays: PPCefDisplay); cdecl;
// /include/capi/views/cef_label_button_capi.h
cef_label_button_create : function(delegate: PCefButtonDelegate; const text: PCefString): PCefLabelButton; cdecl;
@ -257,6 +263,12 @@ var
// /include/capi/views/cef_window_capi.h
cef_window_create_top_level : function(delegate: PCefWindowDelegate): PCefWindow; cdecl;
// *********************************
// *********** INTERNAL ************
// *********************************
// /include/internal/cef_logging_internal.h
cef_get_min_log_level : function : Integer; cdecl;
cef_get_vlog_level : function(const file_start: PAnsiChar; N: NativeInt): Integer; cdecl;

108
source/uCEFMenuButton.pas Normal file
View File

@ -0,0 +1,108 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFMenuButton;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLabelButton;
type
TCefMenuButtonRef = class(TCefLabelButtonRef, ICefMenuButton)
protected
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition);
procedure TriggerMenu;
public
class function UnWrap(data: Pointer): ICefMenuButton;
class function CreateMenuButton(const delegate: ICefMenuButtonDelegate; const text: ustring): ICefMenuButton;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefMenuButtonRef.ShowMenu(const menu_model : ICefMenuModel;
const screen_point : TCefPoint;
anchor_position : TCefMenuAnchorPosition);
begin
PCefMenuButton(FData)^.show_menu(PCefMenuButton(FData),
CefGetData(menu_model),
@screen_point,
anchor_position);
end;
procedure TCefMenuButtonRef.TriggerMenu;
begin
PCefMenuButton(FData)^.trigger_menu(PCefMenuButton(FData));
end;
class function TCefMenuButtonRef.UnWrap(data: Pointer): ICefMenuButton;
begin
if (data <> nil) then
Result := Create(data) as ICefMenuButton
else
Result := nil;
end;
class function TCefMenuButtonRef.CreateMenuButton(const delegate : ICefMenuButtonDelegate;
const text : ustring): ICefMenuButton;
var
TempText : TCefString;
begin
TempText := CefString(text);
UnWrap(cef_menu_button_create(CefGetData(delegate), @TempText));
end;
end.

View File

@ -0,0 +1,92 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFMenuButtonDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFButtonDelegate;
type
TCefMenuButtonDelegateRef = class(TCefButtonDelegateRef, ICefMenuButtonDelegate)
protected
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock);
public
class function UnWrap(data: Pointer): ICefMenuButtonDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefMenuButtonDelegateRef.OnMenuButtonPressed(const menu_button : ICefMenuButton;
const screen_point : TCefPoint;
const button_pressed_lock : ICefMenuButtonPressedLock);
begin
PCefMenuButtonDelegate(FData)^.on_menu_button_pressed(PCefMenuButtonDelegate(FData),
CefGetData(menu_button),
@screen_point,
CefGetData(button_pressed_lock));
end;
class function TCefMenuButtonDelegateRef.UnWrap(data: Pointer): ICefMenuButtonDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefMenuButtonDelegate
else
Result := nil;
end;
end.

View File

@ -0,0 +1,76 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFMenuButtonPressedLock;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMenuButtonPressedLockRef = class(TCefBaseRefCountedRef, ICefMenuButtonPressedLock)
public
class function UnWrap(data: Pointer): ICefMenuButtonPressedLock;
end;
implementation
class function TCefMenuButtonPressedLockRef.UnWrap(data: Pointer): ICefMenuButtonPressedLock;
begin
if (data <> nil) then
Result := Create(data) as ICefMenuButtonPressedLock
else
Result := nil;
end;
end.

160
source/uCEFPanel.pas Normal file
View File

@ -0,0 +1,160 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFPanel;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type
TCefPanelRef = class(TCefViewRef, ICefPanel)
protected
function AsWindow : ICefWindow;
function SetToFillLayout : ICefFillLayout;
function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout;
function GetLayout : ICefLayout;
procedure Layout;
procedure AddChildView(const view: ICefView);
procedure AddChildViewAt(const view: ICefView; index: Integer);
procedure ReorderChildView(const view: ICefView; index: Integer);
procedure RemoveChildView(const view: ICefView);
procedure RemoveAllChildViews;
function GetChildViewCount : NativeUInt;
function GetChildViewAt(index: Integer): ICefView;
public
class function UnWrap(data: Pointer): ICefPanel;
class function CreatePanel(const delegate: ICefPanelDelegate): ICefPanel;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFWindow, uCEFLayout, uCEFFillLayout,
uCEFBoxLayout;
function TCefPanelRef.AsWindow : ICefWindow;
begin
Result := TCefWindowRef.UnWrap(PCefPanel(FData)^.as_window(PCefPanel(FData)));
end;
function TCefPanelRef.SetToFillLayout : ICefFillLayout;
begin
Result := TCefFillLayoutRef.UnWrap(PCefPanel(FData)^.set_to_fill_layout(PCefPanel(FData)));
end;
function TCefPanelRef.SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout;
begin
Result := TCefBoxLayoutRef.UnWrap(PCefPanel(FData)^.set_to_box_layout(PCefPanel(FData), @settings));
end;
function TCefPanelRef.GetLayout : ICefLayout;
begin
Result := TCefLayoutRef.UnWrap(PCefPanel(FData)^.get_layout(PCefPanel(FData)));
end;
procedure TCefPanelRef.Layout;
begin
PCefPanel(FData)^.layout(PCefPanel(FData));
end;
procedure TCefPanelRef.AddChildView(const view: ICefView);
begin
PCefPanel(FData)^.add_child_view(PCefPanel(FData), CefGetData(view));
end;
procedure TCefPanelRef.AddChildViewAt(const view: ICefView; index: Integer);
begin
PCefPanel(FData)^.add_child_view_at(PCefPanel(FData), CefGetData(view), index);
end;
procedure TCefPanelRef.ReorderChildView(const view: ICefView; index: Integer);
begin
PCefPanel(FData)^.reorder_child_view(PCefPanel(FData), CefGetData(view), index);
end;
procedure TCefPanelRef.RemoveChildView(const view: ICefView);
begin
PCefPanel(FData)^.remove_child_view(PCefPanel(FData), CefGetData(view));
end;
procedure TCefPanelRef.RemoveAllChildViews;
begin
PCefPanel(FData)^.remove_all_child_views(PCefPanel(FData));
end;
function TCefPanelRef.GetChildViewCount : NativeUInt;
begin
Result := PCefPanel(FData)^.get_child_view_count(PCefPanel(FData));
end;
function TCefPanelRef.GetChildViewAt(index: Integer): ICefView;
begin
Result := TCefViewRef.UnWrap(PCefPanel(FData)^.get_child_view_at(PCefPanel(FData), index));
end;
class function TCefPanelRef.UnWrap(data: Pointer): ICefPanel;
begin
if (data <> nil) then
Result := Create(data) as ICefPanel
else
Result := nil;
end;
class function TCefPanelRef.CreatePanel(const delegate: ICefPanelDelegate): ICefPanel;
begin
UnWrap(cef_panel_create(CefGetData(delegate)));
end;
end.

View File

@ -0,0 +1,76 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFPanelDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFViewDelegate;
type
TCefPanelDelegateRef = class(TCefViewDelegateRef, ICefPanelDelegate)
public
class function UnWrap(data: Pointer): ICefPanelDelegate;
end;
implementation
class function TCefPanelDelegateRef.UnWrap(data: Pointer): ICefPanelDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefPanelDelegate
else
Result := nil;
end;
end.

View File

@ -111,8 +111,9 @@ type
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager,
uCEFRequestContextHandler, uCEFExtension, uCEFStringList, uCEFMediaRouter;
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue,
uCEFCookieManager, uCEFRequestContextHandler, uCEFExtension, uCEFStringList,
uCEFMediaRouter;
function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean;
begin

130
source/uCEFScrollView.pas Normal file
View File

@ -0,0 +1,130 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFScrollView;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type
TCefScrollViewRef = class(TCefViewRef, ICefScrollView)
protected
procedure SetContentView(const view: ICefView);
function GetContentView : ICefView;
function GetVisibleContentRect : TCefRect;
function HasHorizontalScrollbar : boolean;
function GetHorizontalScrollbarHeight : Integer;
function HasVerticalScrollbar : boolean;
function GetVerticalScrollbarWidth : Integer;
public
class function UnWrap(data: Pointer): ICefScrollView;
class function CreateScrollView(const delegate: ICefViewDelegate): ICefScrollView;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefScrollViewRef.SetContentView(const view: ICefView);
begin
PCefScrollView(FData)^.set_content_view(PCefScrollView(FData),
CefGetData(view));
end;
function TCefScrollViewRef.GetContentView : ICefView;
begin
Result := TCefViewRef.UnWrap(PCefScrollView(FData)^.get_content_view(PCefScrollView(FData)));
end;
function TCefScrollViewRef.GetVisibleContentRect : TCefRect;
begin
Result := PCefScrollView(FData)^.get_visible_content_rect(PCefScrollView(FData));
end;
function TCefScrollViewRef.HasHorizontalScrollbar : boolean;
begin
Result := (PCefScrollView(FData)^.has_horizontal_scrollbar(PCefScrollView(FData)) <> 0);
end;
function TCefScrollViewRef.GetHorizontalScrollbarHeight : Integer;
begin
Result := PCefScrollView(FData)^.get_horizontal_scrollbar_height(PCefScrollView(FData));
end;
function TCefScrollViewRef.HasVerticalScrollbar : boolean;
begin
Result := (PCefScrollView(FData)^.has_vertical_scrollbar(PCefScrollView(FData)) <> 0);
end;
function TCefScrollViewRef.GetVerticalScrollbarWidth : Integer;
begin
Result := PCefScrollView(FData)^.get_vertical_scrollbar_width(PCefScrollView(FData));
end;
class function TCefScrollViewRef.UnWrap(data: Pointer): ICefScrollView;
begin
if (data <> nil) then
Result := Create(data) as ICefScrollView
else
Result := nil;
end;
class function TCefScrollViewRef.CreateScrollView(const delegate: ICefViewDelegate): ICefScrollView;
begin
UnWrap(cef_scroll_view_create(CefGetData(delegate)));
end;
end.

293
source/uCEFTextfield.pas Normal file
View File

@ -0,0 +1,293 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFTextfield;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type
TCefTextfieldRef = class(TCefViewRef, ICefTextfield)
protected
procedure SetPasswordInput(password_input: boolean);
function IsPasswordInput : boolean;
procedure SetReadOnly(read_only: boolean);
function IsReadOnly : boolean;
function GetText : ustring;
procedure SetText(const text_: ustring);
procedure AppendText(const text_: ustring);
procedure InsertOrReplaceText(const text_: ustring);
function HasSelection : boolean;
function GetSelectedText : ustring;
procedure SelectAll(reversed: boolean);
procedure ClearSelection;
function GetSelectedRange : TCefRange;
procedure SelectRange(const range: TCefRange);
function GetCursorPosition : NativeUInt;
procedure SetTextColor(color: TCefColor);
function GetTextColor : TCefColor;
procedure SetSelectionTextColor(color: TCefColor);
function GetSelectionTextColor : TCefColor;
procedure SetSelectionBackgroundColor(color: TCefColor);
function GetSelectionBackgroundColor : TCefColor;
procedure SetFontList(const font_list: ustring);
procedure ApplyTextColor(color: TCefColor; const range: TCefRange);
procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange);
function IsCommandEnabled(command_id: Integer): boolean;
procedure ExecuteCommand(command_id: Integer);
procedure ClearEditHistory;
procedure SetPlaceholderText(const text_: ustring);
function GetPlaceholderText : ustring;
procedure SetPlaceholderTextColor(color: TCefColor);
procedure SetAccessibleName(const name: ustring);
public
class function UnWrap(data: Pointer): ICefTextfield;
class function CreateTextField(const delegate: ICefTextfieldDelegate): ICefTextfield;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
procedure TCefTextfieldRef.SetPasswordInput(password_input: boolean);
begin
PCefTextfield(FData)^.set_password_input(PCefTextfield(FData),
ord(password_input));
end;
function TCefTextfieldRef.IsPasswordInput : boolean;
begin
Result := (PCefTextfield(FData)^.is_password_input(PCefTextfield(FData)) <> 0);
end;
procedure TCefTextfieldRef.SetReadOnly(read_only: boolean);
begin
PCefTextfield(FData)^.set_read_only(PCefTextfield(FData),
ord(read_only));
end;
function TCefTextfieldRef.IsReadOnly : boolean;
begin
Result := (PCefTextfield(FData)^.is_read_only(PCefTextfield(FData)) <> 0);
end;
function TCefTextfieldRef.GetText : ustring;
begin
Result := CefStringFreeAndGet(PCefTextfield(FData)^.get_text(PCefTextfield(FData)));
end;
procedure TCefTextfieldRef.SetText(const text_: ustring);
var
TempText : TCefString;
begin
TempText := CefString(text_);
PCefTextfield(FData)^.set_text(PCefTextfield(FData), @TempText);
end;
procedure TCefTextfieldRef.AppendText(const text_: ustring);
var
TempText : TCefString;
begin
TempText := CefString(text_);
PCefTextfield(FData)^.append_text(PCefTextfield(FData), @TempText);
end;
procedure TCefTextfieldRef.InsertOrReplaceText(const text_: ustring);
var
TempText : TCefString;
begin
TempText := CefString(text_);
PCefTextfield(FData)^.insert_or_replace_text(PCefTextfield(FData), @TempText);
end;
function TCefTextfieldRef.HasSelection : boolean;
begin
Result := (PCefTextfield(FData)^.has_selection(PCefTextfield(FData)) <> 0);
end;
function TCefTextfieldRef.GetSelectedText : ustring;
begin
Result := CefStringFreeAndGet(PCefTextfield(FData)^.get_selected_text(PCefTextfield(FData)));
end;
procedure TCefTextfieldRef.SelectAll(reversed: boolean);
begin
PCefTextfield(FData)^.select_all(PCefTextfield(FData), ord(reversed));
end;
procedure TCefTextfieldRef.ClearSelection;
begin
PCefTextfield(FData)^.clear_selection(PCefTextfield(FData));
end;
function TCefTextfieldRef.GetSelectedRange : TCefRange;
begin
Result := PCefTextfield(FData)^.get_selected_range(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SelectRange(const range: TCefRange);
begin
PCefTextfield(FData)^.select_range(PCefTextfield(FData), @range);
end;
function TCefTextfieldRef.GetCursorPosition : NativeUInt;
begin
Result := PCefTextfield(FData)^.get_cursor_position(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SetTextColor(color: TCefColor);
begin
PCefTextfield(FData)^.set_text_color(PCefTextfield(FData), color);
end;
function TCefTextfieldRef.GetTextColor : TCefColor;
begin
Result := PCefTextfield(FData)^.get_text_color(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SetSelectionTextColor(color: TCefColor);
begin
PCefTextfield(FData)^.set_selection_text_color(PCefTextfield(FData), color);
end;
function TCefTextfieldRef.GetSelectionTextColor : TCefColor;
begin
Result := PCefTextfield(FData)^.get_selection_text_color(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SetSelectionBackgroundColor(color: TCefColor);
begin
PCefTextfield(FData)^.set_selection_background_color(PCefTextfield(FData), color);
end;
function TCefTextfieldRef.GetSelectionBackgroundColor : TCefColor;
begin
Result := PCefTextfield(FData)^.get_selection_background_color(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SetFontList(const font_list: ustring);
var
TempFontList : TCefString;
begin
TempFontList := CefString(font_list);
PCefTextfield(FData)^.set_font_list(PCefTextfield(FData), @TempFontList);
end;
procedure TCefTextfieldRef.ApplyTextColor(color: TCefColor; const range: TCefRange);
begin
PCefTextfield(FData)^.apply_text_color(PCefTextfield(FData), color, @range);
end;
procedure TCefTextfieldRef.ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange);
begin
PCefTextfield(FData)^.apply_text_style(PCefTextfield(FData), style, ord(add), @range);
end;
function TCefTextfieldRef.IsCommandEnabled(command_id: Integer): boolean;
begin
Result := (PCefTextfield(FData)^.is_command_enabled(PCefTextfield(FData), command_id) <> 0);
end;
procedure TCefTextfieldRef.ExecuteCommand(command_id: Integer);
begin
PCefTextfield(FData)^.execute_command(PCefTextfield(FData), command_id);
end;
procedure TCefTextfieldRef.ClearEditHistory;
begin
PCefTextfield(FData)^.clear_edit_history(PCefTextfield(FData));
end;
procedure TCefTextfieldRef.SetPlaceholderText(const text_: ustring);
var
TempText : TCefString;
begin
TempText := CefString(text_);
PCefTextfield(FData)^.set_placeholder_text(PCefTextfield(FData), @TempText);
end;
function TCefTextfieldRef.GetPlaceholderText : ustring;
begin
Result := CefStringFreeAndGet(PCefTextfield(FData)^.get_placeholder_text(PCefTextfield(FData)));
end;
procedure TCefTextfieldRef.SetPlaceholderTextColor(color: TCefColor);
begin
PCefTextfield(FData)^.set_placeholder_text_color(PCefTextfield(FData), color);
end;
procedure TCefTextfieldRef.SetAccessibleName(const name: ustring);
var
TempName : TCefString;
begin
TempName := CefString(name);
PCefTextfield(FData)^.set_accessible_name(PCefTextfield(FData), @TempName);
end;
class function TCefTextfieldRef.UnWrap(data: Pointer): ICefTextfield;
begin
if (data <> nil) then
Result := Create(data) as ICefTextfield
else
Result := nil;
end;
class function TCefTextfieldRef.CreateTextField(const delegate: ICefTextfieldDelegate): ICefTextfield;
begin
Result := UnWrap(cef_textfield_create(CefGetData(delegate)));
end;
end.

View File

@ -0,0 +1,96 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFTextfieldDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFViewDelegate;
type
TCefTextfieldDelegateRef = class(TCefViewDelegateRef, ICefTextfieldDelegate)
protected
function OnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent): boolean;
procedure OnAfterUserAction(const textfield: ICefTextfield);
public
class function UnWrap(data: Pointer): ICefTextfieldDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
function TCefTextfieldDelegateRef.OnKeyEvent(const textfield : ICefTextfield;
const event : TCefKeyEvent): boolean;
begin
Result := (PCefTextfieldDelegate(FData)^.on_key_event(PCefTextfieldDelegate(FData),
CefGetData(textfield),
@event) <> 0);
end;
procedure TCefTextfieldDelegateRef.OnAfterUserAction(const textfield: ICefTextfield);
begin
PCefTextfieldDelegate(FData)^.on_after_user_action(PCefTextfieldDelegate(FData),
CefGetData(textfield));
end;
class function TCefTextfieldDelegateRef.UnWrap(data: Pointer): ICefTextfieldDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefTextfieldDelegate
else
Result := nil;
end;
end.

View File

@ -213,6 +213,7 @@ type
PCefX509Certificate = ^TCefX509Certificate;
PPCefX509Certificate = ^PCefX509Certificate;
PCefDisplay = ^TCefDisplay;
PPCefDisplay = ^PCefDisplay;
PCefLayout = ^TCefLayout;
PCefBoxLayout = ^TCefBoxLayout;
PCefFillLayout = ^TCefFillLayout;
@ -3093,7 +3094,7 @@ type
// /include/capi/views/cef_label_button_capi.h (cef_label_button_t)
TCefLabelButton = record
base : TCefButton;
get_state : function(self: PCefLabelButton): PCefMenuButton; stdcall;
as_menu_button : function(self: PCefLabelButton): PCefMenuButton; stdcall;
set_text : procedure(self: PCefLabelButton; const text: PCefString); stdcall;
get_text : function(self: PCefLabelButton): PCefStringUserFree; stdcall;
set_image : procedure(self: PCefLabelButton; button_state: TCefButtonState; image: PCefImage); stdcall;
@ -3155,9 +3156,9 @@ type
cancel_menu : procedure(self: PCefWindow); stdcall;
get_display : function(self: PCefWindow): PCefDisplay; stdcall;
get_client_area_bounds_in_screen : function(self: PCefWindow): TCefRect; stdcall;
set_draggable_regions : procedure(self: PCefWindow; regionsCount: NativeUInt; regions: PCefDraggableRegionArray); stdcall;
set_draggable_regions : procedure(self: PCefWindow; regionsCount: NativeUInt; const regions: PCefDraggableRegionArray); stdcall;
get_window_handle : function(self: PCefWindow): TCefWindowHandle; stdcall;
send_key_press : procedure(self: PCefWindow; key_code: Integer; event_flags: cardinal); stdcall;
send_key_press : procedure(self: PCefWindow; key_code: Integer; event_flags: uint32); stdcall;
send_mouse_move : procedure(self: PCefWindow; screen_x, screen_y: Integer); stdcall;
send_mouse_events : procedure(self: PCefWindow; button: TCefMouseButtonType; mouse_down, mouse_up: Integer); stdcall;
set_accelerator : procedure(self: PCefWindow; command_id, key_code, shift_pressed, ctrl_pressed, alt_pressed: Integer); stdcall;

370
source/uCEFView.pas Normal file
View File

@ -0,0 +1,370 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFView;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefViewRef = class(TCefBaseRefCountedRef, ICefView)
protected
function AsBrowserView : ICefBrowserView;
function AsButton : ICefButton;
function AsPanel : ICefPanel;
function AsScrollView : ICefScrollView;
function AsTextfield : ICefTextfield;
function GetTypeString : ustring;
function ToStringEx(include_children: boolean): ustring;
function IsValid : boolean;
function IsAttached : boolean;
function IsSame(const that: ICefView): boolean;
function GetDelegate : ICefViewDelegate;
function GetWindow : ICefWindow;
function GetID : Integer;
procedure SetID(id_: Integer);
function GetGroupID : Integer;
procedure SetGroupID(group_id: Integer);
function GetParentView : ICefView;
function GetViewForID(id_: Integer): ICefView;
procedure SetBounds(const bounds_: TCefRect);
function GetBounds : TCefRect;
function GetBoundsInScreen : TCefRect;
procedure SetSize(const size_: TCefSize);
function GetSize : TCefSize;
procedure SetPosition(const position_: TCefPoint);
function GetPosition : TCefPoint;
function GetPreferredSize : TCefSize;
procedure SizeToPreferredSize;
function GetMinimumSize : TCefSize;
function GetMaximumSize : TCefSize;
function GetHeightForWidth(width: Integer): Integer;
procedure InvalidateLayout;
procedure SetVisible(visible_: boolean);
function IsVisible : boolean;
function IsDrawn : boolean;
procedure SetEnabled(enabled_: boolean);
function IsEnabled : boolean;
procedure SetFocusable(focusable_: boolean);
function IsFocusable : boolean;
function IsAccessibilityFocusable : boolean;
procedure RequestFocus;
procedure SetBackgroundColor(color: TCefColor);
function GetBackgroundColor : TCefColor;
function ConvertPointToScreen(var point: TCefPoint): boolean;
function ConvertPointFromScreen(var point: TCefPoint): boolean;
function ConvertPointToWindow(var point: TCefPoint): boolean;
function ConvertPointFromWindow(var point: TCefPoint): boolean;
function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean;
function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean;
public
class function UnWrap(data: Pointer): ICefView;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFBrowserView, uCEFButton, uCEFPanel,
uCEFScrollView, uCEFTextfield, uCEFViewDelegate, uCEFWindow;
function TCefViewRef.AsBrowserView : ICefBrowserView;
begin
Result := TCefBrowserViewRef.UnWrap(PCefView(FData)^.as_browser_view(PCefView(FData)));
end;
function TCefViewRef.AsButton : ICefButton;
begin
Result := TCefButtonRef.UnWrap(PCefView(FData)^.as_button(PCefView(FData)));
end;
function TCefViewRef.AsPanel : ICefPanel;
begin
Result := TCefPanelRef.UnWrap(PCefView(FData)^.as_panel(PCefView(FData)));
end;
function TCefViewRef.AsScrollView : ICefScrollView;
begin
Result := TCefScrollViewRef.UnWrap(PCefView(FData)^.as_scroll_view(PCefView(FData)));
end;
function TCefViewRef.AsTextfield : ICefTextfield;
begin
Result := TCefTextfieldRef.UnWrap(PCefView(FData)^.as_textfield(PCefView(FData)));
end;
function TCefViewRef.GetTypeString : ustring;
begin
Result := CefStringFreeAndGet(PCefView(FData)^.get_type_string(PCefView(FData)));
end;
function TCefViewRef.ToStringEx(include_children: boolean): ustring;
begin
Result := CefStringFreeAndGet(PCefView(FData)^.to_string(PCefView(FData), ord(include_children)));
end;
function TCefViewRef.IsValid : boolean;
begin
Result := (PCefView(FData)^.is_valid(PCefView(FData)) <> 0);
end;
function TCefViewRef.IsAttached : boolean;
begin
Result := (PCefView(FData)^.is_attached(PCefView(FData)) <> 0);
end;
function TCefViewRef.IsSame(const that: ICefView): boolean;
begin
Result := PCefView(FData)^.is_same(PCefView(FData), CefGetData(that)) <> 0;
end;
function TCefViewRef.GetDelegate : ICefViewDelegate;
begin
Result := TCefViewDelegateRef.UnWrap(PCefView(FData)^.get_delegate(PCefView(FData)));
end;
function TCefViewRef.GetWindow : ICefWindow;
begin
Result := TCefWindowRef.UnWrap(PCefView(FData)^.get_window(PCefView(FData)));
end;
function TCefViewRef.GetID : Integer;
begin
Result := PCefView(FData)^.get_id(PCefView(FData));
end;
procedure TCefViewRef.SetID(id_: Integer);
begin
PCefView(FData)^.set_id(PCefView(FData), id_);
end;
function TCefViewRef.GetGroupID : Integer;
begin
Result := PCefView(FData)^.get_group_id(PCefView(FData));
end;
procedure TCefViewRef.SetGroupID(group_id: Integer);
begin
PCefView(FData)^.set_group_id(PCefView(FData), group_id);
end;
function TCefViewRef.GetParentView : ICefView;
begin
Result := UnWrap(PCefView(FData)^.get_parent_view(PCefView(FData)));
end;
function TCefViewRef.GetViewForID(id_: Integer): ICefView;
begin
Result := UnWrap(PCefView(FData)^.get_view_for_id(PCefView(FData), id_));
end;
procedure TCefViewRef.SetBounds(const bounds_: TCefRect);
begin
PCefView(FData)^.set_bounds(PCefView(FData), @bounds_);
end;
function TCefViewRef.GetBounds : TCefRect;
begin
Result := PCefView(FData)^.get_bounds(PCefView(FData));
end;
function TCefViewRef.GetBoundsInScreen : TCefRect;
begin
Result := PCefView(FData)^.get_bounds_in_screen(PCefView(FData));
end;
procedure TCefViewRef.SetSize(const size_: TCefSize);
begin
PCefView(FData)^.set_size(PCefView(FData), @size_);
end;
function TCefViewRef.GetSize : TCefSize;
begin
Result := PCefView(FData)^.get_size(PCefView(FData));
end;
procedure TCefViewRef.SetPosition(const position_: TCefPoint);
begin
PCefView(FData)^.set_position(PCefView(FData), @position_);
end;
function TCefViewRef.GetPosition : TCefPoint;
begin
Result := PCefView(FData)^.get_position(PCefView(FData));
end;
function TCefViewRef.GetPreferredSize : TCefSize;
begin
Result := PCefView(FData)^.get_preferred_size(PCefView(FData));
end;
procedure TCefViewRef.SizeToPreferredSize;
begin
PCefView(FData)^.size_to_preferred_size(PCefView(FData));
end;
function TCefViewRef.GetMinimumSize : TCefSize;
begin
Result := PCefView(FData)^.get_minimum_size(PCefView(FData));
end;
function TCefViewRef.GetMaximumSize : TCefSize;
begin
Result := PCefView(FData)^.get_maximum_size(PCefView(FData));
end;
function TCefViewRef.GetHeightForWidth(width: Integer): Integer;
begin
Result := PCefView(FData)^.get_height_for_width(PCefView(FData), width);
end;
procedure TCefViewRef.InvalidateLayout;
begin
PCefView(FData)^.invalidate_layout(PCefView(FData));
end;
procedure TCefViewRef.SetVisible(visible_: boolean);
begin
PCefView(FData)^.set_visible(PCefView(FData), ord(visible_));
end;
function TCefViewRef.IsVisible : boolean;
begin
Result := (PCefView(FData)^.is_visible(PCefView(FData)) <> 0);
end;
function TCefViewRef.IsDrawn : boolean;
begin
Result := (PCefView(FData)^.is_drawn(PCefView(FData)) <> 0);
end;
procedure TCefViewRef.SetEnabled(enabled_: boolean);
begin
PCefView(FData)^.set_enabled(PCefView(FData), ord(enabled_));
end;
function TCefViewRef.IsEnabled : boolean;
begin
Result := (PCefView(FData)^.is_enabled(PCefView(FData)) <> 0);
end;
procedure TCefViewRef.SetFocusable(focusable_: boolean);
begin
PCefView(FData)^.set_focusable(PCefView(FData), ord(focusable_));
end;
function TCefViewRef.IsFocusable : boolean;
begin
Result := (PCefView(FData)^.is_focusable(PCefView(FData)) <> 0);
end;
function TCefViewRef.IsAccessibilityFocusable : boolean;
begin
Result := (PCefView(FData)^.is_accessibility_focusable(PCefView(FData)) <> 0);
end;
procedure TCefViewRef.RequestFocus;
begin
PCefView(FData)^.request_focus(PCefView(FData));
end;
procedure TCefViewRef.SetBackgroundColor(color: TCefColor);
begin
PCefView(FData)^.set_background_color(PCefView(FData), color);
end;
function TCefViewRef.GetBackgroundColor : TCefColor;
begin
Result := PCefView(FData)^.get_background_color(PCefView(FData));
end;
function TCefViewRef.ConvertPointToScreen(var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_to_screen(PCefView(FData), @point) <> 0);
end;
function TCefViewRef.ConvertPointFromScreen(var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_from_screen(PCefView(FData), @point) <> 0);
end;
function TCefViewRef.ConvertPointToWindow(var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_to_window(PCefView(FData), @point) <> 0);
end;
function TCefViewRef.ConvertPointFromWindow(var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_from_window(PCefView(FData), @point) <> 0);
end;
function TCefViewRef.ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_to_view(PCefView(FData), CefGetData(view), @point) <> 0);
end;
function TCefViewRef.ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean;
begin
Result := (PCefView(FData)^.convert_point_from_view(PCefView(FData), CefGetData(view), @point) <> 0);
end;
class function TCefViewRef.UnWrap(data: Pointer): ICefView;
begin
if (data <> nil) then
Result := Create(data) as ICefView
else
Result := nil;
end;
end.

142
source/uCEFViewDelegate.pas Normal file
View File

@ -0,0 +1,142 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFViewDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefViewDelegateRef = class(TCefBaseRefCountedRef, ICefViewDelegate)
protected
function GetPreferredSize(const view: ICefView): TCefSize;
function GetMinimumSize(const view: ICefView): TCefSize;
function GetMaximumSize(const view: ICefView): TCefSize;
function GetHeightForWidth(const view: ICefView; width: Integer): Integer;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure OnFocus(const view: ICefView);
procedure OnBlur(const view: ICefView);
public
class function UnWrap(data: Pointer): ICefViewDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
function TCefViewDelegateRef.GetPreferredSize(const view: ICefView): TCefSize;
begin
Result := PCefViewDelegate(FData)^.get_preferred_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetMinimumSize(const view: ICefView): TCefSize;
begin
Result := PCefViewDelegate(FData)^.get_minimum_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetMaximumSize(const view: ICefView): TCefSize;
begin
Result := PCefViewDelegate(FData)^.get_maximum_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetHeightForWidth(const view: ICefView; width: Integer): Integer;
begin
Result := PCefViewDelegate(FData)^.get_height_for_width(PCefViewDelegate(FData),
CefGetData(view),
width);
end;
procedure TCefViewDelegateRef.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
begin
PCefViewDelegate(FData)^.on_parent_view_changed(PCefViewDelegate(FData),
CefGetData(view),
ord(added),
CefGetData(parent));
end;
procedure TCefViewDelegateRef.OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
begin
PCefViewDelegate(FData)^.on_child_view_changed(PCefViewDelegate(FData),
CefGetData(view),
ord(added),
CefGetData(child));
end;
procedure TCefViewDelegateRef.OnFocus(const view: ICefView);
begin
PCefViewDelegate(FData)^.on_focus(PCefViewDelegate(FData),
CefGetData(view));
end;
procedure TCefViewDelegateRef.OnBlur(const view: ICefView);
begin
PCefViewDelegate(FData)^.on_blur(PCefViewDelegate(FData),
CefGetData(view));
end;
class function TCefViewDelegateRef.UnWrap(data: Pointer): ICefViewDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefViewDelegate
else
Result := nil;
end;
end.

325
source/uCEFWindow.pas Normal file
View File

@ -0,0 +1,325 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFWindow;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFPanel;
type
TCefWindowRef = class(TCefPanelRef, ICefWindow)
protected
procedure Show;
procedure Hide;
procedure CenterWindow(const size_: TCefSize);
procedure Close;
function IsClosed : boolean;
procedure Activate;
procedure Deactivate;
function IsActive : boolean;
procedure BringToTop;
procedure SetAlwaysOnTop(on_top: boolean);
function IsAlwaysOnTop : boolean;
procedure Maximize;
procedure Minimize;
procedure Restore;
procedure SetFullscreen(fullscreen: boolean);
function IsMaximized : boolean;
function IsMinimized : boolean;
function IsFullscreen : boolean;
procedure SetTitle(const title_: ustring);
function GetTitle : ustring;
procedure SetWindowIcon(const image: ICefImage);
function GetWindowIcon : ICefImage;
procedure SetWindowAppIcon(const image: ICefImage);
function GetWindowAppIcon : ICefImage;
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition);
procedure CancelMenu;
function GetDisplay : ICefDisplay;
function GetClientAreaBoundsInScreen : TCefRect;
procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);
function GetWindowHandle : TCefWindowHandle;
procedure SendKeyPress(key_code: Integer; event_flags: uint32);
procedure SendMouseMove(screen_x, screen_y: Integer);
procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean);
procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed: boolean);
procedure RemoveAccelerator(command_id: Integer);
procedure RemoveAllAccelerators;
public
class function UnWrap(data: Pointer): ICefWindow;
class function CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFImage, uCEFDisplay;
procedure TCefWindowRef.Show;
begin
PCefWindow(FData)^.show(PCefWindow(FData));
end;
procedure TCefWindowRef.Hide;
begin
PCefWindow(FData)^.hide(PCefWindow(FData));
end;
procedure TCefWindowRef.CenterWindow(const size_: TCefSize);
begin
PCefWindow(FData)^.center_window(PCefWindow(FData), @size_);
end;
procedure TCefWindowRef.Close;
begin
PCefWindow(FData)^.close(PCefWindow(FData));
end;
function TCefWindowRef.IsClosed : boolean;
begin
Result := (PCefWindow(FData)^.is_closed(PCefWindow(FData)) <> 0);
end;
procedure TCefWindowRef.Activate;
begin
PCefWindow(FData)^.activate(PCefWindow(FData));
end;
procedure TCefWindowRef.Deactivate;
begin
PCefWindow(FData)^.deactivate(PCefWindow(FData));
end;
function TCefWindowRef.IsActive : boolean;
begin
Result := (PCefWindow(FData)^.is_active(PCefWindow(FData)) <> 0);
end;
procedure TCefWindowRef.BringToTop;
begin
PCefWindow(FData)^.bring_to_top(PCefWindow(FData));
end;
procedure TCefWindowRef.SetAlwaysOnTop(on_top: boolean);
begin
PCefWindow(FData)^.set_always_on_top(PCefWindow(FData), ord(on_top));
end;
function TCefWindowRef.IsAlwaysOnTop : boolean;
begin
Result := (PCefWindow(FData)^.is_always_on_top(PCefWindow(FData)) <> 0);
end;
procedure TCefWindowRef.Maximize;
begin
PCefWindow(FData)^.maximize(PCefWindow(FData));
end;
procedure TCefWindowRef.Minimize;
begin
PCefWindow(FData)^.minimize(PCefWindow(FData));
end;
procedure TCefWindowRef.Restore;
begin
PCefWindow(FData)^.restore(PCefWindow(FData));
end;
procedure TCefWindowRef.SetFullscreen(fullscreen: boolean);
begin
PCefWindow(FData)^.set_fullscreen(PCefWindow(FData), ord(fullscreen));
end;
function TCefWindowRef.IsMaximized : boolean;
begin
Result := (PCefWindow(FData)^.is_maximized(PCefWindow(FData)) <> 0);
end;
function TCefWindowRef.IsMinimized : boolean;
begin
Result := (PCefWindow(FData)^.is_minimized(PCefWindow(FData)) <> 0);
end;
function TCefWindowRef.IsFullscreen : boolean;
begin
Result := (PCefWindow(FData)^.is_fullscreen(PCefWindow(FData)) <> 0);
end;
procedure TCefWindowRef.SetTitle(const title_: ustring);
var
TempTitle : TCefString;
begin
TempTitle := CefString(title_);
PCefWindow(FData)^.set_title(PCefWindow(FData), @TempTitle);
end;
function TCefWindowRef.GetTitle : ustring;
begin
Result := CefStringFreeAndGet(PCefWindow(FData)^.get_title(PCefWindow(FData)));
end;
procedure TCefWindowRef.SetWindowIcon(const image: ICefImage);
begin
PCefWindow(FData)^.set_window_icon(PCefWindow(FData), CefGetData(image));
end;
function TCefWindowRef.GetWindowIcon : ICefImage;
begin
Result := TCefImageRef.UnWrap(PCefWindow(FData)^.get_window_icon(PCefWindow(FData)));
end;
procedure TCefWindowRef.SetWindowAppIcon(const image: ICefImage);
begin
PCefWindow(FData)^.set_window_app_icon(PCefWindow(FData), CefGetData(image));
end;
function TCefWindowRef.GetWindowAppIcon : ICefImage;
begin
Result := TCefImageRef.UnWrap(PCefWindow(FData)^.get_window_app_icon(PCefWindow(FData)));
end;
procedure TCefWindowRef.ShowMenu(const menu_model : ICefMenuModel;
const screen_point : TCefPoint;
anchor_position : TCefMenuAnchorPosition);
begin
PCefWindow(FData)^.show_menu(PCefWindow(FData),
CefGetData(menu_model),
@screen_point,
anchor_position);
end;
procedure TCefWindowRef.CancelMenu;
begin
PCefWindow(FData)^.cancel_menu(PCefWindow(FData));
end;
function TCefWindowRef.GetDisplay : ICefDisplay;
begin
Result := TCefDisplayRef.UnWrap(PCefWindow(FData)^.get_display(PCefWindow(FData)));
end;
function TCefWindowRef.GetClientAreaBoundsInScreen : TCefRect;
begin
Result := PCefWindow(FData)^.get_client_area_bounds_in_screen(PCefWindow(FData));
end;
procedure TCefWindowRef.SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);
begin
PCefWindow(FData)^.set_draggable_regions(PCefWindow(FData), regionsCount, regions);
end;
function TCefWindowRef.GetWindowHandle : TCefWindowHandle;
begin
Result := PCefWindow(FData)^.get_window_handle(PCefWindow(FData));
end;
procedure TCefWindowRef.SendKeyPress(key_code: Integer; event_flags: uint32);
begin
PCefWindow(FData)^.send_key_press(PCefWindow(FData), key_code, event_flags);
end;
procedure TCefWindowRef.SendMouseMove(screen_x, screen_y: Integer);
begin
PCefWindow(FData)^.send_mouse_move(PCefWindow(FData), screen_x, screen_y);
end;
procedure TCefWindowRef.SendMouseEvents(button : TCefMouseButtonType;
mouse_down : boolean;
mouse_up : boolean);
begin
PCefWindow(FData)^.send_mouse_events(PCefWindow(FData),
button,
ord(mouse_down),
ord(mouse_up));
end;
procedure TCefWindowRef.SetAccelerator(command_id : Integer;
key_code : Integer;
shift_pressed : boolean;
ctrl_pressed : boolean;
alt_pressed : boolean);
begin
PCefWindow(FData)^.set_accelerator(PCefWindow(FData),
command_id,
key_code,
ord(shift_pressed),
ord(ctrl_pressed),
ord(alt_pressed));
end;
procedure TCefWindowRef.RemoveAccelerator(command_id: Integer);
begin
PCefWindow(FData)^.remove_accelerator(PCefWindow(FData), command_id);
end;
procedure TCefWindowRef.RemoveAllAccelerators;
begin
PCefWindow(FData)^.remove_all_accelerators(PCefWindow(FData));
end;
class function TCefWindowRef.UnWrap(data: Pointer): ICefWindow;
begin
if (data <> nil) then
Result := Create(data) as ICefWindow
else
Result := nil;
end;
class function TCefWindowRef.CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow;
begin
UnWrap(cef_window_create_top_level(CefGetData(delegate)));
end;
end.

View File

@ -0,0 +1,150 @@
// ************************************************************************
// ***************************** 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 © 2020 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 uCEFWindowDelegate;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFPanelDelegate;
type
TCefWindowDelegateRef = class(TCefPanelDelegateRef, ICefWindowDelegate)
protected
procedure OnWindowCreated(const window: ICefWindow);
procedure OnWindowDestroyed(const window: ICefWindow);
function GetParentWindow(const window: ICefWindow; is_menu, can_activate_menu: boolean): ICefWindow;
function IsFrameless(const window: ICefWindow): boolean;
function CanResize(const window: ICefWindow): boolean;
function CanMaximize(const window: ICefWindow): boolean;
function CanMinimize(const window: ICefWindow): boolean;
function CanClose(const window: ICefWindow): boolean;
function OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
function OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
public
class function UnWrap(data: Pointer): ICefWindowDelegate;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFWindow;
procedure TCefWindowDelegateRef.OnWindowCreated(const window: ICefWindow);
begin
PCefWindowDelegate(FData)^.on_window_created(PCefWindowDelegate(FData), CefGetData(window));
end;
procedure TCefWindowDelegateRef.OnWindowDestroyed(const window: ICefWindow);
begin
PCefWindowDelegate(FData)^.on_window_destroyed(PCefWindowDelegate(FData), CefGetData(window));
end;
function TCefWindowDelegateRef.GetParentWindow(const window : ICefWindow;
is_menu : boolean;
can_activate_menu : boolean): ICefWindow;
var
TempIsMenu, TempCanActivateMenu : integer;
begin
TempIsMenu := ord(is_menu);
TempCanActivateMenu := ord(can_activate_menu);
Result := TCefWindowRef.UnWrap(PCefWindowDelegate(FData)^.get_parent_window(PCefWindowDelegate(FData),
CefGetData(window),
@TempIsMenu,
@TempCanActivateMenu));
end;
function TCefWindowDelegateRef.IsFrameless(const window: ICefWindow): boolean;
begin
Result := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanResize(const window: ICefWindow): boolean;
begin
Result := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanMaximize(const window: ICefWindow): boolean;
begin
Result := (PCefWindowDelegate(FData)^.can_maximize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanMinimize(const window: ICefWindow): boolean;
begin
Result := (PCefWindowDelegate(FData)^.can_minimize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanClose(const window: ICefWindow): boolean;
begin
Result := (PCefWindowDelegate(FData)^.can_close(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
begin
Result := (PCefWindowDelegate(FData)^.on_accelerator(PCefWindowDelegate(FData), CefGetData(window), command_id) <> 0);
end;
function TCefWindowDelegateRef.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
begin
Result := (PCefWindowDelegate(FData)^.on_key_event(PCefWindowDelegate(FData), CefGetData(window), @event) <> 0);
end;
class function TCefWindowDelegateRef.UnWrap(data: Pointer): ICefWindowDelegate;
begin
if (data <> nil) then
Result := Create(data) as ICefWindowDelegate
else
Result := nil;
end;
end.

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 127,
"InternalVersion" : 128,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "81.2.24.0"
"Version" : "81.2.25.0"
}
],
"UpdatePackageData" : {