1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 3.3497.1829.g004ef91

- Added the TCEFLinkedWindowParent component.
This commit is contained in:
Salvador Díaz Fau
2018-09-16 10:39:41 +02:00
parent 8ebb5fb527
commit 0cf7c5f6b3
26 changed files with 477 additions and 271 deletions

View File

@@ -52,7 +52,7 @@ interface
uses
{$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages,{$ENDIF} System.Classes, Vcl.Controls, Vcl.Graphics,
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages,{$ENDIF} System.Classes, Vcl.Controls, Vcl.Graphics,
{$ELSE}
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics,
{$IFDEF FPC}
@@ -61,39 +61,12 @@ uses
Messages,
{$ENDIF}
{$ENDIF}
uCEFTypes, uCEFInterfaces;
uCEFWinControl, uCEFTypes, uCEFInterfaces;
type
TCEFWindowParent = class(TWinControl)
TCEFWindowParent = class(TCEFWinControl)
protected
function GetChildWindowHandle : THandle; virtual;
procedure WndProc(var aMessage: TMessage); override;
public
procedure UpdateSize;
function TakeSnapshot(var aBitmap : TBitmap) : boolean;
function DestroyChildWindow : boolean;
procedure CreateHandle; override;
procedure Resize; override;
property ChildWindowHandle : THandle read GetChildWindowHandle;
published
property Align;
property Anchors;
property Color;
property Constraints;
property TabStop;
property TabOrder;
property Visible;
property Enabled;
property ShowHint;
property Hint;
property DoubleBuffered;
{$IFDEF DELPHI12_UP}
property ParentDoubleBuffered;
{$ENDIF}
end;
{$IFDEF FPC}
@@ -105,47 +78,6 @@ implementation
uses
uCEFMiscFunctions, uCEFClient, uCEFConstants;
function TCEFWindowParent.GetChildWindowHandle : THandle;
begin
if not(csDesigning in ComponentState) and HandleAllocated then
Result := GetWindow(Handle, GW_CHILD)
else
Result := 0;
end;
procedure TCEFWindowParent.Resize;
begin
inherited Resize;
UpdateSize;
end;
procedure TCEFWindowParent.CreateHandle;
begin
inherited;
end;
procedure TCEFWindowParent.UpdateSize;
var
TempRect : TRect;
hdwp: THandle;
TempHandle : THandle;
begin
TempHandle := ChildWindowHandle;
if (TempHandle = 0) then Exit;
TempRect := GetClientRect;
hdwp := BeginDeferWindowPos(1);
try
hdwp := DeferWindowPos(hdwp, TempHandle, HWND_TOP,
TempRect.left, TempRect.top, TempRect.right - TempRect.left, TempRect.bottom - TempRect.top,
SWP_NOZORDER);
finally
EndDeferWindowPos(hdwp);
end;
end;
procedure TCEFWindowParent.WndProc(var aMessage: TMessage);
var
TempHandle : THandle;
@@ -159,10 +91,7 @@ begin
end;
WM_ERASEBKGND:
begin
TempHandle := ChildWindowHandle;
if (TempHandle = 0) then inherited WndProc(aMessage);
end;
if (ChildWindowHandle = 0) then inherited WndProc(aMessage);
CM_WANTSPECIALKEY:
if not(TWMKey(aMessage).CharCode in [VK_LEFT .. VK_DOWN, VK_RETURN, VK_ESCAPE]) then
@@ -176,43 +105,6 @@ begin
end;
end;
function TCEFWindowParent.TakeSnapshot(var aBitmap : TBitmap) : boolean;
var
TempHWND : HWND;
TempDC : HDC;
TempRect : TRect;
TempWidth : Integer;
TempHeight : Integer;
begin
Result := False;
TempHWND := ChildWindowHandle;
if (TempHWND <> 0) then
begin
{$IFDEF DELPHI16_UP}Winapi.{$ENDIF}Windows.GetClientRect(TempHWND, TempRect);
TempDC := GetDC(TempHWND);
TempWidth := TempRect.Right - TempRect.Left;
TempHeight := TempRect.Bottom - TempRect.Top;
aBitmap := TBitmap.Create;
aBitmap.Height := TempHeight;
aBitmap.Width := TempWidth;
Result := BitBlt(aBitmap.Canvas.Handle, 0, 0, TempWidth, TempHeight,
TempDC, 0, 0, SRCCOPY);
ReleaseDC(TempHWND, TempDC);
end;
end;
function TCEFWindowParent.DestroyChildWindow : boolean;
var
TempHWND : HWND;
begin
TempHWND := ChildWindowHandle;
Result := (TempHWND <> 0) and DestroyWindow(TempHWND);
end;
{$IFDEF FPC}
procedure Register;
begin