You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-09-30 21:28:55 +02:00
Added transparency test code to SimpleOSRBrowser in QT
This commit is contained in:
@@ -10,7 +10,12 @@ uses
|
|||||||
{$IFDEF LCLQT}qt4,{$ENDIF}
|
{$IFDEF LCLQT}qt4,{$ENDIF}
|
||||||
{$IFDEF LCLQT5}qt5,{$ENDIF}
|
{$IFDEF LCLQT5}qt5,{$ENDIF}
|
||||||
{$IFDEF LCLQT6}qt6,{$ENDIF}
|
{$IFDEF LCLQT6}qt6,{$ENDIF}
|
||||||
uCEFBufferPanel, uCEFChromium, uCEFInterfaces, uCEFTypes;
|
uCEFBufferPanel, uCEFChromium, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
const
|
||||||
|
// Set this constant to True and load "file:///<path-to-CEF4Delphi>/bin/transparency.html" to test a
|
||||||
|
// transparent browser.
|
||||||
|
TRANSPARENT_BROWSER = True;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -219,6 +224,13 @@ begin
|
|||||||
GlobalCEFApp.DisableZygote := True;
|
GlobalCEFApp.DisableZygote := True;
|
||||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||||
GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized;
|
GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized;
|
||||||
|
|
||||||
|
// If you need transparency leave the GlobalCEFApp.BackgroundColor property
|
||||||
|
// with the default value or set the alpha channel to 0
|
||||||
|
if TRANSPARENT_BROWSER then
|
||||||
|
GlobalCEFApp.BackgroundColor := CefColorSetARGB($00, $00, $00, $00)
|
||||||
|
else
|
||||||
|
GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StartMainProcess: boolean;
|
function StartMainProcess: boolean;
|
||||||
@@ -612,11 +624,16 @@ begin
|
|||||||
// monitor where the main application form is located.
|
// monitor where the main application form is located.
|
||||||
GlobalCEFApp.UpdateDeviceScaleFactor;
|
GlobalCEFApp.UpdateDeviceScaleFactor;
|
||||||
|
|
||||||
UpdatePanelOffset;
|
UpdatePanelOffset;
|
||||||
|
|
||||||
// opaque white background color
|
// If you need transparency leave the Chromium1.Options.BackgroundColor property
|
||||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
// with the default value or set the alpha channel to 0
|
||||||
Chromium1.DefaultURL := UTF8Decode(AddressCb.Text);
|
if TRANSPARENT_BROWSER then
|
||||||
|
Chromium1.Options.BackgroundColor := CefColorSetARGB($00, $00, $00, $00)
|
||||||
|
else
|
||||||
|
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||||
|
|
||||||
|
Chromium1.DefaultURL := UTF8Decode(AddressCb.Text);
|
||||||
|
|
||||||
Chromium1.CreateBrowser;
|
Chromium1.CreateBrowser;
|
||||||
end;
|
end;
|
||||||
|
@@ -11,6 +11,11 @@ uses
|
|||||||
{$IFDEF LCLQT5}qt5,{$ENDIF}
|
{$IFDEF LCLQT5}qt5,{$ENDIF}
|
||||||
{$IFDEF LCLQT6}qt6,{$ENDIF}
|
{$IFDEF LCLQT6}qt6,{$ENDIF}
|
||||||
uCEFBufferPanel, uCEFChromium, uCEFInterfaces, uCEFTypes;
|
uCEFBufferPanel, uCEFChromium, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
const
|
||||||
|
// Set this constant to True and load "file:///<path-to-CEF4Delphi>/bin/transparency.html" to test a
|
||||||
|
// transparent browser.
|
||||||
|
TRANSPARENT_BROWSER = True;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@@ -218,7 +223,14 @@ begin
|
|||||||
GlobalCEFApp.RootCache := 'RootCache';
|
GlobalCEFApp.RootCache := 'RootCache';
|
||||||
GlobalCEFApp.SetCurrentDir := True;
|
GlobalCEFApp.SetCurrentDir := True;
|
||||||
GlobalCEFApp.DisableZygote := True;
|
GlobalCEFApp.DisableZygote := True;
|
||||||
GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized;
|
GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized;
|
||||||
|
|
||||||
|
// If you need transparency leave the GlobalCEFApp.BackgroundColor property
|
||||||
|
// with the default value or set the alpha channel to 0
|
||||||
|
if TRANSPARENT_BROWSER then
|
||||||
|
GlobalCEFApp.BackgroundColor := CefColorSetARGB($00, $00, $00, $00)
|
||||||
|
else
|
||||||
|
GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StartMainProcess: boolean;
|
function StartMainProcess: boolean;
|
||||||
@@ -612,11 +624,16 @@ begin
|
|||||||
// monitor where the main application form is located.
|
// monitor where the main application form is located.
|
||||||
GlobalCEFApp.UpdateDeviceScaleFactor;
|
GlobalCEFApp.UpdateDeviceScaleFactor;
|
||||||
|
|
||||||
UpdatePanelOffset;
|
UpdatePanelOffset;
|
||||||
|
|
||||||
// opaque white background color
|
// If you need transparency leave the Chromium1.Options.BackgroundColor property
|
||||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
// with the default value or set the alpha channel to 0
|
||||||
Chromium1.DefaultURL := UTF8Decode(AddressCb.Text);
|
if TRANSPARENT_BROWSER then
|
||||||
|
Chromium1.Options.BackgroundColor := CefColorSetARGB($00, $00, $00, $00)
|
||||||
|
else
|
||||||
|
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||||
|
|
||||||
|
Chromium1.DefaultURL := UTF8Decode(AddressCb.Text);
|
||||||
|
|
||||||
Chromium1.CreateBrowser;
|
Chromium1.CreateBrowser;
|
||||||
end;
|
end;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 791,
|
"InternalVersion" : 792,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "140.1.14"
|
"Version" : "140.1.14"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user