Update to CEF 117.1.5

This commit is contained in:
salvadordf 2023-09-29 19:23:38 +02:00
parent fd75f6f65e
commit f423f19168
36 changed files with 2208 additions and 40 deletions

View File

@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the LICENSE.md file. CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the LICENSE.md file.
CEF4Delphi uses CEF 117.1.4 which includes Chromium 117.0.5938.92. CEF4Delphi uses CEF 117.1.5 which includes Chromium 117.0.5938.132.
The CEF binaries used by CEF4Delphi are available for download at Spotify : The CEF binaries used by CEF4Delphi are available for download at Spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_windows32.tar.bz2) * [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_windows64.tar.bz2) * [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_windows64.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linux64.tar.bz2) * [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linuxarm.tar.bz2) * [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linuxarm64.tar.bz2) * [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_macosx64.tar.bz2) * [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.5%2Bgf1b94ea%2Bchromium-117.0.5938.132_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

Binary file not shown.

View File

@ -66,14 +66,224 @@ Count=1
Item_0=..\source Item_0=..\source
[Files] [Files]
Count=7 Count=217
Item_0=..\source\uCEFApplicationCore.pas Item_0=..\source\uCEFAccessibilityHandler.pas
Item_1=..\source\uCEFChromium.pas Item_1=..\source\uCEFApp.pas
Item_2=..\source\uCEFChromiumCore.pas Item_2=..\source\uCEFApplication.pas
Item_3=..\source\uCEFConstants.pas Item_3=..\source\uCEFApplicationCore.pas
Item_4=..\source\uCEFFMXChromium.pas Item_4=..\source\uCEFApplicationEvents.pas
Item_5=..\source\uCEFInterfaces.pas Item_5=..\source\uCEFArgCopy.pas
Item_6=..\source\uCEFTypes.pas Item_6=..\source\uCEFAudioHandler.pas
Item_7=..\source\uCEFAuthCallback.pas
Item_8=..\source\uCEFBaseRefCounted.pas
Item_9=..\source\uCEFBaseScopedWrapper.pas
Item_10=..\source\uCEFBeforeDownloadCallback.pas
Item_11=..\source\uCEFBinaryValue.pas
Item_12=..\source\uCEFBitmapBitBuffer.pas
Item_13=..\source\uCEFBoxLayout.pas
Item_14=..\source\uCEFBrowser.pas
Item_15=..\source\uCEFBrowserBitmap.pas
Item_16=..\source\uCEFBrowserProcessHandler.pas
Item_17=..\source\uCEFBrowserView.pas
Item_18=..\source\uCEFBrowserViewComponent.pas
Item_19=..\source\uCEFBrowserViewDelegate.pas
Item_20=..\source\uCEFBrowserWindow.pas
Item_21=..\source\uCEFBufferPanel.pas
Item_22=..\source\uCEFButton.pas
Item_23=..\source\uCEFButtonComponent.pas
Item_24=..\source\uCEFButtonDelegate.pas
Item_25=..\source\uCEFCallback.pas
Item_26=..\source\uCEFChromium.pas
Item_27=..\source\uCEFChromiumCore.pas
Item_28=..\source\uCEFChromiumEvents.pas
Item_29=..\source\uCEFChromiumFontOptions.pas
Item_30=..\source\uCEFChromiumOptions.pas
Item_31=..\source\uCEFChromiumWindow.pas
Item_32=..\source\uCEFClient.pas
Item_33=..\source\uCEFCommandHandler.pas
Item_34=..\source\uCEFCommandLine.pas
Item_35=..\source\uCEFCompletionCallback.pas
Item_36=..\source\uCEFConstants.pas
Item_37=..\source\uCEFContextMenuHandler.pas
Item_38=..\source\uCEFContextMenuParams.pas
Item_39=..\source\uCEFCookieAccessFilter.pas
Item_40=..\source\uCEFCookieManager.pas
Item_41=..\source\uCEFCookieVisitor.pas
Item_42=..\source\uCEFCustomStreamReader.pas
Item_43=..\source\uCEFDeleteCookiesCallback.pas
Item_44=..\source\uCEFDevToolsMessageObserver.pas
Item_45=..\source\uCEFDialogHandler.pas
Item_46=..\source\uCEFDictionaryValue.pas
Item_47=..\source\uCEFDisplay.pas
Item_48=..\source\uCEFDisplayHandler.pas
Item_49=..\source\uCEFDomDocument.pas
Item_50=..\source\uCEFDomNode.pas
Item_51=..\source\uCEFDomVisitor.pas
Item_52=..\source\uCEFDownloadHandler.pas
Item_53=..\source\uCEFDownloadImageCallBack.pas
Item_54=..\source\uCEFDownLoadItem.pas
Item_55=..\source\uCEFDownloadItemCallback.pas
Item_56=..\source\uCEFDragAndDropMgr.pas
Item_57=..\source\uCEFDragData.pas
Item_58=..\source\uCEFDragHandler.pas
Item_59=..\source\uCEFEndTracingCallback.pas
Item_60=..\source\uCEFExtension.pas
Item_61=..\source\uCEFExtensionHandler.pas
Item_62=..\source\uCEFFileDialogCallback.pas
Item_63=..\source\uCEFFileDialogInfo.pas
Item_64=..\source\uCEFFillLayout.pas
Item_65=..\source\uCEFFindHandler.pas
Item_66=..\source\uCEFFMXBufferPanel.pas
Item_67=..\source\uCEFFMXChromium.pas
Item_68=..\source\uCEFFMXWindowParent.pas
Item_69=..\source\uCEFFMXWorkScheduler.pas
Item_70=..\source\uCEFFocusHandler.pas
Item_71=..\source\uCEFFrame.pas
Item_72=..\source\uCEFFrameHandler.pas
Item_73=..\source\uCEFGetExtensionResourceCallback.pas
Item_74=..\source\uCEFImage.pas
Item_75=..\source\uCEFInterfaces.pas
Item_76=..\source\uCEFJsDialogCallback.pas
Item_77=..\source\uCEFJsDialogHandler.pas
Item_78=..\source\uCEFJson.pas
Item_79=..\source\uCEFKeyboardHandler.pas
Item_80=..\source\uCEFLabelButton.pas
Item_81=..\source\uCEFLabelButtonComponent.pas
Item_82=..\source\uCEFLayout.pas
Item_83=..\source\uceflazaruscocoa.pas
Item_84=..\source\uCEFLibFunctions.pas
Item_85=..\source\uCEFLifeSpanHandler.pas
Item_86=..\source\uCEFLinkedWinControlBase.pas
Item_87=..\source\uCEFLinkedWindowParent.pas
Item_88=..\source\uCEFLinuxConstants.pas
Item_89=..\source\uCEFLinuxEventPipe.pas
Item_90=..\source\uCEFLinuxFunctions.pas
Item_91=..\source\uCEFLinuxTypes.pas
Item_92=..\source\uCEFListValue.pas
Item_93=..\source\uCEFLoadHandler.pas
Item_94=..\source\uCEFMacOSConstants.pas
Item_95=..\source\uCEFMacOSCustomCocoaTimer.pas
Item_96=..\source\uCEFMacOSFunctions.pas
Item_97=..\source\uCEFMacOSInterfaces.pas
Item_98=..\source\uCEFMediaAccessCallback.pas
Item_99=..\source\uCEFMediaAccessHandler.pas
Item_100=..\source\uCEFMediaObserver.pas
Item_101=..\source\uCEFMediaRoute.pas
Item_102=..\source\uCEFMediaRouteCreateCallback.pas
Item_103=..\source\uCEFMediaRouter.pas
Item_104=..\source\uCEFMediaSink.pas
Item_105=..\source\uCEFMediaSinkDeviceInfoCallback.pas
Item_106=..\source\uCEFMediaSource.pas
Item_107=..\source\uCEFMenuButton.pas
Item_108=..\source\uCEFMenuButtonComponent.pas
Item_109=..\source\uCEFMenuButtonDelegate.pas
Item_110=..\source\uCEFMenuButtonPressedLock.pas
Item_111=..\source\uCEFMenuModel.pas
Item_112=..\source\uCEFMenuModelDelegate.pas
Item_113=..\source\uCEFMiscFunctions.pas
Item_114=..\source\uCEFNavigationEntry.pas
Item_115=..\source\uCEFNavigationEntryVisitor.pas
Item_116=..\source\uCEFOAuth2Helper.pas
Item_117=..\source\uCEFOLEDragAndDrop.pas
Item_118=..\source\uCEFOsrBrowserWindow.pas
Item_119=..\source\uCEFOSRIMEHandler.pas
Item_120=..\source\uCEFOverlayController.pas
Item_121=..\source\uCEFPanel.pas
Item_122=..\source\uCEFPanelComponent.pas
Item_123=..\source\uCEFPanelDelegate.pas
Item_124=..\source\uCEFPDFPrintCallback.pas
Item_125=..\source\uCEFPDFPrintOptions.pas
Item_126=..\source\uCEFPermissionHandler.pas
Item_127=..\source\uCEFPermissionPromptCallback.pas
Item_128=..\source\uCEFPostData.pas
Item_129=..\source\uCEFPostDataElement.pas
Item_130=..\source\uCEFPreferenceManager.pas
Item_131=..\source\uCEFPreferenceRegistrar.pas
Item_132=..\source\uCEFPrintDialogCallback.pas
Item_133=..\source\uCEFPrintHandler.pas
Item_134=..\source\uCEFPrintJobCallback.pas
Item_135=..\source\uCEFPrintSettings.pas
Item_136=..\source\uCEFProcessMessage.pas
Item_137=..\source\uCEFRegistration.pas
Item_138=..\source\uCEFRenderHandler.pas
Item_139=..\source\uCEFRenderProcessHandler.pas
Item_140=..\source\uCEFRequest.pas
Item_141=..\source\uCEFRequestContext.pas
Item_142=..\source\uCEFRequestContextHandler.pas
Item_143=..\source\uCEFRequestHandler.pas
Item_144=..\source\uCEFResolveCallback.pas
Item_145=..\source\uCEFResourceBundle.pas
Item_146=..\source\uCEFResourceBundleHandler.pas
Item_147=..\source\uCEFResourceHandler.pas
Item_148=..\source\uCEFResourceReadCallback.pas
Item_149=..\source\uCEFResourceRequestHandler.pas
Item_150=..\source\uCEFResourceSkipCallback.pas
Item_151=..\source\uCEFResponse.pas
Item_152=..\source\uCEFResponseFilter.pas
Item_153=..\source\uCEFRunContextMenuCallback.pas
Item_154=..\source\uCEFRunFileDialogCallback.pas
Item_155=..\source\uCEFRunQuickMenuCallback.pas
Item_156=..\source\uCEFSchemeHandlerFactory.pas
Item_157=..\source\uCEFSchemeRegistrar.pas
Item_158=..\source\uCEFScrollView.pas
Item_159=..\source\uCEFScrollViewComponent.pas
Item_160=..\source\uCEFSelectClientCertificateCallback.pas
Item_161=..\source\uCEFSentinel.pas
Item_162=..\source\uCEFServer.pas
Item_163=..\source\uCEFServerComponent.pas
Item_164=..\source\uCEFServerEvents.pas
Item_165=..\source\uCEFServerHandler.pas
Item_166=..\source\uCEFSetCookieCallback.pas
Item_167=..\source\uCEFSharedMemoryRegion.pas
Item_168=..\source\uCEFSharedProcessMessageBuilder.pas
Item_169=..\source\uCEFSslInfo.pas
Item_170=..\source\uCEFSSLStatus.pas
Item_171=..\source\uCEFStreamReader.pas
Item_172=..\source\uCEFStreamWriter.pas
Item_173=..\source\uCEFStringList.pas
Item_174=..\source\uCEFStringMap.pas
Item_175=..\source\uCEFStringMultimap.pas
Item_176=..\source\uCEFStringVisitor.pas
Item_177=..\source\uCEFTask.pas
Item_178=..\source\uCEFTaskRunner.pas
Item_179=..\source\uCEFTextfield.pas
Item_180=..\source\uCEFTextfieldComponent.pas
Item_181=..\source\uCEFTextfieldDelegate.pas
Item_182=..\source\uCEFThread.pas
Item_183=..\source\uCEFTimerWorkScheduler.pas
Item_184=..\source\uCEFTypes.pas
Item_185=..\source\uCEFUrlRequest.pas
Item_186=..\source\uCEFUrlrequestClient.pas
Item_187=..\source\uCEFUrlRequestClientComponent.pas
Item_188=..\source\uCEFUrlRequestClientEvents.pas
Item_189=..\source\uCEFv8Accessor.pas
Item_190=..\source\uCEFv8ArrayBufferReleaseCallback.pas
Item_191=..\source\uCEFv8Context.pas
Item_192=..\source\uCEFv8Exception.pas
Item_193=..\source\uCEFv8Handler.pas
Item_194=..\source\uCEFv8Interceptor.pas
Item_195=..\source\uCEFv8StackFrame.pas
Item_196=..\source\uCEFv8StackTrace.pas
Item_197=..\source\uCEFv8Value.pas
Item_198=..\source\uCEFValue.pas
Item_199=..\source\uCEFView.pas
Item_200=..\source\uCEFViewComponent.pas
Item_201=..\source\uCEFViewDelegate.pas
Item_202=..\source\uCEFViewsFrameworkEvents.pas
Item_203=..\source\uCEFWaitableEvent.pas
Item_204=..\source\uCEFWinControl.pas
Item_205=..\source\uCEFWindow.pas
Item_206=..\source\uCEFWindowComponent.pas
Item_207=..\source\uCEFWindowDelegate.pas
Item_208=..\source\uCEFWindowParent.pas
Item_209=..\source\uCEFWorkScheduler.pas
Item_210=..\source\uCEFWorkSchedulerQueueThread.pas
Item_211=..\source\uCEFWorkSchedulerThread.pas
Item_212=..\source\uCEFWriteHandler.pas
Item_213=..\source\uCEFX509Certificate.pas
Item_214=..\source\uCEFX509CertPrincipal.pas
Item_215=..\source\uCEFXmlReader.pas
Item_216=..\source\uCEFZipReader.pas
[AdditionalFiles] [AdditionalFiles]
Count=0 Count=0

View File

@ -21,7 +21,7 @@
</CompilerOptions> </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."/> <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"/> <License Value="MPL 1.1"/>
<Version Major="117" Minor="1" Release="4"/> <Version Major="117" Minor="1" Release="5"/>
<Files Count="214"> <Files Count="214">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -20,12 +20,38 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout;
type type
/// <summary>
/// A Layout manager that arranges child views vertically or horizontally in a
/// side-by-side fashion with spacing around and between the child views. The
/// child views are always sized according to their preferred size. If the
/// host's bounds provide insufficient space, child views will be clamped.
/// Excess space will not be distributed. Methods must be called on the browser
/// process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see cref="uCEFTypes|TCefBoxLayout">Implements TCefBoxLayout</see></para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_box_layout_capi.h">CEF source file: /include/capi/views/cef_box_layout_capi.h (cef_box_layout_t)</see></para>
/// </remarks>
TCefBoxLayoutRef = class(TCefLayoutRef, ICefBoxLayout) TCefBoxLayoutRef = class(TCefLayoutRef, ICefBoxLayout)
protected protected
/// <summary>
/// Set the flex weight for the given |view|. Using the preferred size as the
/// basis, free space along the main axis is distributed to views in the ratio
/// of their flex weights. Similarly, if the views will overflow the parent,
/// space is subtracted in these ratios. A flex of 0 means this view is not
/// resized. Flex values must not be negative.
/// </summary>
procedure SetFlexForView(const view: ICefView; flex: Integer); procedure SetFlexForView(const view: ICefView; flex: Integer);
/// <summary>
/// Clears the flex for the given |view|, causing it to use the default flex
/// specified via TCefBoxLayoutSettings.default_flex.
/// </summary>
procedure ClearFlexForView(const view: ICefView); procedure ClearFlexForView(const view: ICefView);
public public
/// <summary>
/// Returns a ICefBoxLayout instance using a PCefBoxLayout data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefBoxLayout; class function UnWrap(data: Pointer): ICefBoxLayout;
end; end;

View File

@ -20,15 +20,56 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type type
/// <summary>
/// A View hosting a ICefBrowser instance. Methods must be called on the
/// browser process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_browser_view_capi.h">CEF source file: /include/capi/views/cef_browser_view_capi.h (cef_browser_view_t)</see></para>
/// </remarks>
TCefBrowserViewRef = class(TCefViewRef, ICefBrowserView) TCefBrowserViewRef = class(TCefViewRef, ICefBrowserView)
protected protected
/// <summary>
/// Returns the ICefBrowser hosted by this BrowserView. Will return NULL if
/// the browser has not yet been created or has already been destroyed.
/// </summary>
function GetBrowser : ICefBrowser; function GetBrowser : ICefBrowser;
/// <summary>
/// Returns the Chrome toolbar associated with this BrowserView. Only
/// supported when using the Chrome runtime. The ICefBrowserViewDelegate.GetChromeToolbarType
/// function must return a value other than
/// CEF_CTT_NONE and the toolbar will not be available until after this
/// BrowserView is added to a ICefWindow and
/// ICefViewDelegate.OnWindowChanged() has been called.
/// </summary>
function GetChromeToolbar : ICefView; function GetChromeToolbar : ICefView;
/// <summary>
/// Sets whether accelerators registered with ICefWindow.SetAccelerator are
/// triggered before or after the event is sent to the ICefBrowser. If
/// |prefer_accelerators| is true (1) then the matching accelerator will be
/// triggered immediately and the event will not be sent to the ICefBrowser.
/// If |prefer_accelerators| is false (0) then the matching accelerator will
/// only be triggered if the event is not handled by web content or by
/// ICefKeyboardHandler. The default value is false (0).
/// </summary>
procedure SetPreferAccelerators(prefer_accelerators: boolean); procedure SetPreferAccelerators(prefer_accelerators: boolean);
public public
/// <summary>
/// Returns a ICefBrowserView instance using a PCefBrowserView data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefBrowserView; class function UnWrap(data: Pointer): ICefBrowserView;
/// <summary>
/// Create a new BrowserView. The underlying cef_browser_t will not be created
/// until this view is added to the views hierarchy. The optional |extra_info|
/// parameter provides an opportunity to specify extra information specific to
/// the created browser that will be passed to
/// cef_render_process_handler_t::on_browser_created() in the render process.
/// </summary>
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 CreateBrowserView(const client: ICefClient; const url: ustring; const settings: TCefBrowserSettings; const extra_info: ICefDictionaryValue; const request_context: ICefRequestContext; const delegate: ICefBrowserViewDelegate): ICefBrowserView;
/// <summary>
/// Returns the BrowserView associated with |browser|.
/// </summary>
class function GetForBrowser(const browser: ICefBrowser): ICefBrowserView; class function GetForBrowser(const browser: ICefBrowser): ICefBrowserView;
end; end;

View File

@ -31,25 +31,86 @@ type
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
public public
/// <summary>
/// Returns a ICefBrowserViewDelegate instance using a PCefBrowserViewDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefBrowserViewDelegate; class function UnWrap(data: Pointer): ICefBrowserViewDelegate;
end; end;
/// <summary>
/// Implement this interface to handle BrowserView events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_browser_view_delegate_capi.h">CEF source file: /include/capi/views/cef_browser_view_delegate_capi.h (cef_browser_view_delegate_t)</see></para>
/// </remarks>
TCefBrowserViewDelegateOwn = class(TCefViewDelegateOwn, ICefBrowserViewDelegate) TCefBrowserViewDelegateOwn = class(TCefViewDelegateOwn, ICefBrowserViewDelegate)
protected protected
/// <summary>
/// Called when |browser| associated with |browser_view| is created. This
/// function will be called after ICefLifeSpanHandler.OnAfterCreated()
/// is called for |browser| and before OnPopupBrowserViewCreated() is
/// called for |browser|'s parent delegate if |browser| is a popup.
/// </summary>
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual; procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
/// <summary>
/// Called when |browser| associated with |browser_view| is destroyed. Release
/// all references to |browser| and do not attempt to execute any functions on
/// |browser| after this callback returns. This function will be called before
/// ICefLifeSpanHandler.OnBeforeClose() is called for |browser|.
/// </summary>
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual; procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
/// <summary>
/// Called before a new popup BrowserView is created. The popup originated
/// from |browser_view|. |settings| and |client| are the values returned from
/// ICefLifeSpanHandler.OnBeforePopup(). |is_devtools| will be true (1)
/// if the popup will be a DevTools browser. Return the delegate that will be
/// used for the new popup BrowserView.
/// </summary>
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); virtual; procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); virtual;
/// <summary>
/// Called after |popup_browser_view| is created. This function will be called
/// after ICefLifeSpanHandler.OnAfterCreated() and OnBrowserCreated()
/// are called for the new popup browser. The popup originated from
/// |browser_view|. |is_devtools| will be true (1) if the popup is a DevTools
/// browser. Optionally add |popup_browser_view| to the views hierarchy
/// yourself and return true (1). Otherwise return false (0) and a default
/// ICefWindow will be created for the popup.
/// </summary>
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); virtual; procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); virtual;
procedure OnGetChromeToolbarType(const browser_view: ICefBrowserView; var aResult: TCefChromeToolbarType); virtual; /// <summary>
/// Returns the Chrome toolbar type that will be available via
/// ICefBrowserView.GetChromeToolbar(). See that function for related
/// documentation.
/// </summary>
procedure OnGetChromeToolbarType(const browser_view: ICefBrowserView; var aResult : TCefChromeToolbarType); virtual;
/// <summary>
/// Return true (1) to create frameless windows for Document picture-in-
/// picture popups. Content in frameless windows should specify draggable
/// regions using "-webkit-app-region: drag" CSS.
/// </summary>
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); virtual; procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); virtual;
/// <summary>
/// Called when |browser_view| receives a gesture command. Return true (1) to
/// handle (or disable) a |gesture_command| or false (0) to propagate the
/// gesture to the browser for default handling. With the Chrome runtime these
/// commands can also be handled via cef_command_handler_t::OnChromeCommand.
/// </summary>
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); virtual; procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; override; procedure InitializeCEFMethods; override;
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the ICefBrowserViewDelegate methods which call the ICefBrowserViewDelegateEvents methods.
/// ICefBrowserViewDelegateEvents will be implemented by the control receiving the ICefBrowserViewDelegate events.
/// </summary>
TCustomBrowserViewDelegate = class(TCefBrowserViewDelegateOwn) TCustomBrowserViewDelegate = class(TCefBrowserViewDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;

View File

@ -20,16 +20,47 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type type
/// <summary>
/// A View representing a button. Depending on the specific type, the button
/// could be implemented by a native control or custom rendered. Methods must be
/// called on the browser process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_button_capi.h">CEF source file: /include/capi/views/cef_button_capi.h (cef_button_t)</see></para>
/// </remarks>
TCefButtonRef = class(TCefViewRef, ICefButton) TCefButtonRef = class(TCefViewRef, ICefButton)
protected protected
/// <summary>
/// Returns this Button as a LabelButton or NULL if this is not a LabelButton.
/// </summary>
function AsLabelButton : ICefLabelButton; function AsLabelButton : ICefLabelButton;
/// <summary>
/// Sets the current display state of the Button.
/// </summary>
procedure SetState(state_: TCefButtonState); procedure SetState(state_: TCefButtonState);
/// <summary>
/// Returns the current display state of the Button.
/// </summary>
function GetState : TCefButtonState; function GetState : TCefButtonState;
/// <summary>
/// Sets the Button will use an ink drop effect for displaying state changes.
/// </summary>
procedure SetInkDropEnabled(enabled_: boolean); procedure SetInkDropEnabled(enabled_: boolean);
/// <summary>
/// Sets the tooltip text that will be displayed when the user hovers the
/// mouse cursor over the Button.
/// </summary>
procedure SetTooltipText(const tooltip_text: ustring); procedure SetTooltipText(const tooltip_text: ustring);
/// <summary>
/// Sets the accessible name that will be exposed to assistive technology
/// (AT).
/// </summary>
procedure SetAccessibleName(const name: ustring); procedure SetAccessibleName(const name: ustring);
public public
/// <summary>
/// Returns a ICefButton instance using a PCefButton data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefButton; class function UnWrap(data: Pointer): ICefButton;
end; end;

View File

@ -47,15 +47,37 @@ type
procedure doOnButtonStateChanged(const button: ICefButton); procedure doOnButtonStateChanged(const button: ICefButton);
public public
/// <summary>
/// Sets the Button will use an ink drop effect for displaying state changes.
/// </summary>
procedure SetInkDropEnabled(enabled_: boolean); procedure SetInkDropEnabled(enabled_: boolean);
/// <summary>
/// Sets the tooltip text that will be displayed when the user hovers the
/// mouse cursor over the Button.
/// </summary>
procedure SetTooltipText(const tooltip_text: ustring); procedure SetTooltipText(const tooltip_text: ustring);
/// <summary>
/// Sets the accessible name that will be exposed to assistive technology
/// (AT).
/// </summary>
procedure SetAccessibleName(const name_: ustring); procedure SetAccessibleName(const name_: ustring);
/// <summary>
/// Returns this Button as a LabelButton or NULL if this is not a LabelButton.
/// </summary>
property AsLabelButton : ICefLabelButton read GetAsLabelButton; property AsLabelButton : ICefLabelButton read GetAsLabelButton;
/// <summary>
/// Returns the current display state of the Button.
/// </summary>
property State : TCefButtonState read GetState write SetState; property State : TCefButtonState read GetState write SetState;
published published
/// <summary>
/// Called when |button| is pressed.
/// </summary>
property OnButtonPressed : TOnButtonPressedEvent read FOnButtonPressed write FOnButtonPressed; property OnButtonPressed : TOnButtonPressedEvent read FOnButtonPressed write FOnButtonPressed;
/// <summary>
/// Called when the state of |button| changes.
/// </summary>
property OnButtonStateChanged : TOnButtonStateChangedEvent read FOnButtonStateChanged write FOnButtonStateChanged; property OnButtonStateChanged : TOnButtonStateChangedEvent read FOnButtonStateChanged write FOnButtonStateChanged;
end; end;

View File

@ -26,19 +26,42 @@ type
procedure OnButtonStateChanged(const button: ICefButton); procedure OnButtonStateChanged(const button: ICefButton);
public public
/// <summary>
/// Returns a ICefButtonDelegate instance using a PCefButtonDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefButtonDelegate; class function UnWrap(data: Pointer): ICefButtonDelegate;
end; end;
/// <summary>
/// Implement this interface to handle Button events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_button_delegate_capi.h">CEF source file: /include/capi/views/cef_button_delegate_capi.h (cef_button_delegate_t)</see></para>
/// </remarks>
TCefButtonDelegateOwn = class(TCefViewDelegateOwn, ICefButtonDelegate) TCefButtonDelegateOwn = class(TCefViewDelegateOwn, ICefButtonDelegate)
protected protected
/// <summary>
/// Called when |button| is pressed.
/// </summary>
procedure OnButtonPressed(const button: ICefButton); virtual; procedure OnButtonPressed(const button: ICefButton); virtual;
/// <summary>
/// Called when the state of |button| changes.
/// </summary>
procedure OnButtonStateChanged(const button: ICefButton); virtual; procedure OnButtonStateChanged(const button: ICefButton); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; override; procedure InitializeCEFMethods; override;
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the ICefButtonDelegate methods which call the ICefButtonDelegateEvents methods.
/// ICefButtonDelegateEvents will be implemented by the control receiving the ICefButtonDelegate events.
/// </summary>
TCustomButtonDelegate = class(TCefButtonDelegateOwn) TCustomButtonDelegate = class(TCefButtonDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -60,6 +83,9 @@ type
procedure OnButtonStateChanged(const button: ICefButton); override; procedure OnButtonStateChanged(const button: ICefButton); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefButtonDelegateEvents); reintroduce; constructor Create(const events: ICefButtonDelegateEvents); reintroduce;
end; end;

View File

@ -20,26 +20,104 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type type
/// <summary>
/// This class typically, but not always, corresponds to a physical display
/// connected to the system. A fake Display may exist on a headless system, or a
/// Display may correspond to a remote, virtual display. All size and position
/// values are in density independent pixel (DIP) coordinates unless otherwise
/// indicated. Methods must be called on the browser process UI thread unless
/// otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_display_capi.h">CEF source file: /include/capi/views/cef_display_capi.h (cef_display_t)</see></para>
/// </remarks>
TCefDisplayRef = class(TCefBaseRefCountedRef, ICefDisplay) TCefDisplayRef = class(TCefBaseRefCountedRef, ICefDisplay)
protected protected
/// <summary>
/// Returns the unique identifier for this Display.
/// </summary>
function GetID : int64; function GetID : int64;
/// <summary>
/// Returns this Display's device pixel scale factor. This specifies how much
/// the UI should be scaled when the actual output has more pixels than
/// standard displays (which is around 100~120dpi). The potential return
/// values differ by platform.
/// </summary>
function GetDeviceScaleFactor : Single; function GetDeviceScaleFactor : Single;
/// <summary>
/// Convert |point| from DIP coordinates to pixel coordinates using this
/// Display's device scale factor.
/// </summary>
procedure ConvertPointToPixels(var point: TCefPoint); procedure ConvertPointToPixels(var point: TCefPoint);
/// <summary>
/// Convert |point| from pixel coordinates to DIP coordinates using this
/// Display's device scale factor.
/// </summary>
procedure ConvertPointFromPixels(var point: TCefPoint); procedure ConvertPointFromPixels(var point: TCefPoint);
/// <summary>
/// Returns this Display's bounds in DIP screen coordinates. This is the full
/// size of the display.
/// </summary>
function GetBounds : TCefRect; function GetBounds : TCefRect;
/// <summary>
/// Returns this Display's work area in DIP screen coordinates. This excludes
/// areas of the display that are occupied with window manager toolbars, etc.
/// </summary>
function GetWorkArea : TCefRect; function GetWorkArea : TCefRect;
/// <summary>
/// Returns this Display's rotation in degrees.
/// </summary>
function GetRotation : Integer; function GetRotation : Integer;
public public
/// <summary>
/// Returns a ICefDisplay instance using a PCefDisplay data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefDisplay; class function UnWrap(data: Pointer): ICefDisplay;
/// <summary>
/// Returns the primary Display.
/// </summary>
class function Primary: ICefDisplay; class function Primary: ICefDisplay;
/// <summary>
/// Returns the Display nearest |point|. Set |input_pixel_coords| to true (1) if
/// |point| is in pixel screen coordinates instead of DIP screen coordinates.
/// </summary>
class function NearestPoint(const point: TCefPoint; input_pixel_coords: boolean): ICefDisplay; class function NearestPoint(const point: TCefPoint; input_pixel_coords: boolean): ICefDisplay;
/// <summary>
/// Returns the Display that most closely intersects |bounds|. Set
/// |input_pixel_coords| to true (1) if |bounds| is in pixel screen coordinates
/// instead of DIP screen coordinates.
/// </summary>
class function MatchingBounds(const bounds: TCefRect; input_pixel_coords: boolean): ICefDisplay; class function MatchingBounds(const bounds: TCefRect; input_pixel_coords: boolean): ICefDisplay;
/// <summary>
/// Returns the total number of Displays. Mirrored displays are excluded; this
/// function is intended to return the number of distinct, usable displays.
/// </summary>
class function GetCount: NativeUInt; class function GetCount: NativeUInt;
/// <summary>
/// Returns all Displays. Mirrored displays are excluded; this function is
/// intended to return distinct, usable displays.
/// </summary>
class function GetAlls(var aDisplayArray : TCefDisplayArray) : boolean; class function GetAlls(var aDisplayArray : TCefDisplayArray) : boolean;
/// <summary>
/// Convert |point| from DIP screen coordinates to pixel screen coordinates.
/// This function is only used on Windows.
/// </summary>
class function ScreenPointToPixels(const aScreenPoint : TPoint) : TPoint; class function ScreenPointToPixels(const aScreenPoint : TPoint) : TPoint;
/// <summary>
/// Convert |point| from pixel screen coordinates to DIP screen coordinates.
/// This function is only used on Windows.
/// </summary>
class function ScreenPointFromPixels(const aPixelsPoint : TPoint) : TPoint; class function ScreenPointFromPixels(const aPixelsPoint : TPoint) : TPoint;
/// <summary>
/// Convert |rect| from DIP screen coordinates to pixel screen coordinates. This
/// function is only used on Windows.
/// </summary>
class function ScreenRectToPixels(const aScreenRect : TRect) : TRect; class function ScreenRectToPixels(const aScreenRect : TRect) : TRect;
/// <summary>
/// Convert |rect| from pixel screen coordinates to DIP screen coordinates. This
/// function is only used on Windows.
/// </summary>
class function ScreenRectFromPixels(const aPixelsRect : TRect) : TRect; class function ScreenRectFromPixels(const aPixelsRect : TRect) : TRect;
end; end;

View File

@ -20,8 +20,19 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLayout;
type type
/// <summary>
/// A simple Layout that causes the associated Panel's one child to be sized to
/// match the bounds of its parent. Methods must be called on the browser
/// process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_fill_layout_capi.h">CEF source file: /include/capi/views/cef_fill_layout_capi.h (cef_fill_layout_t)</see></para>
/// </remarks>
TCefFillLayoutRef = class(TCefLayoutRef, ICefFillLayout) TCefFillLayoutRef = class(TCefLayoutRef, ICefFillLayout)
public public
/// <summary>
/// Returns a ICefFillLayout instance using a PCefFillLayout data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefFillLayout; class function UnWrap(data: Pointer): ICefFillLayout;
end; end;

View File

@ -20,22 +20,84 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFButton; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFButton;
type type
/// <summary>
/// LabelButton is a button with optional text and/or icon. Methods must be
/// called on the browser process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_label_button_capi.h">CEF source file: /include/capi/views/cef_label_button_capi.h (cef_label_button_t)</see></para>
/// </remarks>
TCefLabelButtonRef = class(TCefButtonRef, ICefLabelButton) TCefLabelButtonRef = class(TCefButtonRef, ICefLabelButton)
protected protected
/// <summary>
/// Returns this LabelButton as a MenuButton or NULL if this is not a
/// MenuButton.
/// </summary>
function AsMenuButton : ICefMenuButton; function AsMenuButton : ICefMenuButton;
/// <summary>
/// Sets the text shown on the LabelButton. By default |text| will also be
/// used as the accessible name.
/// </summary>
procedure SetText(const text_: ustring); procedure SetText(const text_: ustring);
/// <summary>
/// Returns the text shown on the LabelButton.
/// </summary>
function GetText : ustring; function GetText : ustring;
/// <summary>
/// Sets the image shown for |button_state|. When this Button is drawn if no
/// image exists for the current state then the image for
/// CEF_BUTTON_STATE_NORMAL, if any, will be shown.
/// </summary>
procedure SetImage(button_state: TCefButtonState; const image: ICefImage); procedure SetImage(button_state: TCefButtonState; const image: ICefImage);
/// <summary>
/// Returns the image shown for |button_state|. If no image exists for that
/// state then the image for CEF_BUTTON_STATE_NORMAL will be returned.
/// </summary>
function GetImage(button_state: TCefButtonState): ICefImage; function GetImage(button_state: TCefButtonState): ICefImage;
/// <summary>
/// Sets the text color shown for the specified button |for_state| to |color|.
/// </summary>
procedure SetTextColor(for_state: TCefButtonState; color: TCefColor); procedure SetTextColor(for_state: TCefButtonState; color: TCefColor);
/// <summary>
/// Sets the text colors shown for the non-disabled states to |color|.
/// </summary>
procedure SetEnabledTextColors(color: TCefColor); procedure SetEnabledTextColors(color: TCefColor);
/// <summary>
/// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
/// where: - FONT_FAMILY_LIST is a comma-separated list of font family names,
/// - STYLES is an optional space-separated list of style names (case-
/// sensitive
/// "Bold" and "Italic" are supported), and
/// - SIZE is an integer font size in pixels with the suffix "px".
///
/// Here are examples of valid font description strings: - "Arial, Helvetica,
/// Bold Italic 14px" - "Arial, 14px"
/// </summary>
procedure SetFontList(const font_list: ustring); procedure SetFontList(const font_list: ustring);
/// <summary>
/// Sets the horizontal alignment; reversed in RTL. Default is
/// CEF_HORIZONTAL_ALIGNMENT_CENTER.
/// </summary>
procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment); procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment);
/// <summary>
/// Reset the minimum size of this LabelButton to |size|.
/// </summary>
procedure SetMinimumSize(const size_: TCefSize); procedure SetMinimumSize(const size_: TCefSize);
/// <summary>
/// Reset the maximum size of this LabelButton to |size|.
/// </summary>
procedure SetMaximumSize(const size_: TCefSize); procedure SetMaximumSize(const size_: TCefSize);
public public
/// <summary>
/// Returns a ICefLabelButton instance using a PCefLabelButton data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefLabelButton; class function UnWrap(data: Pointer): ICefLabelButton;
/// <summary>
/// Create a new LabelButton. A |delegate| must be provided to handle the button
/// click. |text| will be shown on the LabelButton and used as the default
/// accessible name.
/// </summary>
class function CreateLabelButton(const delegate: ICefButtonDelegate; const text: ustring): ICefLabelButton; class function CreateLabelButton(const delegate: ICefButtonDelegate; const text: ustring): ICefLabelButton;
end; end;

