Reference TCustomWebBrowser
Declared in Codebot.WebKit.Controls.pas on line 168
TCustomWebBrowser = class(TWinControl, IWebBrowserEvents)
protected
class procedure WSRegisterClass; override;
procedure InitializeWnd; override;
procedure DestroyWnd; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure PaintWindow(DC: HDC); override;
procedure Paint; virtual;
{ HasView is true when the control hosts a web view, and false when it
paints itself }
function HasView: Boolean;
{ ControlCanvas is used to paint the control when it has no web view }
property ControlCanvas: TControlCanvas read FCanvas;
{ The methods below are called in response to changes in the web view }
procedure DoLoadStatus(Status: TWebLoadStatus); virtual;
procedure DoError(const Uri: string; ErrorCode: Integer; const ErrorMessage: string; var Handled: Boolean); virtual;
procedure DoProgress(Progress: Integer); virtual;
procedure DoLocationChange(const Uri: string); virtual;
procedure DoTitleChange(const Title: string); virtual;
procedure DoNavigate(const Uri: string; var Action: TWebNavigateAction); virtual;
procedure DoHitTest(HitTest: TWebHitTest; const Link, Media: string); virtual;
procedure DoContextMenu(X, Y: Integer; HitTest: TWebHitTest; const Link, Media: string; var Handled: Boolean); virtual;
procedure DoScriptDialog(Dialog: TWebScriptDialog; const Message: string; var Input: string; var Accepted: Boolean); virtual;
{ When Editable is true the page can be edited by the user }
property Editable: Boolean read FEditable write SetEditable default False;
{ ZoomFactor can be used to increase or decrease the size of text or content }
property ZoomFactor: Double read FZoomFactor write SetZoomFactor stored IsZoomFactorStored;
{ When ZoomTextOnly is true only text is resized by zoom factor }
property ZoomTextOnly: Boolean read FZoomTextOnly write SetZoomTextOnly default False;
{ When DeveloperTools is true the inspector can be shown and an inspect item
is added to the context menu }
property DeveloperTools: Boolean read FDeveloperTools write SetDeveloperTools default False;
{ The folder files are downloaded to. When empty the download folder of the
user is used. }
property DownloadFolder: string read FDownloadFolder write FDownloadFolder;
{ OnDownloadStart is invoked before a file is downloaded }
property OnDownloadStart: TWebDownloadStartEvent read FOnDownloadStart write FOnDownloadStart;
{ OnDownloadProgress is invoked as a download progresses }
property OnDownloadProgress: TWebDownloadEvent read FOnDownloadProgress write FOnDownloadProgress;
{ OnDownloadFinish is invoked when a download finishes or fails }
property OnDownloadFinish: TWebDownloadEvent read FOnDownloadFinish write FOnDownloadFinish;
{ OnError is invoked when a load fails }
property OnError: TWebErrorEvent read FOnError write FOnError;
{ OnContextMenu is invoked when a context menu is about to be shown }
property OnContextMenu: TWebContextMenuEvent read FOnContextMenu write FOnContextMenu;
{ OnHitTest is invoked when the element under the mouse changes }
property OnHitTest: TWebHitTestEvent read FOnHitTest write FOnHitTest;
{ OnLoadStatusChange occurs when the loading status changes }
property OnLoadStatusChange: TNotifyEvent read FOnLoadStatusChange write FOnLoadStatusChange;
{ OnLocationChange occurs when a new uri begins to load or is redirected }
property OnLocationChange: TNotifyEvent read FOnLocationChange write FOnLocationChange;
{ OnTitleChange occurs when the title of the page changes }
property OnTitleChange: TNotifyEvent read FOnTitleChange write FOnTitleChange;
{ OnNavigate is invoked before a navigation is followed }
property OnNavigate: TWebNavigateEvent read FOnNavigate write FOnNavigate;
{ OnProgress is invoked as a load progresses }
property OnProgress: TWebProgressEvent read FOnProgress write FOnProgress;
{ OnScriptDialog is invoked by javascript alert(), confirm(), and prompt()
functions }
property OnScriptDialog: TWebScriptDialogEvent read FOnScriptDialog write FOnScriptDialog;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
{ Available is true when the WebKitGTK library is installed }
class function Available: Boolean;
{ Load content by navigating using a protocol such as http: file: or about: }
procedure Load(const Uri: string);
{ Load content directly from an html string }
procedure LoadHtml(const Html: string);
{ Stop a load in progress }
procedure Stop;
{ Repeat the previously navigated uri request or html load }
procedure Reload;
{ Insert a snippet of javascript into the page and execute it }
procedure ExecuteScript(const Script: string);
{ Navigate back one step in history }
procedure GoBack;
{ Navigate forward one step in history }
procedure GoForward;
{ Query if it's possible to navigate back one step in history }
function CanGoBack: Boolean;
{ Query if it's possible to navigate forward one step in history }
function CanGoForward: Boolean;
{ Navigate back (negative) or forward (positive) a number of steps in
history }
procedure BackOrForward(Steps: Integer);
{ Query if it's possible to navigate back or forward a number of steps in
history }
function BackOrForwardExists(Steps: Integer): Boolean;
{ Show the inspector, which also sets DeveloperTools to true }
procedure ShowInspector;
{ Close the inspector }
procedure CloseInspector;
{ Query the title and uri of the page a number of steps back (negative) or
forward (positive) in history }
function HistoryItem(Steps: Integer; out Title, Uri: string): Boolean;
{ Download a file to the download folder }
procedure Download(const Uri: string);
{ Cancel a download which is in progress }
procedure CancelDownload(Download: TWebDownload);
{ Remove the downloads which are not in progress from the list of downloads }
procedure ClearDownloads;
{ The folder files are downloaded to, which is the download folder of the
user unless DownloadFolder is set }
function ActiveDownloadFolder: string;
{ Show the print dialog for the page }
procedure Print;
{ Capture an image of the visible page and place it on the clipboard. The
image is captured in the background and is on the clipboard a moment after
this method returns. }
procedure CaptureToClipboard;
{ Add a listener which is notified of changes in the browser }
procedure AddListener(Listener: TWebNotifyEvent);
{ Remove a listener }
procedure RemoveListener(Listener: TWebNotifyEvent);
{ The inspector control associated with the browser, or nil if there is
none. It is set when the WebBrowser property of an inspector control is
set to the browser. }
property Inspector: TWebInspector read FInspector;
{ The uri of the link under the mouse }
property HoverLink: string read FHoverLink;
{ The number of downloads started by the browser }
property DownloadCount: Integer read GetDownloadCount;
{ The downloads started by the browser, with the oldest first }
property Downloads[Index: Integer]: TWebDownload read GetDownload;
{ The uri of the content being displayed }
property Location: string read FLocation write SetLocation;
{ Html stores the last value passed to LoadHtml }
property Html: string read FHtml;
{ HtmlDefined is true when the last load method invoked was LoadHtml }
property HtmlDefined: Boolean read FHtmlDefined;
{ The status of the current load }
property LoadStatus: TWebLoadStatus read FLoadStatus;
{ Loading is true while a load is in progress }
property Loading: Boolean read GetLoading;
{ The progress of the current load ranging from 0 to 100 }
property Progress: Integer read FProgress;
{ The title string extracted from a web page }
property Title: string read FTitle;
end;See also
IWebBrowserEvents in Codebot.WebKit.Controls.Gtk3.pas