Skip to content

Commit

Permalink
Added the EditorBrowser demo
Browse files Browse the repository at this point in the history
Fixed build issue in Lazarus.
Fixed string conversion in showmessage calls
Added TWVBrowser.RetrieveHTML
Added TWVBrowser.RetrieveText
Added TWVBrowser.OnPrintCompleted
Added TWVBrowser.OnRetrieveHTMLCompleted
Added TWVBrowser.OnRetrieveTextCompleted
  • Loading branch information
salvadordf committed Dec 23, 2021
1 parent 06906d0 commit 0c8f10d
Show file tree
Hide file tree
Showing 42 changed files with 5,093 additions and 69 deletions.
11 changes: 11 additions & 0 deletions assets/EditorBrowser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
in culpa qui officia deserunt mollit anim id est laborum.</p>
</body>
</html>
4 changes: 1 addition & 3 deletions demos/Delphi_VCL/AddHostObject/uMainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ TMainForm = class(TForm)
procedure WVBrowser1AfterCreated(Sender: TObject);
procedure WVBrowser1DocumentTitleChanged(Sender: TObject);
procedure WVBrowser1InitializationError(Sender: TObject; aErrorCode: HRESULT; const aErrorMessage: wvstring);
procedure WVBrowser1NavigationCompleted(Sender: TObject;
const aWebView: ICoreWebView2;
const aArgs: ICoreWebView2NavigationCompletedEventArgs);
procedure WVBrowser1NavigationCompleted(Sender: TObject; const aWebView: ICoreWebView2; const aArgs: ICoreWebView2NavigationCompletedEventArgs);

protected
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
Expand Down
18 changes: 18 additions & 0 deletions demos/Delphi_VCL/EditorBrowser/00-DeleteDCUs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
del /s /q *.dcu
del /s /q *.exe
del /s /q *.res
del /s /q *.rsm
del /s /q *.log
del /s /q *.dsk
del /s /q *.identcache
del /s /q *.stat
del /s /q *.local
del /s /q *.~*
rmdir Win32\Debug
rmdir Win32\Release
rmdir Win32
rmdir Win64\Debug
rmdir Win64\Release
rmdir Win64
rmdir __history
rmdir __recovery
14 changes: 14 additions & 0 deletions demos/Delphi_VCL/EditorBrowser/EditorBrowser.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
program EditorBrowser;

uses
Vcl.Forms,
uMainForm in 'uMainForm.pas' {MainForm};

{$R *.res}

begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
987 changes: 987 additions & 0 deletions demos/Delphi_VCL/EditorBrowser/EditorBrowser.dproj

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions demos/Delphi_VCL/EditorBrowser/uImageSelection.dfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
object ImageSelectionFrm: TImageSelectionFrm
Left = 0
Top = 0
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'Image Selection'
ClientHeight = 223
ClientWidth = 481
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
DesignSize = (
481
223)
PixelsPerInch = 96
TextHeight = 13
object URLLbl: TLabel
Left = 56
Top = 51
Width = 19
Height = 13
Caption = 'URL'
end
object FileLbl: TLabel
Left = 56
Top = 123
Width = 16
Height = 13
Caption = 'File'
end
object FileBtn: TSpeedButton
Left = 432
Top = 120
Width = 23
Height = 22
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000000000000000000000000000000000000FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF003737
3700000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000003A3A3A00FF00FF00FF00FF000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F7F007F7F
7F007F7F7F007F7F7F007F7F7F000000000000000000FF00FF00FF00FF000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000FF00FF00FF00FF000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000037373700FF00FF00FF00FF000000
00000000000000000000000000000000000000000000000000007F7F7F00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF003636
360000000000000000000000000000000000000000007F7F7F00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00}
OnClick = FileBtnClick
end
object OkBtn: TButton
Left = 268
Top = 180
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Ok'
ModalResult = 1
TabOrder = 4
end
object CancelBtn: TButton
Left = 380
Top = 180
Width = 75
Height = 25
Anchors = [akRight, akBottom]
Caption = 'Cancel'
ModalResult = 2
TabOrder = 5
end
object RemoteRb: TRadioButton
Left = 24
Top = 25
Width = 113
Height = 17
Caption = 'Remote image'
Checked = True
TabOrder = 0
TabStop = True
end
object LocalRb: TRadioButton
Left = 24
Top = 98
Width = 113
Height = 17
Caption = 'Local image'
TabOrder = 1
end
object URLEdt: TEdit
Left = 104
Top = 48
Width = 351
Height = 21
TabOrder = 3
Text = 'https://www.briskbard.com/images/logo5.png'
end
object FileEdt: TEdit
Left = 104
Top = 120
Width = 321
Height = 21
TabOrder = 2
end
object OpenDialog1: TOpenDialog
Left = 112
Top = 176
end
end
79 changes: 79 additions & 0 deletions demos/Delphi_VCL/EditorBrowser/uImageSelection.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <[email protected]>
* 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 uImageSelection;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;

type
TImageSelectionFrm = class(TForm)
OkBtn: TButton;
CancelBtn: TButton;
RemoteRb: TRadioButton;
LocalRb: TRadioButton;
URLLbl: TLabel;
URLEdt: TEdit;
FileLbl: TLabel;
FileEdt: TEdit;
FileBtn: TSpeedButton;
OpenDialog1: TOpenDialog;
procedure FileBtnClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
ImageSelectionFrm: TImageSelectionFrm;

implementation

{$R *.dfm}

procedure TImageSelectionFrm.FileBtnClick(Sender: TObject);
begin
OpenDialog1.Filter := 'PNG Files (*.png)|*.PNG';

if OpenDialog1.Execute then FileEdt.Text := OpenDialog1.FileName;
end;

end.
Loading

0 comments on commit 0c8f10d

Please sign in to comment.