View File

@ -47,16 +47,62 @@ type
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new LabelButton. |aText| will be shown on the LabelButton and used as the default
/// accessible name.
/// </summary>
procedure CreateLabelButton(const aText : ustring); procedure CreateLabelButton(const aText : ustring);
/// <summary>
/// Sets the text color shown for the specified button |for_state| to |color|.
/// </summary>
procedure SetTextColor(for_state: TCefButtonState; color: TCefColor); procedure SetTextColor(for_state: TCefButtonState; color: TCefColor);
/// <summary>
/// Sets the text colors shown for the non-disabled states to |color|.
/// </summary>
procedure SetEnabledTextColors(color: TCefColor); procedure SetEnabledTextColors(color: TCefColor);
/// <summary>
/// <para>Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
/// where:</para>
/// <code>
/// - FONT_FAMILY_LIST is a comma-separated list of font family names,
/// - STYLES is an optional space-separated list of style names (case-sensitive
/// "Bold" and "Italic" are supported), and
/// - SIZE is an integer font size in pixels with the suffix "px".
/// </code>
/// <para>Here are examples of valid font description strings:</para>
/// <code>
/// - "Arial, Helvetica, Bold Italic 14px"
/// - "Arial, 14px"
/// </code>
/// </summary>
procedure SetFontList(const font_list: ustring); procedure SetFontList(const font_list: ustring);
/// <summary>
/// Sets the horizontal alignment; reversed in RTL. Default is
/// CEF_HORIZONTAL_ALIGNMENT_CENTER.
/// </summary>
procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment); procedure SetHorizontalAlignment(alignment: TCefHorizontalAlignment);
/// <summary>
/// Reset the minimum size of this LabelButton to |size|.
/// </summary>
procedure SetMinimumSize(const size_: TCefSize); procedure SetMinimumSize(const size_: TCefSize);
/// <summary>
/// Reset the maximum size of this LabelButton to |size|.
/// </summary>
procedure SetMaximumSize(const size_: TCefSize); procedure SetMaximumSize(const size_: TCefSize);
/// <summary>
/// Gets and sets the text shown on the LabelButton. By default |text| will also be
/// used as the accessible name.
/// </summary>
property Text : ustring read GetText write SetText; property Text : ustring read GetText write SetText;
/// <summary>
/// Returns the image shown for |button_state|. If no image exists for that
/// state then the image for CEF_BUTTON_STATE_NORMAL will be returned.
/// </summary>
property Image[button_state : TCefButtonState] : ICefImage read GetImage write SetImage; property Image[button_state : TCefButtonState] : ICefImage read GetImage write SetImage;
/// <summary>
/// Returns this LabelButton as a MenuButton or NULL if this is not a
/// MenuButton.
/// </summary>
property AsMenuButton : ICefMenuButton read GetAsMenuButton; property AsMenuButton : ICefMenuButton read GetAsMenuButton;
end; end;

View File

@ -20,13 +20,33 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type type
/// <summary>
/// A Layout handles the sizing of the children of a Panel according to
/// implementation-specific heuristics. Methods must be called on the browser
/// process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_layout_capi.h">CEF source file: /include/capi/views/cef_layout_capi.h (cef_layout_t)</see></para>
/// </remarks>
TCefLayoutRef = class(TCefBaseRefCountedRef, ICefLayout) TCefLayoutRef = class(TCefBaseRefCountedRef, ICefLayout)
protected protected
/// <summary>
/// Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout.
/// </summary>
function AsBoxLayout : ICefBoxLayout; function AsBoxLayout : ICefBoxLayout;
/// <summary>
/// Returns this Layout as a FillLayout or NULL if this is not a FillLayout.
/// </summary>
function AsFillLayout : ICefFillLayout; function AsFillLayout : ICefFillLayout;
/// <summary>
/// Returns true (1) if this Layout is valid.
/// </summary>
function IsValid : boolean; function IsValid : boolean;
public public
/// <summary>
/// Returns a ICefLayout instance using a PCefLayout data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefLayout; class function UnWrap(data: Pointer): ICefLayout;
end; end;

View File

@ -20,13 +20,45 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLabelButton; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFLabelButton;
type type
/// <summary>
/// MenuButton is a button with optional text, icon and/or menu marker that
/// shows a menu when clicked with the left mouse button. All size and position
/// values are in density independent pixels (DIP) unless otherwise indicated.
/// Methods must be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_menu_button_capi.h">CEF source file: /include/capi/views/cef_menu_button_capi.h (cef_menu_button_t)</see></para>
/// </remarks>
TCefMenuButtonRef = class(TCefLabelButtonRef, ICefMenuButton) TCefMenuButtonRef = class(TCefLabelButtonRef, ICefMenuButton)
protected protected
/// <summary>
/// Show a menu with contents |menu_model|. |screen_point| specifies the menu
/// position in screen coordinates. |anchor_position| specifies how the menu
/// will be anchored relative to |screen_point|. This function should be
/// called from ICefMenuButtonDelegate.OnMenuButtonPressed().
/// </summary>
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition); procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition);
/// <summary>
/// Show the menu for this button. Results in a call to
/// ICefMenuButtonDelegate.OnMenuButtonPressed().
/// </summary>
procedure TriggerMenu; procedure TriggerMenu;
public public
/// <summary>
/// Returns a ICefMenuButton instance using a PCefMenuButton data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefMenuButton; class function UnWrap(data: Pointer): ICefMenuButton;
/// <summary>
/// Create a new MenuButton. A |delegate| must be provided to call show_menu()
/// when the button is clicked. |text| will be shown on the MenuButton and used
/// as the default accessible name. If |with_frame| is true (1) the button will
/// have a visible frame at all times, center alignment, additional padding and
/// a default minimum size of 70x33 DIP. If |with_frame| is false (0) the button
/// will only have a visible frame on hover/press, left alignment, less padding
/// and no default minimum size.
/// </summary>
class function CreateMenuButton(const delegate: ICefMenuButtonDelegate; const text: ustring): ICefMenuButton; class function CreateMenuButton(const delegate: ICefMenuButtonDelegate; const text: ustring): ICefMenuButton;
end; end;

View File

@ -47,11 +47,30 @@ type
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new MenuButton.
/// </summary>
procedure CreateMenuButton(const aText : ustring); procedure CreateMenuButton(const aText : ustring);
/// <summary>
/// Show a menu with contents |menu_model|. |screen_point| specifies the menu
/// position in screen coordinates. |anchor_position| specifies how the menu
/// will be anchored relative to |screen_point|. This function should be
/// called from ICefMenuButtonDelegate.OnMenuButtonPressed().
/// </summary>
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition); procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position: TCefMenuAnchorPosition);
/// <summary>
/// Show the menu for this button. Results in a call to
/// ICefMenuButtonDelegate.OnMenuButtonPressed().
/// </summary>
procedure TriggerMenu; procedure TriggerMenu;
published published
/// <summary>
/// Called when |button| is pressed. Call ICefMenuButton.ShowMenu() to
/// show a popup menu at |screen_point|. When showing a custom popup such as a
/// window keep a reference to |button_pressed_lock| until the popup is hidden
/// to maintain the pressed button state.
/// </summary>
property OnMenuButtonPressed : TOnMenuButtonPressedEvent read FOnMenuButtonPressed write FOnMenuButtonPressed; property OnMenuButtonPressed : TOnMenuButtonPressedEvent read FOnMenuButtonPressed write FOnMenuButtonPressed;
end; end;

View File

@ -25,18 +25,41 @@ type
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock); procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock);
public public
/// <summary>
/// Returns a ICefMenuButtonDelegate instance using a PCefMenuButtonDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefMenuButtonDelegate; class function UnWrap(data: Pointer): ICefMenuButtonDelegate;
end; end;
/// <summary>
/// Implement this interface to handle MenuButton events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_menu_button_delegate_capi.h">CEF source file: /include/capi/views/cef_menu_button_delegate_capi.h (cef_menu_button_delegate_t)</see></para>
/// </remarks>
TCefMenuButtonDelegateOwn = class(TCefButtonDelegateOwn, ICefMenuButtonDelegate) TCefMenuButtonDelegateOwn = class(TCefButtonDelegateOwn, ICefMenuButtonDelegate)
protected protected
/// <summary>
/// Called when |button| is pressed. Call ICefMenuButton.ShowMenu() to
/// show a popup menu at |screen_point|. When showing a custom popup such as a
/// window keep a reference to |button_pressed_lock| until the popup is hidden
/// to maintain the pressed button state.
/// </summary>
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock); virtual; procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; override; procedure InitializeCEFMethods; override;
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the ICefMenuButtonDelegate methods which call the ICefMenuButtonDelegateEvents methods.
/// ICefMenuButtonDelegateEvents will be implemented by the control receiving the ICefMenuButtonDelegate events.
/// </summary>
TCustomMenuButtonDelegate = class(TCefMenuButtonDelegateOwn) TCustomMenuButtonDelegate = class(TCefMenuButtonDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -61,6 +84,9 @@ type
procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock); override; procedure OnMenuButtonPressed(const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefMenuButtonDelegateEvents); reintroduce; constructor Create(const events: ICefMenuButtonDelegateEvents); reintroduce;
end; end;

View File

@ -20,8 +20,17 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type type
/// <summary>
/// MenuButton pressed lock is released when this object is destroyed.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_menu_button_delegate_capi.h">CEF source file: /include/capi/views/cef_menu_button_delegate_capi.h (cef_menu_button_pressed_lock_t)</see></para>
/// </remarks>
TCefMenuButtonPressedLockRef = class(TCefBaseRefCountedRef, ICefMenuButtonPressedLock) TCefMenuButtonPressedLockRef = class(TCefBaseRefCountedRef, ICefMenuButtonPressedLock)
public public
/// <summary>
/// Returns a ICefMenuButtonPressedLock instance using a PCefMenuButtonPressedLock data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefMenuButtonPressedLock; class function UnWrap(data: Pointer): ICefMenuButtonPressedLock;
end; end;

View File

@ -20,28 +20,137 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type type
/// <summary>
/// Controller for an overlay that contains a contents View added via
/// ICefWindow.AddOverlayView. Methods exposed by this controller should be
/// called in preference to functions of the same name exposed by the contents
/// View unless otherwise indicated. Methods must be called on the browser
/// process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_overlay_controller_capi.h">CEF source file: /include/capi/views/cef_overlay_controller_capi.h (cef_overlay_controller_t)</see></para>
/// </remarks>
TCefOverlayControllerRef = class(TCefBaseRefCountedRef, ICefOverlayController) TCefOverlayControllerRef = class(TCefBaseRefCountedRef, ICefOverlayController)
public public
/// <summary>
/// Returns true (1) if this object is valid.
/// </summary>
function IsValid: boolean; function IsValid: boolean;
/// <summary>
/// Returns true (1) if this object is the same as |that| object.
/// </summary>
function IsSame(const that: ICefOverlayController): boolean; function IsSame(const that: ICefOverlayController): boolean;
/// <summary>
/// Returns the contents View for this overlay.
/// </summary>
function GetContentsView: ICefView; function GetContentsView: ICefView;
/// <summary>
/// Returns the top-level Window hosting this overlay. Use this function
/// instead of calling get_window() on the contents View.
/// </summary>
function GetWindow: ICefWindow; function GetWindow: ICefWindow;
/// <summary>
/// Returns the docking mode for this overlay.
/// </summary>
function GetDockingMode: TCefDockingMode; function GetDockingMode: TCefDockingMode;
/// <summary>
/// Destroy this overlay.
/// </summary>
procedure DestroyOverlay; procedure DestroyOverlay;
/// <summary>
/// Sets the bounds (size and position) of this overlay. This will set the
/// bounds of the contents View to match and trigger a re-layout if necessary.
/// |bounds| is in parent coordinates and any insets configured on this
/// overlay will be ignored. Use this function only for overlays created with
/// a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking modes
/// modify the insets of this overlay and/or layout of the contents View and
/// call size_to_preferred_size() instead to calculate the new size and re-
/// position the overlay if necessary.
/// </summary>
procedure SetBounds(const bounds: TCefRect); procedure SetBounds(const bounds: TCefRect);
/// <summary>
/// Returns the bounds (size and position) of this overlay in parent
/// coordinates.
/// </summary>
function GetBounds: TCefRect; function GetBounds: TCefRect;
/// <summary>
/// Returns the bounds (size and position) of this overlay in DIP screen
/// coordinates.
/// </summary>
function GetBoundsInScreen: TCefRect; function GetBoundsInScreen: TCefRect;
/// <summary>
/// Sets the size of this overlay without changing the position. This will set
/// the size of the contents View to match and trigger a re-layout if
/// necessary. |size| is in parent coordinates and any insets configured on
/// this overlay will be ignored. Use this function only for overlays created
/// with a docking mode value of CEF_DOCKING_MODE_CUSTOM. With other docking
/// modes modify the insets of this overlay and/or layout of the contents View
/// and call size_to_preferred_size() instead to calculate the new size and
/// re-position the overlay if necessary.
/// </summary>
procedure SetSize(const size: TCefSize); procedure SetSize(const size: TCefSize);
/// <summary>
/// Returns the size of this overlay in parent coordinates.
/// </summary>
function GetSize: TCefSize; function GetSize: TCefSize;
/// <summary>
/// Sets the position of this overlay without changing the size. |position| is
/// in parent coordinates and any insets configured on this overlay will be
/// ignored. Use this function only for overlays created with a docking mode
/// value of CEF_DOCKING_MODE_CUSTOM. With other docking modes modify the
/// insets of this overlay and/or layout of the contents View and call
/// size_to_preferred_size() instead to calculate the new size and re-position
/// the overlay if necessary.
/// </summary>
procedure SetPosition(const position: TCefPoint); procedure SetPosition(const position: TCefPoint);
/// <summary>
/// Returns the position of this overlay in parent coordinates.
/// </summary>
function GetPosition: TCefPoint; function GetPosition: TCefPoint;
/// <summary>
/// Sets the insets for this overlay. |insets| is in parent coordinates. Use
/// this function only for overlays created with a docking mode value other
/// than CEF_DOCKING_MODE_CUSTOM.
/// </summary>
procedure SetInsets(const insets: TCefInsets); procedure SetInsets(const insets: TCefInsets);
/// <summary>
/// Returns the insets for this overlay in parent coordinates.
/// </summary>
function GetInsets: TCefInsets; function GetInsets: TCefInsets;
/// <summary>
/// Size this overlay to its preferred size and trigger a re-layout if
/// necessary. The position of overlays created with a docking mode value of
/// CEF_DOCKING_MODE_CUSTOM will not be modified by calling this function.
/// With other docking modes this function may re-position the overlay if
/// necessary to accommodate the new size and any insets configured on the
/// contents View.
/// </summary>
procedure SizeToPreferredSize; procedure SizeToPreferredSize;
/// <summary>
/// Sets whether this overlay is visible. Overlays are hidden by default. If
/// this overlay is hidden then it and any child Views will not be drawn and,
/// if any of those Views currently have focus, then focus will also be
/// cleared. Painting is scheduled as needed.
/// </summary>
procedure SetVisible(visible: boolean); procedure SetVisible(visible: boolean);
/// <summary>
/// Returns whether this overlay is visible. A View may be visible but still
/// not drawn in a Window if any parent Views are hidden. Call is_drawn() to
/// determine whether this overlay and all parent Views are visible and will
/// be drawn.
/// </summary>
function IsVisible: boolean; function IsVisible: boolean;
/// <summary>
/// Returns whether this overlay is visible and drawn in a Window. A View is
/// drawn if it and all parent Views are visible. To determine if the
/// containing Window is visible to the user on-screen call is_visible() on
/// the Window.
/// </summary>
function IsDrawn: boolean; function IsDrawn: boolean;
/// <summary>
/// Returns a ICefOverlayController instance using a PCefOverlayController data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefOverlayController; class function UnWrap(data: Pointer): ICefOverlayController;
end; end;

View File

@ -20,23 +20,77 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type type
/// <summary>
/// A Panel is a container in the views hierarchy that can contain other Views
/// as children. Methods must be called on the browser process UI thread unless
/// otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_panel_capi.h">CEF source file: /include/capi/views/cef_panel_capi.h (cef_panel_t)</see></para>
/// </remarks>
TCefPanelRef = class(TCefViewRef, ICefPanel) TCefPanelRef = class(TCefViewRef, ICefPanel)
protected protected
/// <summary>
/// Returns this Panel as a Window or NULL if this is not a Window.
/// </summary>
function GetAsWindow : ICefWindow; function GetAsWindow : ICefWindow;
/// <summary>
/// Set this Panel's Layout to FillLayout and return the FillLayout object.
/// </summary>
function SetToFillLayout : ICefFillLayout; function SetToFillLayout : ICefFillLayout;
/// <summary>
/// Set this Panel's Layout to BoxLayout and return the BoxLayout object.
/// </summary>
function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout; function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout;
/// <summary>
/// Get the Layout.
/// </summary>
function GetLayout : ICefLayout; function GetLayout : ICefLayout;
/// <summary>
/// Lay out the child Views (set their bounds based on sizing heuristics
/// specific to the current Layout).
/// </summary>
procedure Layout; procedure Layout;
/// <summary>
/// Add a child View.
/// </summary>
procedure AddChildView(const view: ICefView); procedure AddChildView(const view: ICefView);
/// <summary>
/// Add a child View at the specified |index|. If |index| matches the result
/// of GetChildCount() then the View will be added at the end.
/// </summary>
procedure AddChildViewAt(const view: ICefView; index: Integer); procedure AddChildViewAt(const view: ICefView; index: Integer);
/// <summary>
/// Move the child View to the specified |index|. A negative value for |index|
/// will move the View to the end.
/// </summary>
procedure ReorderChildView(const view: ICefView; index: Integer); procedure ReorderChildView(const view: ICefView; index: Integer);
/// <summary>
/// Remove a child View. The View can then be added to another Panel.
/// </summary>
procedure RemoveChildView(const view: ICefView); procedure RemoveChildView(const view: ICefView);
/// <summary>
/// Remove all child Views. The removed Views will be deleted if the client
/// holds no references to them.
/// </summary>
procedure RemoveAllChildViews; procedure RemoveAllChildViews;
/// <summary>
/// Returns the number of child Views.
/// </summary>
function GetChildViewCount : NativeUInt; function GetChildViewCount : NativeUInt;
/// <summary>
/// Returns the child View at the specified |index|.
/// </summary>
function GetChildViewAt(index: Integer): ICefView; function GetChildViewAt(index: Integer): ICefView;
public public
/// <summary>
/// Returns a ICefPanel instance using a PCefPanel data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefPanel; class function UnWrap(data: Pointer): ICefPanel;
/// <summary>
/// Create a new Panel.
/// </summary>
class function CreatePanel(const delegate: ICefPanelDelegate): ICefPanel; class function CreatePanel(const delegate: ICefPanelDelegate): ICefPanel;
end; end;

View File

@ -35,25 +35,68 @@ type
function GetAsView : ICefView; override; function GetAsView : ICefView; override;
function GetAsPanel : ICefPanel; override; function GetAsPanel : ICefPanel; override;
function GetAsWindow : ICefWindow; virtual; function GetAsWindow : ICefWindow; virtual;
function GetChildViewCount : NativeUInt;
// ICefViewDelegateEvents // ICefViewDelegateEvents
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new Panel.
/// </summary>
procedure CreatePanel; procedure CreatePanel;
/// <summary>
/// Set this Panel's Layout to FillLayout and return the FillLayout object.
/// </summary>
function SetToFillLayout : ICefFillLayout; function SetToFillLayout : ICefFillLayout;
/// <summary>
/// Set this Panel's Layout to BoxLayout and return the BoxLayout object.
/// </summary>
function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout; function SetToBoxLayout(const settings: TCefBoxLayoutSettings): ICefBoxLayout;
/// <summary>
/// Get the Layout.
/// </summary>
function GetLayout : ICefLayout; function GetLayout : ICefLayout;
/// <summary>
/// Lay out the child Views (set their bounds based on sizing heuristics
/// specific to the current Layout).
/// </summary>
procedure Layout; procedure Layout;
/// <summary>
/// Add a child View.
/// </summary>
procedure AddChildView(const view: ICefView); procedure AddChildView(const view: ICefView);
/// <summary>
/// Add a child View at the specified |index|. If |index| matches the result
/// of GetChildCount() then the View will be added at the end.
/// </summary>
procedure AddChildViewAt(const view: ICefView; index: Integer); procedure AddChildViewAt(const view: ICefView; index: Integer);
/// <summary>
/// Move the child View to the specified |index|. A negative value for |index|
/// will move the View to the end.
/// </summary>
procedure ReorderChildView(const view: ICefView; index: Integer); procedure ReorderChildView(const view: ICefView; index: Integer);
/// <summary>
/// Remove a child View. The View can then be added to another Panel.
/// </summary>
procedure RemoveChildView(const view: ICefView); procedure RemoveChildView(const view: ICefView);
/// <summary>
/// Remove all child Views. The removed Views will be deleted if the client
/// holds no references to them.
/// </summary>
procedure RemoveAllChildViews; procedure RemoveAllChildViews;
function GetChildViewCount : NativeUInt; /// <summary>
/// Returns the child View at the specified |index|.
/// </summary>
function GetChildViewAt(index: Integer): ICefView; function GetChildViewAt(index: Integer): ICefView;
/// <summary>
/// Returns this Panel as a Window or NULL if this is not a Window.
/// </summary>
property AsWindow : ICefWindow read GetAsWindow; property AsWindow : ICefWindow read GetAsWindow;
/// <summary>
/// Returns the number of child Views.
/// </summary>
property ChildViewCount : NativeUInt read GetChildViewCount;
end; end;
{$IFDEF FPC} {$IFDEF FPC}

View File

@ -22,14 +22,29 @@ uses
type type
TCefPanelDelegateRef = class(TCefViewDelegateRef, ICefPanelDelegate) TCefPanelDelegateRef = class(TCefViewDelegateRef, ICefPanelDelegate)
public public
/// <summary>
/// Returns a ICefPanelDelegate instance using a PCefPanelDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefPanelDelegate; class function UnWrap(data: Pointer): ICefPanelDelegate;
end; end;
/// <summary>
/// Implement this interface to handle Panel events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_panel_delegate_capi.h">CEF source file: /include/capi/views/cef_panel_delegate_capi.h (cef_panel_delegate_t)</see></para>
/// </remarks>
TCefPanelDelegateOwn = class(TCefViewDelegateOwn, ICefPanelDelegate) TCefPanelDelegateOwn = class(TCefViewDelegateOwn, ICefPanelDelegate)
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the ICefPanelDelegate methods which call the ICefPanelDelegateEvents methods.
/// ICefPanelDelegateEvents will be implemented by the control receiving the ICefPanelDelegate events.
/// </summary>
TCustomPanelDelegate = class(TCefPanelDelegateOwn) TCustomPanelDelegate = class(TCefPanelDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -47,6 +62,9 @@ type
procedure OnBlur(const view: ICefView); override; procedure OnBlur(const view: ICefView); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefPanelDelegateEvents); reintroduce; constructor Create(const events: ICefPanelDelegateEvents); reintroduce;
end; end;

View File

@ -20,18 +20,54 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type type
/// <summary>
/// A ScrollView will show horizontal and/or vertical scrollbars when necessary
/// based on the size of the attached content view. Methods must be called on
/// the browser process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_scroll_view_capi.h">CEF source file: /include/capi/views/cef_scroll_view_capi.h (cef_scroll_view_t)</see></para>
/// </remarks>
TCefScrollViewRef = class(TCefViewRef, ICefScrollView) TCefScrollViewRef = class(TCefViewRef, ICefScrollView)
protected protected
/// <summary>
/// Set the content View. The content View must have a specified size (e.g.
/// via ICefView.SetBounds or ICefViewDelegate.GetPreferredSize).
/// </summary>
procedure SetContentView(const view: ICefView); procedure SetContentView(const view: ICefView);
/// <summary>
/// Returns the content View.
/// </summary>
function GetContentView : ICefView; function GetContentView : ICefView;
/// <summary>
/// Returns the visible region of the content View.
/// </summary>
function GetVisibleContentRect : TCefRect; function GetVisibleContentRect : TCefRect;
/// <summary>
/// Returns true (1) if the horizontal scrollbar is currently showing.
/// </summary>
function HasHorizontalScrollbar : boolean; function HasHorizontalScrollbar : boolean;
/// <summary>
/// Returns the height of the horizontal scrollbar.
/// </summary>
function GetHorizontalScrollbarHeight : Integer; function GetHorizontalScrollbarHeight : Integer;
/// <summary>
/// Returns true (1) if the vertical scrollbar is currently showing.
/// </summary>
function HasVerticalScrollbar : boolean; function HasVerticalScrollbar : boolean;
/// <summary>
/// Returns the width of the vertical scrollbar.
/// </summary>
function GetVerticalScrollbarWidth : Integer; function GetVerticalScrollbarWidth : Integer;
public public
/// <summary>
/// Returns a ICefScrollView instance using a PCefScrollView data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefScrollView; class function UnWrap(data: Pointer): ICefScrollView;
/// <summary>
/// Create a new ScrollView.
/// </summary>
class function CreateScrollView(const delegate: ICefViewDelegate): ICefScrollView; class function CreateScrollView(const delegate: ICefViewDelegate): ICefScrollView;
end; end;

View File

@ -47,13 +47,34 @@ type
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new ScrollView.
/// </summary>
procedure CreateScrollView; procedure CreateScrollView;
/// <summary>
/// Get and set the content View. The content View must have a specified size (e.g.
/// via ICefView.SetBounds or ICefViewDelegate.GetPreferredSize).
/// </summary>
property ContentView : ICefView read GetContentView write SetContentView; property ContentView : ICefView read GetContentView write SetContentView;
/// <summary>
/// Returns the visible region of the content View.
/// </summary>
property VisibleContentRect : TCefRect read GetVisibleContentRect; property VisibleContentRect : TCefRect read GetVisibleContentRect;
/// <summary>
/// Returns the height of the horizontal scrollbar.
/// </summary>
property HorizontalScrollbarHeight : Integer read GetHorizontalScrollbarHeight; property HorizontalScrollbarHeight : Integer read GetHorizontalScrollbarHeight;
/// <summary>
/// Returns the width of the vertical scrollbar.
/// </summary>
property VerticalScrollbarWidth : Integer read GetVerticalScrollbarWidth; property VerticalScrollbarWidth : Integer read GetVerticalScrollbarWidth;
/// <summary>
/// Returns true (1) if the horizontal scrollbar is currently showing.
/// </summary>
property HasHorizontalScrollbar : boolean read GetHasHorizontalScrollbar; property HasHorizontalScrollbar : boolean read GetHasHorizontalScrollbar;
/// <summary>
/// Returns true (1) if the vertical scrollbar is currently showing.
/// </summary>
property HasVerticalScrollbar : boolean read GetHasVerticalScrollbar; property HasVerticalScrollbar : boolean read GetHasVerticalScrollbar;
end; end;

View File

@ -20,42 +20,168 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFView;
type type
/// <summary>
/// A Textfield supports editing of text. This control is custom rendered with
/// no platform-specific code. Methods must be called on the browser process UI
/// thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_textfield_capi.h">CEF source file: /include/capi/views/cef_textfield_capi.h (cef_textfield_t)</see></para>
/// </remarks>
TCefTextfieldRef = class(TCefViewRef, ICefTextfield) TCefTextfieldRef = class(TCefViewRef, ICefTextfield)
protected protected
/// <summary>
/// Sets whether the text will be displayed as asterisks.
/// </summary>
procedure SetPasswordInput(password_input: boolean); procedure SetPasswordInput(password_input: boolean);
/// <summary>
/// Returns true (1) if the text will be displayed as asterisks.
/// </summary>
function IsPasswordInput : boolean; function IsPasswordInput : boolean;
/// <summary>
/// Sets whether the text will read-only.
/// </summary>
procedure SetReadOnly(read_only: boolean); procedure SetReadOnly(read_only: boolean);
/// <summary>
/// Returns true (1) if the text is read-only.
/// </summary>
function IsReadOnly : boolean; function IsReadOnly : boolean;
/// <summary>
/// Returns the currently displayed text.
/// </summary>
function GetText : ustring; function GetText : ustring;
/// <summary>
/// Sets the contents to |text|. The cursor will be moved to end of the text
/// if the current position is outside of the text range.
/// </summary>
procedure SetText(const text_: ustring); procedure SetText(const text_: ustring);
/// <summary>
/// Appends |text| to the previously-existing text.
/// </summary>
procedure AppendText(const text_: ustring); procedure AppendText(const text_: ustring);
/// <summary>
/// Inserts |text| at the current cursor position replacing any selected text.
/// </summary>
procedure InsertOrReplaceText(const text_: ustring); procedure InsertOrReplaceText(const text_: ustring);
/// <summary>
/// Returns true (1) if there is any selected text.
/// </summary>
function HasSelection : boolean; function HasSelection : boolean;
/// <summary>
/// Returns the currently selected text.
/// </summary>
function GetSelectedText : ustring; function GetSelectedText : ustring;
/// <summary>
/// Selects all text. If |reversed| is true (1) the range will end at the
/// logical beginning of the text; this generally shows the leading portion of
/// text that overflows its display area.
/// </summary>
procedure SelectAll(reversed: boolean); procedure SelectAll(reversed: boolean);
/// <summary>
/// Clears the text selection and sets the caret to the end.
/// </summary>
procedure ClearSelection; procedure ClearSelection;
/// <summary>
/// Returns the selected logical text range.
/// </summary>
function GetSelectedRange : TCefRange; function GetSelectedRange : TCefRange;
/// <summary>
/// Selects the specified logical text range.
/// </summary>
procedure SelectRange(const range: TCefRange); procedure SelectRange(const range: TCefRange);
/// <summary>
/// Returns the current cursor position.
/// </summary>
function GetCursorPosition : NativeUInt; function GetCursorPosition : NativeUInt;
/// <summary>
/// Sets the text color.
/// </summary>
procedure SetTextColor(color: TCefColor); procedure SetTextColor(color: TCefColor);
/// <summary>
/// Returns the text color.
/// </summary>
function GetTextColor : TCefColor; function GetTextColor : TCefColor;
/// <summary>
/// Sets the selection text color.
/// </summary>
procedure SetSelectionTextColor(color: TCefColor); procedure SetSelectionTextColor(color: TCefColor);
/// <summary>
/// Returns the selection text color.
/// </summary>
function GetSelectionTextColor : TCefColor; function GetSelectionTextColor : TCefColor;
/// <summary>
/// Sets the selection background color.
/// </summary>
procedure SetSelectionBackgroundColor(color: TCefColor); procedure SetSelectionBackgroundColor(color: TCefColor);
/// <summary>
/// Returns the selection background color.
/// </summary>
function GetSelectionBackgroundColor : TCefColor; function GetSelectionBackgroundColor : TCefColor;
/// <summary>
/// Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
/// where: - FONT_FAMILY_LIST is a comma-separated list of font family names,
/// - STYLES is an optional space-separated list of style names (case-
/// sensitive
/// "Bold" and "Italic" are supported), and
/// - SIZE is an integer font size in pixels with the suffix "px".
///
/// Here are examples of valid font description strings: - "Arial, Helvetica,
/// Bold Italic 14px" - "Arial, 14px"
/// </summary>
procedure SetFontList(const font_list: ustring); procedure SetFontList(const font_list: ustring);
/// <summary>
/// Applies |color| to the specified |range| without changing the default
/// color. If |range| is NULL the color will be set on the complete text
/// contents.
/// </summary>
procedure ApplyTextColor(color: TCefColor; const range: TCefRange); procedure ApplyTextColor(color: TCefColor; const range: TCefRange);
/// <summary>
/// Applies |style| to the specified |range| without changing the default
/// style. If |add| is true (1) the style will be added, otherwise the style
/// will be removed. If |range| is NULL the style will be set on the complete
/// text contents.
/// </summary>
procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange); procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange);
/// <summary>
/// Returns true (1) if the action associated with the specified command id is
/// enabled. See additional comments on execute_command().
/// </summary>
function IsCommandEnabled(command_id: TCefTextFieldCommands): boolean; function IsCommandEnabled(command_id: TCefTextFieldCommands): boolean;
/// <summary>
/// Performs the action associated with the specified command id.
/// </summary>
procedure ExecuteCommand(command_id: TCefTextFieldCommands); procedure ExecuteCommand(command_id: TCefTextFieldCommands);
/// <summary>
/// Clears Edit history.
/// </summary>
procedure ClearEditHistory; procedure ClearEditHistory;
/// <summary>
/// Sets the placeholder text that will be displayed when the Textfield is
/// NULL.
/// </summary>
procedure SetPlaceholderText(const text_: ustring); procedure SetPlaceholderText(const text_: ustring);
/// <summary>
/// Returns the placeholder text that will be displayed when the Textfield is
/// NULL.
/// </summary>
function GetPlaceholderText : ustring; function GetPlaceholderText : ustring;
/// <summary>
/// Sets the placeholder text color.
/// </summary>
procedure SetPlaceholderTextColor(color: TCefColor); procedure SetPlaceholderTextColor(color: TCefColor);
/// <summary>
/// Set the accessible name that will be exposed to assistive technology (AT).
/// </summary>
procedure SetAccessibleName(const name: ustring); procedure SetAccessibleName(const name: ustring);
public public
/// <summary>
/// Returns a ICefTextfield instance using a PCefTextfield data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefTextfield; class function UnWrap(data: Pointer): ICefTextfield;
/// <summary>
/// Create a new Textfield.
/// </summary>
class function CreateTextField(const delegate: ICefTextfieldDelegate): ICefTextfield; class function CreateTextField(const delegate: ICefTextfieldDelegate): ICefTextfield;
end; end;

View File

@ -57,6 +57,7 @@ type
procedure SetSelectionTextColor(color: TCefColor); procedure SetSelectionTextColor(color: TCefColor);
procedure SetSelectionBackgroundColor(color: TCefColor); procedure SetSelectionBackgroundColor(color: TCefColor);
procedure SetPlaceholderText(const text_: ustring); procedure SetPlaceholderText(const text_: ustring);
procedure SetSelectedRange(const range: TCefRange);
// ICefTextfieldDelegateEvents // ICefTextfieldDelegateEvents
procedure doOnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent; var aResult : boolean); procedure doOnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent; var aResult : boolean);
@ -66,33 +67,134 @@ type
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new Textfield.
/// </summary>
procedure CreateTextField; procedure CreateTextField;
/// <summary>
/// Appends |text| to the previously-existing text.
/// </summary>
procedure AppendText(const text_: ustring); procedure AppendText(const text_: ustring);
/// <summary>
/// Inserts |text| at the current cursor position replacing any selected text.
/// </summary>
procedure InsertOrReplaceText(const text_: ustring); procedure InsertOrReplaceText(const text_: ustring);
/// <summary>
/// Selects all text. If |reversed| is true (1) the range will end at the
/// logical beginning of the text; this generally shows the leading portion of
/// text that overflows its display area.
/// </summary>
procedure SelectAll(reversed: boolean); procedure SelectAll(reversed: boolean);
/// <summary>
/// Clears the text selection and sets the caret to the end.
/// </summary>
procedure ClearSelection; procedure ClearSelection;
procedure SelectRange(const range: TCefRange); /// <summary>
/// <para>Sets the font list. The format is "<FONT_FAMILY_LIST>,[STYLES] <SIZE>",
/// where:</para>
/// <code>
/// - FONT_FAMILY_LIST is a comma-separated list of font family names,
/// - STYLES is an optional space-separated list of style names (case-sensitive
/// "Bold" and "Italic" are supported), and
/// - SIZE is an integer font size in pixels with the suffix "px".
/// </code>
/// <para>Here are examples of valid font description strings:</para>
/// <code>
/// - "Arial, Helvetica, Bold Italic 14px"
/// - "Arial, 14px"
/// </code>
/// </summary>
procedure SetFontList(const font_list: ustring); procedure SetFontList(const font_list: ustring);
/// <summary>
/// Applies |color| to the specified |range| without changing the default
/// color. If |range| is NULL the color will be set on the complete text
/// contents.
/// </summary>
procedure ApplyTextColor(color: TCefColor; const range: TCefRange); procedure ApplyTextColor(color: TCefColor; const range: TCefRange);
/// <summary>
/// Applies |style| to the specified |range| without changing the default
/// style. If |add| is true (1) the style will be added, otherwise the style
/// will be removed. If |range| is NULL the style will be set on the complete
/// text contents.
/// </summary>
procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange); procedure ApplyTextStyle(style: TCefTextStyle; add: boolean; const range: TCefRange);
/// <summary>
/// Returns true (1) if the action associated with the specified command id is
/// enabled. See additional comments on execute_command().
/// </summary>
function IsCommandEnabled(command_id: TCefTextFieldCommands): boolean; function IsCommandEnabled(command_id: TCefTextFieldCommands): boolean;
/// <summary>
/// Performs the action associated with the specified command id.
/// </summary>
procedure ExecuteCommand(command_id: TCefTextFieldCommands); procedure ExecuteCommand(command_id: TCefTextFieldCommands);
/// <summary>
/// Clears Edit history.
/// </summary>
procedure ClearEditHistory; procedure ClearEditHistory;
/// <summary>
/// Set the accessible name that will be exposed to assistive technology (AT).
/// </summary>
procedure SetAccessibleName(const name_: ustring); procedure SetAccessibleName(const name_: ustring);
/// <summary>
/// Sets the placeholder text color.
/// </summary>
procedure SetPlaceholderTextColor(color: TCefColor); procedure SetPlaceholderTextColor(color: TCefColor);
/// <summary>
/// Returns true (1) if the text will be displayed as asterisks.
/// </summary>
property PasswordInput : boolean read GetIsPasswordInput write SetPasswordInput; property PasswordInput : boolean read GetIsPasswordInput write SetPasswordInput;
/// <summary>
/// Returns true (1) if the text is read-only.
/// </summary>
property ReadOnly : boolean read GetIsReadOnly write SetReadOnly; property ReadOnly : boolean read GetIsReadOnly write SetReadOnly;
/// <summary>
/// Returns the currently displayed text.
/// </summary>
property Text : ustring read GetText write SetText; property Text : ustring read GetText write SetText;
/// <summary>
/// Returns the currently selected text.
/// </summary>
property SelectedText : ustring read GetSelectedText; property SelectedText : ustring read GetSelectedText;
/// <summary>
/// Returns the selected logical text range.
/// </summary>
property SelectedRange : TCefRange read GetSelectedRange write SetSelectedRange;
/// <summary>
/// Returns the current cursor position.
/// </summary>
property CursorPosition : NativeUInt read GetCursorPosition;
/// <summary>
/// Returns the text color.
/// </summary>
property TextColor : TCefColor read GetTextColor write SetTextColor; property TextColor : TCefColor read GetTextColor write SetTextColor;
/// <summary>
/// Returns the selection text color.
/// </summary>
property SelectionTextColor : TCefColor read GetSelectionTextColor write SetSelectionTextColor; property SelectionTextColor : TCefColor read GetSelectionTextColor write SetSelectionTextColor;
/// <summary>
/// Returns the selection background color.
/// </summary>
property SelectionBackgroundColor : TCefColor read GetSelectionBackgroundColor write SetSelectionBackgroundColor; property SelectionBackgroundColor : TCefColor read GetSelectionBackgroundColor write SetSelectionBackgroundColor;
/// <summary>
/// Returns the placeholder text that will be displayed when the Textfield is
/// NULL.
/// </summary>
property PlaceholderText : ustring read GetPlaceholderText write SetPlaceholderText; property PlaceholderText : ustring read GetPlaceholderText write SetPlaceholderText;
/// <summary>
/// Returns true (1) if there is any selected text.
/// </summary>
property HasSelection : boolean read GetHasSelection; property HasSelection : boolean read GetHasSelection;
published published
/// <summary>
/// Called when |textfield| recieves a keyboard event. |event| contains
/// information about the keyboard event. Return true (1) if the keyboard
/// event was handled or false (0) otherwise for default handling.
/// </summary>
property OnTextfieldKeyEvent : TOnTextfieldKeyEventEvent read FOnTextfieldKeyEvent write FOnTextfieldKeyEvent; property OnTextfieldKeyEvent : TOnTextfieldKeyEventEvent read FOnTextfieldKeyEvent write FOnTextfieldKeyEvent;
/// <summary>
/// Called after performing a user action that may change |textfield|.
/// </summary>
property OnAfterUserAction : TOnAfterUserActionEvent read FOnAfterUserAction write FOnAfterUserAction; property OnAfterUserAction : TOnAfterUserActionEvent read FOnAfterUserAction write FOnAfterUserAction;
end; end;
@ -345,7 +447,7 @@ begin
FTextfield.ClearSelection; FTextfield.ClearSelection;
end; end;
procedure TCEFTextfieldComponent.SelectRange(const range: TCefRange); procedure TCEFTextfieldComponent.SetSelectedRange(const range: TCefRange);
begin begin
if Initialized then if Initialized then
FTextfield.SelectRange(range); FTextfield.SelectRange(range);

View File

@ -26,20 +26,45 @@ type
procedure OnAfterUserAction(const textfield: ICefTextfield); procedure OnAfterUserAction(const textfield: ICefTextfield);
public public
/// <summary>
/// Returns a ICefTextfieldDelegate instance using a PCefTextfieldDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefTextfieldDelegate; class function UnWrap(data: Pointer): ICefTextfieldDelegate;
end; end;
/// <summary>
/// Implement this interface to handle Textfield events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_textfield_delegate_capi.h">CEF source file: /include/capi/views/cef_textfield_delegate_capi.h (cef_textfield_delegate_t)</see></para>
/// </remarks>
TCefTextfieldDelegateOwn = class(TCefViewDelegateOwn, ICefTextfieldDelegate) TCefTextfieldDelegateOwn = class(TCefViewDelegateOwn, ICefTextfieldDelegate)
protected protected
/// <summary>
/// Called when |textfield| recieves a keyboard event. |event| contains
/// information about the keyboard event. Return true (1) if the keyboard
/// event was handled or false (0) otherwise for default handling.
/// </summary>
procedure OnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent; var aResult : boolean); virtual; procedure OnKeyEvent(const textfield: ICefTextfield; const event: TCefKeyEvent; var aResult : boolean); virtual;
/// <summary>
/// Called after performing a user action that may change |textfield|.
/// </summary>
procedure OnAfterUserAction(const textfield: ICefTextfield); virtual; procedure OnAfterUserAction(const textfield: ICefTextfield); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; override; procedure InitializeCEFMethods; override;
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the ICefTextfieldDelegate and ICefViewDelegate methods which call the ICefTextfieldDelegateEvents methods.
/// ICefTextfieldDelegateEvents will be implemented by the control receiving the ICefTextfieldDelegate events.
/// </summary>
TCustomTextfieldDelegate = class(TCefTextfieldDelegateOwn) TCustomTextfieldDelegate = class(TCefTextfieldDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -61,6 +86,9 @@ type
procedure OnAfterUserAction(const textfield: ICefTextfield); override; procedure OnAfterUserAction(const textfield: ICefTextfield); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefTextfieldDelegateEvents); reintroduce; constructor Create(const events: ICefTextfieldDelegateEvents); reintroduce;
end; end;

View File

@ -1,9 +1,9 @@
CEF_SUPPORTED_VERSION_MAJOR = 117; CEF_SUPPORTED_VERSION_MAJOR = 117;
CEF_SUPPORTED_VERSION_MINOR = 1; CEF_SUPPORTED_VERSION_MINOR = 1;
CEF_SUPPORTED_VERSION_RELEASE = 4; CEF_SUPPORTED_VERSION_RELEASE = 5;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR;
CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 5938; CEF_CHROMEELF_VERSION_RELEASE = 5938;
CEF_CHROMEELF_VERSION_BUILD = 92; CEF_CHROMEELF_VERSION_BUILD = 132;

View File

@ -20,60 +20,289 @@ uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type type
/// <summary>
/// A View is a rectangle within the views View hierarchy. It is the base
/// interface for all Views. All size and position values are in density
/// independent pixels (DIP) unless otherwise indicated. Methods must be called
/// on the browser process UI thread unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_view_capi.h">CEF source file: /include/capi/views/cef_view_capi.h (cef_view_t)</see></para>
/// </remarks>
TCefViewRef = class(TCefBaseRefCountedRef, ICefView) TCefViewRef = class(TCefBaseRefCountedRef, ICefView)
protected protected
/// <summary>
/// Returns this View as a BrowserView or NULL if this is not a BrowserView.
/// </summary>
function AsBrowserView : ICefBrowserView; function AsBrowserView : ICefBrowserView;
/// <summary>
/// Returns this View as a Button or NULL if this is not a Button.
/// </summary>
function AsButton : ICefButton; function AsButton : ICefButton;
/// <summary>
/// Returns this View as a Panel or NULL if this is not a Panel.
/// </summary>
function AsPanel : ICefPanel; function AsPanel : ICefPanel;
/// <summary>
/// Returns this View as a ScrollView or NULL if this is not a ScrollView.
/// </summary>
function AsScrollView : ICefScrollView; function AsScrollView : ICefScrollView;
/// <summary>
/// Returns this View as a Textfield or NULL if this is not a Textfield.
/// </summary>
function AsTextfield : ICefTextfield; function AsTextfield : ICefTextfield;
/// <summary>
/// Returns the type of this View as a string. Used primarily for testing
/// purposes.
/// </summary>
function GetTypeString : ustring; function GetTypeString : ustring;
/// <summary>
/// Returns a string representation of this View which includes the type and
/// various type-specific identifying attributes. If |include_children| is
/// true (1) any child Views will also be included. Used primarily for testing
/// purposes.
/// </summary>
function ToStringEx(include_children: boolean): ustring; function ToStringEx(include_children: boolean): ustring;
/// <summary>
/// Returns true (1) if this View is valid.
/// </summary>
function IsValid : boolean; function IsValid : boolean;
/// <summary>
/// Returns true (1) if this View is currently attached to another View. A
/// View can only be attached to one View at a time.
/// </summary>
function IsAttached : boolean; function IsAttached : boolean;
/// <summary>
/// Returns true (1) if this View is the same as |that| View.
/// </summary>
function IsSame(const that: ICefView): boolean; function IsSame(const that: ICefView): boolean;
/// <summary>
/// Returns the delegate associated with this View, if any.
/// </summary>
function GetDelegate : ICefViewDelegate; function GetDelegate : ICefViewDelegate;
/// <summary>
/// Returns the top-level Window hosting this View, if any.
/// </summary>
function GetWindow : ICefWindow; function GetWindow : ICefWindow;
/// <summary>
/// Returns the ID for this View.
/// </summary>
function GetID : Integer; function GetID : Integer;
/// <summary>
/// Sets the ID for this View. ID should be unique within the subtree that you
/// intend to search for it. 0 is the default ID for views.
/// </summary>
procedure SetID(id_: Integer); procedure SetID(id_: Integer);
/// <summary>
/// Returns the group id of this View, or -1 if not set.
/// </summary>
function GetGroupID : Integer; function GetGroupID : Integer;
/// <summary>
/// A group id is used to tag Views which are part of the same logical group.
/// Focus can be moved between views with the same group using the arrow keys.
/// The group id is immutable once it's set.
/// </summary>
procedure SetGroupID(group_id: Integer); procedure SetGroupID(group_id: Integer);
/// <summary>
/// Returns the View that contains this View, if any.
/// </summary>
function GetParentView : ICefView; function GetParentView : ICefView;
/// <summary>
/// Recursively descends the view tree starting at this View, and returns the
/// first child that it encounters with the given ID. Returns NULL if no
/// matching child view is found.
/// </summary>
function GetViewForID(id_: Integer): ICefView; function GetViewForID(id_: Integer): ICefView;
/// <summary>
/// Sets the bounds (size and position) of this View. |bounds| is in parent
/// coordinates, or DIP screen coordinates if there is no parent.
/// </summary>
procedure SetBounds(const bounds_: TCefRect); procedure SetBounds(const bounds_: TCefRect);
/// <summary>
/// Returns the bounds (size and position) of this View in parent coordinates,
/// or DIP screen coordinates if there is no parent.
/// </summary>
function GetBounds : TCefRect; function GetBounds : TCefRect;
/// <summary>
/// Returns the bounds (size and position) of this View in DIP screen
/// coordinates.
/// </summary>
function GetBoundsInScreen : TCefRect; function GetBoundsInScreen : TCefRect;
/// <summary>
/// Sets the size of this View without changing the position. |size| in parent
/// coordinates, or DIP screen coordinates if there is no parent.
/// </summary>
procedure SetSize(const size_: TCefSize); procedure SetSize(const size_: TCefSize);
/// <summary>
/// Returns the size of this View in parent coordinates, or DIP screen
/// coordinates if there is no parent.
/// </summary>
function GetSize : TCefSize; function GetSize : TCefSize;
/// <summary>
/// Sets the position of this View without changing the size. |position| is in
/// parent coordinates, or DIP screen coordinates if there is no parent.
/// </summary>
procedure SetPosition(const position_: TCefPoint); procedure SetPosition(const position_: TCefPoint);
/// <summary>
/// Returns the position of this View. Position is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
function GetPosition : TCefPoint; function GetPosition : TCefPoint;
/// <summary>
/// Sets the insets for this View. |insets| is in parent coordinates, or DIP
/// screen coordinates if there is no parent.
/// </summary>
procedure SetInsets(const insets: TCefInsets); procedure SetInsets(const insets: TCefInsets);
/// <summary>
/// Returns the insets for this View in parent coordinates, or DIP screen
/// coordinates if there is no parent.
/// </summary>
function GetInsets: TCefInsets; function GetInsets: TCefInsets;
/// <summary>
/// Returns the size this View would like to be if enough space is available.
/// Size is in parent coordinates, or DIP screen coordinates if there is no
/// parent.
/// </summary>
function GetPreferredSize : TCefSize; function GetPreferredSize : TCefSize;
/// <summary>
/// Size this View to its preferred size. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
procedure SizeToPreferredSize; procedure SizeToPreferredSize;
/// <summary>
/// Returns the minimum size for this View. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
function GetMinimumSize : TCefSize; function GetMinimumSize : TCefSize;
/// <summary>
/// Returns the maximum size for this View. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
function GetMaximumSize : TCefSize; function GetMaximumSize : TCefSize;
/// <summary>
/// Returns the height necessary to display this View with the provided width.
/// </summary>
function GetHeightForWidth(width: Integer): Integer; function GetHeightForWidth(width: Integer): Integer;
/// <summary>
/// Indicate that this View and all parent Views require a re-layout. This
/// ensures the next call to layout() will propagate to this View even if the
/// bounds of parent Views do not change.
/// </summary>
procedure InvalidateLayout; procedure InvalidateLayout;
/// <summary>
/// Sets whether this View is visible. Windows are hidden by default and other
/// views are visible by default. This View and any parent views must be set
/// as visible for this View to be drawn in a Window. If this View is set as
/// hidden then it and any child views will not be drawn and, if any of those
/// views currently have focus, then focus will also be cleared. Painting is
/// scheduled as needed. If this View is a Window then calling this function
/// is equivalent to calling the Window show() and hide() functions.
/// </summary>
procedure SetVisible(visible_: boolean); procedure SetVisible(visible_: boolean);
/// <summary>
/// Returns whether this View is visible. A view may be visible but still not
/// drawn in a Window if any parent views are hidden. If this View is a Window
/// then a return value of true (1) indicates that this Window is currently
/// visible to the user on-screen. If this View is not a Window then call
/// is_drawn() to determine whether this View and all parent views are visible
/// and will be drawn.
/// </summary>
function IsVisible : boolean; function IsVisible : boolean;
/// <summary>
/// Returns whether this View is visible and drawn in a Window. A view is
/// drawn if it and all parent views are visible. If this View is a Window
/// then calling this function is equivalent to calling is_visible().
/// Otherwise, to determine if the containing Window is visible to the user
/// on-screen call is_visible() on the Window.
/// </summary>
function IsDrawn : boolean; function IsDrawn : boolean;
/// <summary>
/// Set whether this View is enabled. A disabled View does not receive
/// keyboard or mouse inputs. If |enabled| differs from the current value the
/// View will be repainted. Also, clears focus if the focused View is
/// disabled.
/// </summary>
procedure SetEnabled(enabled_: boolean); procedure SetEnabled(enabled_: boolean);
/// <summary>
/// Returns whether this View is enabled.
/// </summary>
function IsEnabled : boolean; function IsEnabled : boolean;
/// <summary>
/// Sets whether this View is capable of taking focus. It will clear focus if
/// the focused View is set to be non-focusable. This is false (0) by default
/// so that a View used as a container does not get the focus.
/// </summary>
procedure SetFocusable(focusable_: boolean); procedure SetFocusable(focusable_: boolean);
/// <summary>
/// Returns true (1) if this View is focusable, enabled and drawn.
/// </summary>
function IsFocusable : boolean; function IsFocusable : boolean;
/// <summary>
/// Return whether this View is focusable when the user requires full keyboard
/// access, even though it may not be normally focusable.
/// </summary>
function IsAccessibilityFocusable : boolean; function IsAccessibilityFocusable : boolean;
/// <summary>
/// Request keyboard focus. If this View is focusable it will become the
/// focused View.
/// </summary>
procedure RequestFocus; procedure RequestFocus;
/// <summary>
/// Sets the background color for this View.
/// </summary>
procedure SetBackgroundColor(color: TCefColor); procedure SetBackgroundColor(color: TCefColor);
/// <summary>
/// Returns the background color for this View.
/// </summary>
function GetBackgroundColor : TCefColor; function GetBackgroundColor : TCefColor;
/// <summary>
/// Convert |point| from this View's coordinate system to DIP screen
/// coordinates. This View must belong to a Window when calling this function.
/// Returns true (1) if the conversion is successful or false (0) otherwise.
/// Use ICefDisplay.ConvertPointToPixels() after calling this function
/// if further conversion to display-specific pixel coordinates is desired.
/// </summary>
function ConvertPointToScreen(var point: TCefPoint): boolean; function ConvertPointToScreen(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from DIP screen
/// coordinates. This View must belong to a Window when calling this function.
/// Returns true (1) if the conversion is successful or false (0) otherwise.
/// Use ICefDisplay.ConvertPointFromPixels() before calling this
/// function if conversion from display-specific pixel coordinates is
/// necessary.
/// </summary>
function ConvertPointFromScreen(var point: TCefPoint): boolean; function ConvertPointFromScreen(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| from this View's coordinate system to that of the Window.
/// This View must belong to a Window when calling this function. Returns true
/// (1) if the conversion is successful or false (0) otherwise.
/// </summary>
function ConvertPointToWindow(var point: TCefPoint): boolean; function ConvertPointToWindow(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from that of the Window.
/// This View must belong to a Window when calling this function. Returns true
/// (1) if the conversion is successful or false (0) otherwise.
/// </summary>
function ConvertPointFromWindow(var point: TCefPoint): boolean; function ConvertPointFromWindow(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| from this View's coordinate system to that of |view|.
/// |view| needs to be in the same Window but not necessarily the same view
/// hierarchy. Returns true (1) if the conversion is successful or false (0)
/// otherwise.
/// </summary>
function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean; function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from that |view|. |view|
/// needs to be in the same Window but not necessarily the same view
/// hierarchy. Returns true (1) if the conversion is successful or false (0)
/// otherwise.
/// </summary>
function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean; function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean;
public public
/// <summary>
/// Returns a ICefView instance using a PCefView data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefView; class function UnWrap(data: Pointer): ICefView;
end; end;

View File

@ -71,6 +71,7 @@ type
function GetBackgroundColor : TCefColor; function GetBackgroundColor : TCefColor;
function GetViewForID(id_: Integer): ICefView; function GetViewForID(id_: Integer): ICefView;
function GetHeightForWidth(width: Integer): Integer; function GetHeightForWidth(width: Integer): Integer;
function GetInsets: TCefInsets;
procedure SetID(id_: Integer); procedure SetID(id_: Integer);
procedure SetGroupID(group_id: Integer); procedure SetGroupID(group_id: Integer);
@ -81,6 +82,7 @@ type
procedure SetEnabled(enabled_: boolean); procedure SetEnabled(enabled_: boolean);
procedure SetFocusable(focusable_: boolean); procedure SetFocusable(focusable_: boolean);
procedure SetBackgroundColor(color: TCefColor); procedure SetBackgroundColor(color: TCefColor);
procedure SetInsets(const insets: TCefInsets);
// ICefViewDelegateEvents // ICefViewDelegateEvents
procedure doOnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual; procedure doOnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual;
@ -98,61 +100,283 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure BeforeDestruction; override; procedure BeforeDestruction; override;
/// <summary>
/// Returns a string representation of this View which includes the type and
/// various type-specific identifying attributes. If |include_children| is
/// true (1) any child Views will also be included. Used primarily for testing
/// purposes.
/// </summary>
function ToStringEx(include_children: boolean): ustring; function ToStringEx(include_children: boolean): ustring;
/// <summary>
/// Returns true (1) if this View is the same as |that| View.
/// </summary>
function IsSame(const that: ICefView): boolean; function IsSame(const that: ICefView): boolean;
/// <summary>
/// Size this View to its preferred size. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
procedure SizeToPreferredSize; procedure SizeToPreferredSize;
/// <summary>
/// Indicate that this View and all parent Views require a re-layout. This
/// ensures the next call to layout() will propagate to this View even if the
/// bounds of parent Views do not change.
/// </summary>
procedure InvalidateLayout; procedure InvalidateLayout;
/// <summary>
/// Request keyboard focus. If this View is focusable it will become the
/// focused View.
/// </summary>
procedure RequestFocus; procedure RequestFocus;
/// <summary>
/// Convert |point| from this View's coordinate system to DIP screen
/// coordinates. This View must belong to a Window when calling this function.
/// Returns true (1) if the conversion is successful or false (0) otherwise.
/// Use ICefDisplay.ConvertPointToPixels() after calling this function
/// if further conversion to display-specific pixel coordinates is desired.
/// </summary>
function ConvertPointToScreen(var point: TCefPoint): boolean; function ConvertPointToScreen(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from DIP screen
/// coordinates. This View must belong to a Window when calling this function.
/// Returns true (1) if the conversion is successful or false (0) otherwise.
/// Use ICefDisplay.ConvertPointFromPixels() before calling this
/// function if conversion from display-specific pixel coordinates is
/// necessary.
/// </summary>
function ConvertPointFromScreen(var point: TCefPoint): boolean; function ConvertPointFromScreen(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| from this View's coordinate system to that of the Window.
/// This View must belong to a Window when calling this function. Returns true
/// (1) if the conversion is successful or false (0) otherwise.
/// </summary>
function ConvertPointToWindow(var point: TCefPoint): boolean; function ConvertPointToWindow(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from that of the Window.
/// This View must belong to a Window when calling this function. Returns true
/// (1) if the conversion is successful or false (0) otherwise.
/// </summary>
function ConvertPointFromWindow(var point: TCefPoint): boolean; function ConvertPointFromWindow(var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| from this View's coordinate system to that of |view|.
/// |view| needs to be in the same Window but not necessarily the same view
/// hierarchy. Returns true (1) if the conversion is successful or false (0)
/// otherwise.
/// </summary>
function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean; function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean;
/// <summary>
/// Convert |point| to this View's coordinate system from that |view|. |view|
/// needs to be in the same Window but not necessarily the same view
/// hierarchy. Returns true (1) if the conversion is successful or false (0)
/// otherwise.
/// </summary>
function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean; function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean;
/// <summary>
/// Returns true when the control is fully initialized.
/// </summary>
property Initialized : boolean read GetInitialized; property Initialized : boolean read GetInitialized;
/// <summary>
/// Returns this control as a View.
/// </summary>
property AsView : ICefView read GetAsView; property AsView : ICefView read GetAsView;
/// <summary>
/// Returns this View as a BrowserView or NULL if this is not a BrowserView.
/// </summary>
property AsBrowserView : ICefBrowserView read GetAsBrowserView; property AsBrowserView : ICefBrowserView read GetAsBrowserView;
/// <summary>
/// Returns this View as a Button or NULL if this is not a Button.
/// </summary>
property AsButton : ICefButton read GetAsButton; property AsButton : ICefButton read GetAsButton;
/// <summary>
/// Returns this View as a Panel or NULL if this is not a Panel.
/// </summary>
property AsPanel : ICefPanel read GetAsPanel; property AsPanel : ICefPanel read GetAsPanel;
/// <summary>
/// Returns this View as a ScrollView or NULL if this is not a ScrollView.
/// </summary>
property AsScrollView : ICefScrollView read GetAsScrollView; property AsScrollView : ICefScrollView read GetAsScrollView;
/// <summary>
/// Returns this View as a Textfield or NULL if this is not a Textfield.
/// </summary>
property AsTextfield : ICefTextfield read GetAsTextfield; property AsTextfield : ICefTextfield read GetAsTextfield;
/// <summary>
/// Recursively descends the view tree starting at this View, and returns the
/// first child that it encounters with the given ID. Returns NULL if no
/// matching child view is found.
/// </summary>
property ViewForID[id_: Integer] : ICefView read GetViewForID; property ViewForID[id_: Integer] : ICefView read GetViewForID;
/// <summary>
/// Returns true (1) if this View is valid.
/// </summary>
property Valid : boolean read GetIsValid; property Valid : boolean read GetIsValid;
/// <summary>
/// Returns true (1) if this View is currently attached to another View. A
/// View can only be attached to one View at a time.
/// </summary>
property Attached : boolean read GetIsAttached; property Attached : boolean read GetIsAttached;
/// <summary>
/// Returns the delegate associated with this View, if any.
/// </summary>
property Delegate : ICefViewDelegate read GetDelegate; property Delegate : ICefViewDelegate read GetDelegate;
/// <summary>
/// Returns the top-level Window hosting this View, if any.
/// </summary>
property Window : ICefWindow read GetWindow; property Window : ICefWindow read GetWindow;
/// <summary>
/// Returns the View that contains this View, if any.
/// </summary>
property ParentView : ICefView read GetParentView; property ParentView : ICefView read GetParentView;
/// <summary>
/// Returns the bounds (size and position) of this View in DIP screen
/// coordinates.
/// </summary>
property BoundsInScreen : TCefRect read GetBoundsInScreen; property BoundsInScreen : TCefRect read GetBoundsInScreen;
/// <summary>
/// Returns the size this View would like to be if enough space is available.
/// Size is in parent coordinates, or DIP screen coordinates if there is no
/// parent.
/// </summary>
property PreferredSize : TCefSize read GetPreferredSize; property PreferredSize : TCefSize read GetPreferredSize;
/// <summary>
/// Returns the minimum size for this View. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
property MinimumSize : TCefSize read GetMinimumSize; property MinimumSize : TCefSize read GetMinimumSize;
/// <summary>
/// Returns the maximum size for this View. Size is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
property MaximumSize : TCefSize read GetMaximumSize; property MaximumSize : TCefSize read GetMaximumSize;
/// <summary>
/// Returns whether this View is visible. A view may be visible but still not
/// drawn in a Window if any parent views are hidden. If this View is a Window
/// then a return value of true (1) indicates that this Window is currently
/// visible to the user on-screen. If this View is not a Window then call
/// is_drawn() to determine whether this View and all parent views are visible
/// and will be drawn.
/// </summary>
property Visible : boolean read GetIsVisible write SetVisible; property Visible : boolean read GetIsVisible write SetVisible;
/// <summary>
/// Returns whether this View is visible and drawn in a Window. A view is
/// drawn if it and all parent views are visible. If this View is a Window
/// then calling this function is equivalent to calling is_visible().
/// Otherwise, to determine if the containing Window is visible to the user
/// on-screen call is_visible() on the Window.
/// </summary>
property Drawn : boolean read GetIsDrawn; property Drawn : boolean read GetIsDrawn;
/// <summary>
/// Get or set whether this View is enabled. A disabled View does not receive
/// keyboard or mouse inputs. If |enabled| differs from the current value the
/// View will be repainted. Also, clears focus if the focused View is
/// disabled.
/// </summary>
property Enabled : boolean read GetIsEnabled write SetEnabled; property Enabled : boolean read GetIsEnabled write SetEnabled;
/// <summary>
/// Gets and sets whether this View is capable of taking focus. It will clear focus if
/// the focused View is set to be non-focusable. This is false (0) by default
/// so that a View used as a container does not get the focus.
/// </summary>
property Focusable : boolean read GetIsFocusable write SetFocusable; property Focusable : boolean read GetIsFocusable write SetFocusable;
/// <summary>
/// Return whether this View is focusable when the user requires full keyboard
/// access, even though it may not be normally focusable.
/// </summary>
property AccessibilityFocusable : boolean read GetIsAccessibilityFocusable; property AccessibilityFocusable : boolean read GetIsAccessibilityFocusable;
/// <summary>
/// Returns the background color for this View.
/// </summary>
property BackgroundColor : TCefColor read GetBackgroundColor write SetBackgroundColor; property BackgroundColor : TCefColor read GetBackgroundColor write SetBackgroundColor;
/// <summary>
/// Gets or sets the ID for this View. ID should be unique within the subtree that you
/// intend to search for it. 0 is the default ID for views.
/// </summary>
property ID : integer read GetID write SetID; property ID : integer read GetID write SetID;
/// <summary>
/// Returns the group id of this View, or -1 if not set.
/// </summary>
property GroupID : integer read GetGroupID write SetGroupID; property GroupID : integer read GetGroupID write SetGroupID;
/// <summary>
/// Returns the bounds (size and position) of this View in parent coordinates,
/// or DIP screen coordinates if there is no parent.
/// </summary>
property Bounds : TCefRect read GetBounds write SetBounds; property Bounds : TCefRect read GetBounds write SetBounds;
/// <summary>
/// Returns the size of this View in parent coordinates, or DIP screen
/// coordinates if there is no parent.
/// </summary>
property Size : TCefSize read GetSize write SetSize; property Size : TCefSize read GetSize write SetSize;
/// <summary>
/// Returns the position of this View. Position is in parent coordinates, or
/// DIP screen coordinates if there is no parent.
/// </summary>
property Position : TCefPoint read GetPosition write SetPosition; property Position : TCefPoint read GetPosition write SetPosition;
/// <summary>
/// Returns the insets for this View in parent coordinates, or DIP screen
/// coordinates if there is no parent.
/// </summary>
property Insets : TCefInsets read GetInsets write SetInsets;
/// <summary>
/// Returns the type of this View as a string. Used primarily for testing
/// purposes.
/// </summary>
property TypeString : ustring read GetTypeString; property TypeString : ustring read GetTypeString;
/// <summary>
/// Returns the height necessary to display this View with the provided width.
/// </summary>
property HeightForWidth[width: Integer] : Integer read GetHeightForWidth; property HeightForWidth[width: Integer] : Integer read GetHeightForWidth;
published published
/// <summary>
/// Return the preferred size for |view|. The Layout will use this information
/// to determine the display size.
/// </summary>
property OnGetPreferredSize : TOnGetPreferredSizeEvent read FOnGetPreferredSize write FOnGetPreferredSize; property OnGetPreferredSize : TOnGetPreferredSizeEvent read FOnGetPreferredSize write FOnGetPreferredSize;
/// <summary>
/// Return the minimum size for |view|.
/// </summary>
property OnGetMinimumSize : TOnGetMinimumSizeEvent read FOnGetMinimumSize write FOnGetMinimumSize; property OnGetMinimumSize : TOnGetMinimumSizeEvent read FOnGetMinimumSize write FOnGetMinimumSize;
/// <summary>
/// Return the maximum size for |view|.
/// </summary>
property OnGetMaximumSize : TOnGetMaximumSizeEvent read FOnGetMaximumSize write FOnGetMaximumSize; property OnGetMaximumSize : TOnGetMaximumSizeEvent read FOnGetMaximumSize write FOnGetMaximumSize;
/// <summary>
/// Return the height necessary to display |view| with the provided |width|.
/// If not specified the result of get_preferred_size().height will be used by
/// default. Override if |view|'s preferred height depends upon the width (for
/// example, with Labels).
/// </summary>
property OnGetHeightForWidth : TOnGetHeightForWidthEvent read FOnGetHeightForWidth write FOnGetHeightForWidth; property OnGetHeightForWidth : TOnGetHeightForWidthEvent read FOnGetHeightForWidth write FOnGetHeightForWidth;
/// <summary>
/// Called when the parent of |view| has changed. If |view| is being added to
/// |parent| then |added| will be true (1). If |view| is being removed from
/// |parent| then |added| will be false (0). If |view| is being reparented the
/// remove notification will be sent before the add notification. Do not
/// modify the view hierarchy in this callback.
/// </summary>
property OnParentViewChanged : TOnParentViewChangedEvent read FOnParentViewChanged write FOnParentViewChanged; property OnParentViewChanged : TOnParentViewChangedEvent read FOnParentViewChanged write FOnParentViewChanged;
/// <summary>
/// Called when a child of |view| has changed. If |child| is being added to
/// |view| then |added| will be true (1). If |child| is being removed from
/// |view| then |added| will be false (0). If |child| is being reparented the
/// remove notification will be sent to the old parent before the add
/// notification is sent to the new parent. Do not modify the view hierarchy
/// in this callback.
/// </summary>
property OnChildViewChanged : TOnChildViewChangedEvent read FOnChildViewChanged write FOnChildViewChanged; property OnChildViewChanged : TOnChildViewChangedEvent read FOnChildViewChanged write FOnChildViewChanged;
/// <summary>
/// Called when |view| is added or removed from the ICefWindow.
/// </summary>
property OnWindowChanged : TOnWindowChangedEvent read FOnWindowChanged write FOnWindowChanged; property OnWindowChanged : TOnWindowChangedEvent read FOnWindowChanged write FOnWindowChanged;
/// <summary>
/// Called when the layout of |view| has changed.
/// </summary>
property OnLayoutChanged : TOnLayoutChangedEvent read FOnLayoutChanged write FOnLayoutChanged; property OnLayoutChanged : TOnLayoutChangedEvent read FOnLayoutChanged write FOnLayoutChanged;
/// <summary>
/// Called when |view| gains focus.
/// </summary>
property OnFocus : TOnFocusEvent read FOnFocus write FOnFocus; property OnFocus : TOnFocusEvent read FOnFocus write FOnFocus;
/// <summary>
/// Called when |view| loses focus.
/// </summary>
property OnBlur : TOnBlurEvent read FOnBlur write FOnBlur; property OnBlur : TOnBlurEvent read FOnBlur write FOnBlur;
end; end;
@ -521,6 +745,19 @@ begin
Result := 0; Result := 0;
end; end;
function TCEFViewComponent.GetInsets: TCefInsets;
begin
if Initialized then
Result := AsView.GetInsets
else
begin
Result.top := 0;
Result.left := 0;
Result.bottom := 0;
Result.right := 0;
end;
end;
procedure TCEFViewComponent.InvalidateLayout; procedure TCEFViewComponent.InvalidateLayout;
begin begin
if Initialized then if Initialized then
@ -582,6 +819,12 @@ begin
AsView.SetBackgroundColor(color); AsView.SetBackgroundColor(color);
end; end;
procedure TCEFViewComponent.SetInsets(const insets: TCefInsets);
begin
if Initialized then
AsView.SetInsets(insets);
end;
function TCEFViewComponent.GetBackgroundColor : TCefColor; function TCEFViewComponent.GetBackgroundColor : TCefColor;
begin begin
if Initialized then if Initialized then

View File

@ -34,27 +34,88 @@ type
procedure OnBlur(const view: ICefView); procedure OnBlur(const view: ICefView);
public public
/// <summary>
/// Returns a ICefViewDelegate instance using a PCefViewDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefViewDelegate; class function UnWrap(data: Pointer): ICefViewDelegate;
end; end;
/// <summary>
/// Implement this interface to handle view events. All size and position values
/// are in density independent pixels (DIP) unless otherwise indicated. The
/// functions of this interface will be called on the browser process UI thread
/// unless otherwise indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_view_delegate_capi.h">CEF source file: /include/capi/views/cef_view_delegate_capi.h (cef_view_delegate_t)</see></para>
/// </remarks>
TCefViewDelegateOwn = class(TCefBaseRefCountedOwn, ICefViewDelegate) TCefViewDelegateOwn = class(TCefBaseRefCountedOwn, ICefViewDelegate)
protected protected
/// <summary>
/// Return the preferred size for |view|. The Layout will use this information
/// to determine the display size.
/// </summary>
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual; procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual;
/// <summary>
/// Return the minimum size for |view|.
/// </summary>
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize); virtual; procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize); virtual;
/// <summary>
/// Return the maximum size for |view|.
/// </summary>
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize); virtual; procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize); virtual;
/// <summary>
/// Return the height necessary to display |view| with the provided |width|.
/// If not specified the result of get_preferred_size().height will be used by
/// default. Override if |view|'s preferred height depends upon the width (for
/// example, with Labels).
/// </summary>
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual; procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual;
/// <summary>
/// Called when the parent of |view| has changed. If |view| is being added to
/// |parent| then |added| will be true (1). If |view| is being removed from
/// |parent| then |added| will be false (0). If |view| is being reparented the
/// remove notification will be sent before the add notification. Do not
/// modify the view hierarchy in this callback.
/// </summary>
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual; procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual;
/// <summary>
/// Called when a child of |view| has changed. If |child| is being added to
/// |view| then |added| will be true (1). If |child| is being removed from
/// |view| then |added| will be false (0). If |child| is being reparented the
/// remove notification will be sent to the old parent before the add
/// notification is sent to the new parent. Do not modify the view hierarchy
/// in this callback.
/// </summary>
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual; procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual;
/// <summary>
/// Called when |view| is added or removed from the ICefWindow.
/// </summary>
procedure OnWindowChanged(const view: ICefView; added: boolean); virtual; procedure OnWindowChanged(const view: ICefView; added: boolean); virtual;
/// <summary>
/// Called when the layout of |view| has changed.
/// </summary>
procedure OnLayoutChanged(const view: ICefView; new_bounds: TCefRect); virtual; procedure OnLayoutChanged(const view: ICefView; new_bounds: TCefRect); virtual;
/// <summary>
/// Called when |view| gains focus.
/// </summary>
procedure OnFocus(const view: ICefView); virtual; procedure OnFocus(const view: ICefView); virtual;
/// <summary>
/// Called when |view| loses focus.
/// </summary>
procedure OnBlur(const view: ICefView); virtual; procedure OnBlur(const view: ICefView); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; virtual; procedure InitializeCEFMethods; virtual;
public public
constructor Create; virtual; constructor Create; virtual;
end; end;
/// <summary>
/// This class handles all the ICefViewDelegate methods which call the ICefViewDelegateEvents methods.
/// ICefViewDelegateEvents will be implemented by the control receiving the ICefViewDelegate events.
/// </summary>
TCustomViewDelegate = class(TCefViewDelegateOwn) TCustomViewDelegate = class(TCefViewDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -71,6 +132,9 @@ type
procedure OnBlur(const view: ICefView); override; procedure OnBlur(const view: ICefView); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefViewDelegateEvents); reintroduce; constructor Create(const events: ICefViewDelegateEvents); reintroduce;
destructor Destroy; override; destructor Destroy; override;
end; end;

View File

@ -282,7 +282,13 @@ type
procedure RemoveAllAccelerators; procedure RemoveAllAccelerators;
public public
/// <summary>
/// Returns a ICefWindow instance using a PCefWindow data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefWindow; class function UnWrap(data: Pointer): ICefWindow;
/// <summary>
/// Create a new Window.
/// </summary>
class function CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow; class function CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow;
end; end;

View File

@ -101,60 +101,313 @@ type
procedure doCreateCustomView; override; procedure doCreateCustomView; override;
public public
/// <summary>
/// Create a new Window.
/// </summary>
procedure CreateTopLevelWindow; procedure CreateTopLevelWindow;
/// <summary>
/// Show the Window.
/// </summary>
procedure Show; procedure Show;
/// <summary>
/// Show the Window as a browser modal dialog relative to |browser_view|. A
/// parent Window must be returned via
/// cef_window_delegate_t::get_parent_window() and |browser_view| must belong
/// to that parent Window. While this Window is visible, |browser_view| will
/// be disabled while other controls in the parent Window remain enabled.
/// Navigating or destroying the |browser_view| will close this Window
/// automatically. Alternately, use show() and return true (1) from
/// cef_window_delegate_t::is_window_modal_dialog() for a window modal dialog
/// where all controls in the parent Window are disabled.
/// </summary>
procedure ShowAsBrowserModalDialog(const browser_view: ICefBrowserView);
/// <summary>
/// Hide the Window.
/// </summary>
procedure Hide; procedure Hide;
/// <summary>
/// Sizes the Window to |size| and centers it in the current display.
/// </summary>
procedure CenterWindow(const size_: TCefSize); procedure CenterWindow(const size_: TCefSize);
/// <summary>
/// Close the Window.
/// </summary>
procedure Close; procedure Close;
/// <summary>
/// Activate the Window, assuming it already exists and is visible.
/// </summary>
procedure Activate; procedure Activate;
/// <summary>
/// Deactivate the Window, making the next Window in the Z order the active
/// Window.
/// </summary>
procedure Deactivate; procedure Deactivate;
/// <summary>
/// Bring this Window to the top of other Windows in the Windowing system.
/// </summary>
procedure BringToTop; procedure BringToTop;
/// <summary>
/// Maximize the Window.
/// </summary>
procedure Maximize; procedure Maximize;
/// <summary>
/// Minimize the Window.
/// </summary>
procedure Minimize; procedure Minimize;
/// <summary>
/// Restore the Window.
/// </summary>
procedure Restore; procedure Restore;
/// <summary>
/// <para>Add a View that will be overlayed on the Window contents with absolute
/// positioning and high z-order. Positioning is controlled by |docking_mode|
/// as described below. The returned cef_overlay_controller_t object is used
/// to control the overlay. Overlays are hidden by default.</para>
/// <para>With CEF_DOCKING_MODE_CUSTOM:</para>
/// <code>
/// 1. The overlay is initially hidden, sized to |view|'s preferred size,
/// and positioned in the top-left corner.
/// 2. Optionally change the overlay position and/or size by calling
/// CefOverlayController methods.
/// 3. Call CefOverlayController::SetVisible(true) to show the overlay.
/// 4. The overlay will be automatically re-sized if |view|'s layout
/// changes. Optionally change the overlay position and/or size when
/// OnLayoutChanged is called on the Window's delegate to indicate a
/// change in Window bounds.</code>
/// <para>With other docking modes:</para>
/// <code>
/// 1. The overlay is initially hidden, sized to |view|'s preferred size,
/// and positioned based on |docking_mode|.
/// 2. Call CefOverlayController::SetVisible(true) to show the overlay.
/// 3. The overlay will be automatically re-sized if |view|'s layout changes
/// and re-positioned as appropriate when the Window resizes.</code>
/// <para>Overlays created by this function will receive a higher z-order then any
/// child Views added previously. It is therefore recommended to call this
/// function last after all other child Views have been added so that the
/// overlay displays as the top-most child of the Window.</para>
/// </summary>
function AddOverlayView(const view: ICefView; docking_mode: TCefDockingMode): ICefOverlayController; function AddOverlayView(const view: ICefView; docking_mode: TCefDockingMode): ICefOverlayController;
/// <summary>
/// Show a menu with contents |menu_model|. |screen_point| specifies the menu
/// position in screen coordinates. |anchor_position| specifies how the menu
/// will be anchored relative to |screen_point|.
/// </summary>
procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition); procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition);
/// <summary>
/// Cancel the menu that is currently showing, if any.
/// </summary>
procedure CancelMenu; procedure CancelMenu;
/// <summary>
/// Set the regions where mouse events will be intercepted by this Window to
/// support drag operations. Call this function with an NULL vector to clear
/// the draggable regions. The draggable region bounds should be in window
/// coordinates.
/// </summary>
procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray); procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);
/// <summary>
/// Simulate a key press. |key_code| is the VKEY_* value from Chromium's
/// ui/events/keycodes/keyboard_codes.h header (VK_* values on Windows).
/// |event_flags| is some combination of EVENTFLAG_SHIFT_DOWN,
/// EVENTFLAG_CONTROL_DOWN and/or EVENTFLAG_ALT_DOWN. This function is exposed
/// primarily for testing purposes.
/// </summary>
procedure SendKeyPress(key_code: Integer; event_flags: cardinal); procedure SendKeyPress(key_code: Integer; event_flags: cardinal);
/// <summary>
/// Simulate a mouse move. The mouse cursor will be moved to the specified
/// (screen_x, screen_y) position. This function is exposed primarily for
/// testing purposes.
/// </summary>
procedure SendMouseMove(screen_x, screen_y: Integer); procedure SendMouseMove(screen_x, screen_y: Integer);
/// <summary>
/// Simulate mouse down and/or mouse up events. |button| is the mouse button
/// type. If |mouse_down| is true (1) a mouse down event will be sent. If
/// |mouse_up| is true (1) a mouse up event will be sent. If both are true (1)
/// a mouse down event will be sent followed by a mouse up event (equivalent
/// to clicking the mouse button). The events will be sent using the current
/// cursor position so make sure to call send_mouse_move() first to position
/// the mouse. This function is exposed primarily for testing purposes.
/// </summary>
procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean); procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean);
/// <summary>
/// Set the keyboard accelerator for the specified |command_id|. |key_code|
/// can be any virtual key or character value.
/// cef_window_delegate_t::OnAccelerator will be called if the keyboard
/// combination is triggered while this window has focus.
/// </summary>
procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed: boolean); procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed: boolean);
/// <summary>
/// Remove the keyboard accelerator for the specified |command_id|.
/// </summary>
procedure RemoveAccelerator(command_id: Integer); procedure RemoveAccelerator(command_id: Integer);
/// <summary>
/// Remove all keyboard accelerators.
/// </summary>
procedure RemoveAllAccelerators; procedure RemoveAllAccelerators;
/// <summary>
/// Get the Window title.
/// </summary>
property Title : ustring read GetTitle write SetTitle; property Title : ustring read GetTitle write SetTitle;
/// <summary>
/// Get the Window icon.
/// </summary>
property WindowIcon : ICefImage read GetWindowIcon write SetWindowIcon; property WindowIcon : ICefImage read GetWindowIcon write SetWindowIcon;
/// <summary>
/// Get or set the Window App icon. This should be a larger icon for use in the host
/// environment app switching UI. On Windows, this is the ICON_BIG used in
/// Alt-Tab list and Windows taskbar. The Window icon will be used by default
/// if no Window App icon is specified.
/// </summary>
property WindowAppIcon : ICefImage read GetWindowAppIcon write SetWindowAppIcon; property WindowAppIcon : ICefImage read GetWindowAppIcon write SetWindowAppIcon;
/// <summary>
/// Returns the Display that most closely intersects the bounds of this
/// Window. May return NULL if this Window is not currently displayed.
/// </summary>
property Display : ICefDisplay read GetDisplay; property Display : ICefDisplay read GetDisplay;
/// <summary>
/// Returns the bounds (size and position) of this Window's client area.
/// Position is in screen coordinates.
/// </summary>
property ClientAreaBoundsInScreen : TCefRect read GetClientAreaBoundsInScreen; property ClientAreaBoundsInScreen : TCefRect read GetClientAreaBoundsInScreen;
/// <summary>
/// Retrieve the platform window handle for this Window.
/// </summary>
property WindowHandle : TCefWindowHandle read GetWindowHandle; property WindowHandle : TCefWindowHandle read GetWindowHandle;
/// <summary>
/// Returns true (1) if the Window has been closed.
/// </summary>
property IsClosed : boolean read GetIsClosed; property IsClosed : boolean read GetIsClosed;
/// <summary>
/// Returns whether the Window is the currently active Window.
/// </summary>
property IsActive : boolean read GetIsActive; property IsActive : boolean read GetIsActive;
/// <summary>
/// Returns whether the Window has been set to be on top of other Windows in
/// the Windowing system.
/// </summary>
property IsAlwaysOnTop : boolean read GetIsAlwaysOnTop write SetAlwaysOnTop; property IsAlwaysOnTop : boolean read GetIsAlwaysOnTop write SetAlwaysOnTop;
/// <summary>
/// Returns true (1) if the Window is fullscreen.
/// </summary>
property IsFullscreen : boolean read GetIsFullscreen write SetFullscreen; property IsFullscreen : boolean read GetIsFullscreen write SetFullscreen;
/// <summary>
/// Returns true (1) if the Window is maximized.
/// </summary>
property IsMaximized : boolean read GetIsMaximized; property IsMaximized : boolean read GetIsMaximized;
/// <summary>
/// Returns true (1) if the Window is minimized.
/// </summary>
property IsMinimized : boolean read GetIsMinimized; property IsMinimized : boolean read GetIsMinimized;
published published
/// <summary>
/// Called when |window| is created.
/// </summary>
property OnWindowCreated : TOnWindowCreatedEvent read FOnWindowCreated write FOnWindowCreated; property OnWindowCreated : TOnWindowCreatedEvent read FOnWindowCreated write FOnWindowCreated;
/// <summary>
/// Called when |window| is closing.
/// </summary>
property OnWindowClosing : TOnWindowClosingEvent read FOnWindowClosing write FOnWindowClosing; property OnWindowClosing : TOnWindowClosingEvent read FOnWindowClosing write FOnWindowClosing;
/// <summary>
/// Called when |window| is destroyed. Release all references to |window| and
/// do not attempt to execute any functions on |window| after this callback
/// returns.
/// </summary>
property OnWindowDestroyed : TOnWindowDestroyedEvent read FOnWindowDestroyed write FOnWindowDestroyed; property OnWindowDestroyed : TOnWindowDestroyedEvent read FOnWindowDestroyed write FOnWindowDestroyed;
/// <summary>
/// Called when |window| is activated or deactivated.
/// </summary>
property OnWindowActivationChanged : TOnWindowActivationChangedEvent read FOnWindowActivationChanged write FOnWindowActivationChanged; property OnWindowActivationChanged : TOnWindowActivationChangedEvent read FOnWindowActivationChanged write FOnWindowActivationChanged;
/// <summary>
/// Called when |window| bounds have changed. |new_bounds| will be in DIP
/// screen coordinates.
/// </summary>
property OnWindowBoundsChanged : TOnWindowBoundsChangedEvent read FOnWindowBoundsChanged write FOnWindowBoundsChanged; property OnWindowBoundsChanged : TOnWindowBoundsChangedEvent read FOnWindowBoundsChanged write FOnWindowBoundsChanged;
/// <summary>
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
/// to true (1) if |window| will be displayed as a menu, in which case it will
/// not be clipped to the parent window bounds. Set |can_activate_menu| to
/// false (0) if |is_menu| is true (1) and |window| should not be activated
/// (given keyboard focus) when displayed.
/// </summary>
property OnGetParentWindow : TOnGetParentWindowEvent read FOnGetParentWindow write FOnGetParentWindow; property OnGetParentWindow : TOnGetParentWindowEvent read FOnGetParentWindow write FOnGetParentWindow;
/// <summary>
/// Return true (1) if |window| should be created as a window modal dialog.
/// Only called when a Window is returned via get_parent_window() with
/// |is_menu| set to false (0). All controls in the parent Window will be
/// disabled while |window| is visible. This functionality is not supported by
/// all Linux window managers. Alternately, use
/// ICefWindow.ShowAsBrowserModalDialog() for a browser modal dialog
/// that works on all platforms.
/// </summary>
property OnIsWindowModalDialog : TOnIsWindowModalDialogEvent read FOnIsWindowModalDialog write FOnIsWindowModalDialog; property OnIsWindowModalDialog : TOnIsWindowModalDialogEvent read FOnIsWindowModalDialog write FOnIsWindowModalDialog;
/// <summary>
/// Return the initial bounds for |window| in density independent pixel (DIP)
/// coordinates. If this function returns an NULL CefRect then
/// GetPreferredSize() will be called to retrieve the size, and the window
/// will be placed on the screen with origin (0,0). This function can be used
/// in combination with ICefView.GetBoundsInScreen() to restore the
/// previous window bounds.
/// </summary>
property OnGetInitialBounds : TOnGetInitialBoundsEvent read FOnGetInitialBounds write FOnGetInitialBounds; property OnGetInitialBounds : TOnGetInitialBoundsEvent read FOnGetInitialBounds write FOnGetInitialBounds;
/// <summary>
/// Return the initial show state for |window|.
/// </summary>
property OnGetInitialShowState : TOnGetInitialShowStateEvent read FOnGetInitialShowState write FOnGetInitialShowState; property OnGetInitialShowState : TOnGetInitialShowStateEvent read FOnGetInitialShowState write FOnGetInitialShowState;
/// <summary>
/// Return true (1) if |window| should be created without a frame or title
/// bar. The window will be resizable if can_resize() returns true (1). Use
/// ICefWindow.SetDraggableRegions() to specify draggable regions.
/// </summary>
property OnIsFrameless : TOnIsFramelessEvent read FOnIsFrameless write FOnIsFrameless; property OnIsFrameless : TOnIsFramelessEvent read FOnIsFrameless write FOnIsFrameless;
/// <summary>
/// Return true (1) if |window| should be created with standard window buttons
/// like close, minimize and zoom. This function is only supported on macOS.
/// </summary>
property OnWithStandardWindowButtons : TOnWithStandardWindowButtonsEvent read FOnWithStandardWindowButtons write FOnWithStandardWindowButtons; property OnWithStandardWindowButtons : TOnWithStandardWindowButtonsEvent read FOnWithStandardWindowButtons write FOnWithStandardWindowButtons;
/// <summary>
/// Return whether the titlebar height should be overridden, and sets the
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
/// to adjust the vertical position of the traffic light buttons in frameless
/// windows. The buttons will be positioned halfway down the titlebar at a
/// height of |titlebar_height| / 2.
/// </summary>
property OnGetTitlebarHeight : TOnGetTitlebarHeightEvent read FOnGetTitlebarHeight write FOnGetTitlebarHeight; property OnGetTitlebarHeight : TOnGetTitlebarHeightEvent read FOnGetTitlebarHeight write FOnGetTitlebarHeight;
/// <summary>
/// Return true (1) if |window| can be resized.
/// </summary>
property OnCanResize : TOnCanResizeEvent read FOnCanResize write FOnCanResize; property OnCanResize : TOnCanResizeEvent read FOnCanResize write FOnCanResize;
/// <summary>
/// Return true (1) if |window| can be maximized.
/// </summary>
property OnCanMaximize : TOnCanMaximizeEvent read FOnCanMaximize write FOnCanMaximize; property OnCanMaximize : TOnCanMaximizeEvent read FOnCanMaximize write FOnCanMaximize;
/// <summary>
/// Return true (1) if |window| can be minimized.
/// </summary>
property OnCanMinimize : TOnCanMinimizeEvent read FOnCanMinimize write FOnCanMinimize; property OnCanMinimize : TOnCanMinimizeEvent read FOnCanMinimize write FOnCanMinimize;
/// <summary>
/// Return true (1) if |window| can be closed. This will be called for user-
/// initiated window close actions and when ICefWindow.close() is called.
/// </summary>
property OnCanClose : TOnCanCloseEvent read FOnCanClose write FOnCanClose; property OnCanClose : TOnCanCloseEvent read FOnCanClose write FOnCanClose;
/// <summary>
/// Called when a keyboard accelerator registered with
/// ICefWindow.SetAccelerator is triggered. Return true (1) if the
/// accelerator was handled or false (0) otherwise.
/// </summary>
property OnAccelerator : TOnAcceleratorEvent read FOnAccelerator write FOnAccelerator; property OnAccelerator : TOnAcceleratorEvent read FOnAccelerator write FOnAccelerator;
/// <summary>
/// Called after all other controls in the window have had a chance to handle
/// the event. |event| contains information about the keyboard event. Return
/// true (1) if the keyboard event was handled or false (0) otherwise.
/// </summary>
property OnKeyEvent : TOnWindowKeyEventEvent read FOnKeyEvent write FOnKeyEvent; property OnKeyEvent : TOnWindowKeyEventEvent read FOnKeyEvent write FOnKeyEvent;
/// <summary>
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false (0) when
/// the transition starts and true (1) when the transition completes. This
/// function is only supported on macOS.
/// </summary>
property OnWindowFullscreenTransition : TOnWindowFullscreenTransitionEvent read FOnWindowFullscreenTransition write FOnWindowFullscreenTransition; property OnWindowFullscreenTransition : TOnWindowFullscreenTransitionEvent read FOnWindowFullscreenTransition write FOnWindowFullscreenTransition;
end; end;
@ -398,6 +651,11 @@ begin
if Initialized then FWindow.Show; if Initialized then FWindow.Show;
end; end;
procedure TCEFWindowComponent.ShowAsBrowserModalDialog(const browser_view: ICefBrowserView);
begin
if Initialized then FWindow.ShowAsBrowserModalDialog(browser_view);
end;
procedure TCEFWindowComponent.Hide; procedure TCEFWindowComponent.Hide;
begin begin
if Initialized then FWindow.Hide; if Initialized then FWindow.Hide;

View File

@ -43,37 +43,145 @@ type
procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean); procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean);
public public
/// <summary>
/// Returns a ICefWindowDelegate instance using a PCefWindowDelegate data pointer.
/// </summary>
class function UnWrap(data: Pointer): ICefWindowDelegate; class function UnWrap(data: Pointer): ICefWindowDelegate;
end; end;
/// <summary>
/// Implement this interface to handle window events. The functions of this
/// interface will be called on the browser process UI thread unless otherwise
/// indicated.
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_window_delegate_capi.h">CEF source file: /include/capi/views/cef_window_delegate_capi.h (cef_window_delegate_t)</see></para>
/// </remarks>
TCefWindowDelegateOwn = class(TCefPanelDelegateOwn, ICefWindowDelegate) TCefWindowDelegateOwn = class(TCefPanelDelegateOwn, ICefWindowDelegate)
protected protected
/// <summary>
/// Called when |window| is created.
/// </summary>
procedure OnWindowCreated(const window_: ICefWindow); virtual; procedure OnWindowCreated(const window_: ICefWindow); virtual;
/// <summary>
/// Called when |window| is closing.
/// </summary>
procedure OnWindowClosing(const window_: ICefWindow); virtual; procedure OnWindowClosing(const window_: ICefWindow); virtual;
/// <summary>
/// Called when |window| is destroyed. Release all references to |window| and
/// do not attempt to execute any functions on |window| after this callback
/// returns.
/// </summary>
procedure OnWindowDestroyed(const window_: ICefWindow); virtual; procedure OnWindowDestroyed(const window_: ICefWindow); virtual;
/// <summary>
/// Called when |window| is activated or deactivated.
/// </summary>
procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); virtual; procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); virtual;
/// <summary>
/// Called when |window| bounds have changed. |new_bounds| will be in DIP
/// screen coordinates.
/// </summary>
procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); virtual; procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); virtual;
/// <summary>
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
/// to true (1) if |window| will be displayed as a menu, in which case it will
/// not be clipped to the parent window bounds. Set |can_activate_menu| to
/// false (0) if |is_menu| is true (1) and |window| should not be activated
/// (given keyboard focus) when displayed.
/// </summary>
procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); virtual; procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); virtual;
/// <summary>
/// Return true (1) if |window| should be created as a window modal dialog.
/// Only called when a Window is returned via get_parent_window() with
/// |is_menu| set to false (0). All controls in the parent Window will be
/// disabled while |window| is visible. This functionality is not supported by
/// all Linux window managers. Alternately, use
/// ICefWindow.ShowAsBrowserModalDialog() for a browser modal dialog
/// that works on all platforms.
/// </summary>
procedure OnIsWindowModalDialog(const window_: ICefWindow; var aResult: boolean); virtual; procedure OnIsWindowModalDialog(const window_: ICefWindow; var aResult: boolean); virtual;
/// <summary>
/// Return the initial bounds for |window| in density independent pixel (DIP)
/// coordinates. If this function returns an NULL CefRect then
/// GetPreferredSize() will be called to retrieve the size, and the window
/// will be placed on the screen with origin (0,0). This function can be used
/// in combination with ICefView.GetBoundsInScreen() to restore the
/// previous window bounds.
/// </summary>
procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); virtual; procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); virtual;
/// <summary>
/// Return the initial show state for |window|.
/// </summary>
procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); virtual; procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); virtual;
/// <summary>
/// Return true (1) if |window| should be created without a frame or title
/// bar. The window will be resizable if can_resize() returns true (1). Use
/// ICefWindow.SetDraggableRegions() to specify draggable regions.
/// </summary>
procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Return true (1) if |window| should be created with standard window buttons
/// like close, minimize and zoom. This function is only supported on macOS.
/// </summary>
procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnWithStandardWindowButtons(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Return whether the titlebar height should be overridden, and sets the
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
/// to adjust the vertical position of the traffic light buttons in frameless
/// windows. The buttons will be positioned halfway down the titlebar at a
/// height of |titlebar_height| / 2.
/// </summary>
procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); virtual; procedure OnGetTitlebarHeight(const window_: ICefWindow; var titlebar_height: Single; var aResult : boolean); virtual;
/// <summary>
/// Return true (1) if |window| can be resized.
/// </summary>
procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Return true (1) if |window| can be maximized.
/// </summary>
procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Return true (1) if |window| can be minimized.
/// </summary>
procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Return true (1) if |window| can be closed. This will be called for user-
/// initiated window close actions and when ICefWindow.close() is called.
/// </summary>
procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); virtual; procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); virtual;
/// <summary>
/// Called when a keyboard accelerator registered with
/// ICefWindow.SetAccelerator is triggered. Return true (1) if the
/// accelerator was handled or false (0) otherwise.
/// </summary>
procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); virtual; procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); virtual;
/// <summary>
/// Called after all other controls in the window have had a chance to handle
/// the event. |event| contains information about the keyboard event. Return
/// true (1) if the keyboard event was handled or false (0) otherwise.
/// </summary>
procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); virtual; procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); virtual;
/// <summary>
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false (0) when
/// the transition starts and true (1) when the transition completes. This
/// function is only supported on macOS.
/// </summary>
procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean); virtual; procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean); virtual;
/// <summary>
/// Links the methods in the internal CEF record data pointer with the methods in this class.
/// </summary>
procedure InitializeCEFMethods; override; procedure InitializeCEFMethods; override;
public public
constructor Create; override; constructor Create; override;
end; end;
/// <summary>
/// This class handles all the TCustomWindowDelegate methods which call the ICefWindowDelegateEvents methods.
/// ICefWindowDelegateEvents will be implemented by the control receiving the TCustomWindowDelegate events.
/// </summary>
TCustomWindowDelegate = class(TCefWindowDelegateOwn) TCustomWindowDelegate = class(TCefWindowDelegateOwn)
protected protected
FEvents : Pointer; FEvents : Pointer;
@ -112,6 +220,9 @@ type
procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean); override; procedure OnWindowFullscreenTransition(const window_: ICefWindow; is_completed: boolean); override;
public public
/// <summary>
/// Creates an instance of this class liked to an interface that's implemented by a control receiving the events.
/// </summary>
constructor Create(const events: ICefWindowDelegateEvents); reintroduce; constructor Create(const events: ICefWindowDelegateEvents); reintroduce;
end; end;

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 523, "InternalVersion" : 524,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "117.1.4" "Version" : "117.1.5"
} }
], ],
"UpdatePackageData" : { "UpdatePackageData" : {