UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SWebBrowser.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Layout/Visibility.h"
7#include "Input/Reply.h"
10#include "SWebBrowserView.h"
11
18
20
22 : public SCompoundWidget
23{
24public:
26 DECLARE_DELEGATE_RetVal_ThreeParams(bool, FOnLoadUrl, const FString& /*Method*/, const FString& /*Url*/, FString& /* Response */)
29
44
47
48
49 SLATE_ARGUMENT(FString, InitialURL)
50
51
52 SLATE_ARGUMENT(TOptional<FString>, ContentsToLoad)
53
54
56
57
59
60
62
63
65
66
68
69
71
72
73 SLATE_ARGUMENT(FColor, BackgroundColor)
74
75
76 SLATE_ARGUMENT(int , BrowserFrameRate)
77
78
80
81
83
85 SLATE_ATTRIBUTE(FVector2D, ViewportSize);
86
88 SLATE_EVENT(FSimpleDelegate, OnLoadCompleted)
89
91 SLATE_EVENT(FSimpleDelegate, OnLoadError)
92
94 SLATE_EVENT(FSimpleDelegate, OnLoadStarted)
95
97 SLATE_EVENT(FOnTextChanged, OnTitleChanged)
98
100 SLATE_EVENT(FOnTextChanged, OnUrlChanged)
101
103 SLATE_EVENT(FOnBeforePopupDelegate, OnBeforePopup)
104
106 SLATE_EVENT(FOnCreateWindowDelegate, OnCreateWindow)
107
109 SLATE_EVENT(FOnCloseWindowDelegate, OnCloseWindow)
110
112 SLATE_EVENT(FOnBeforeBrowse, OnBeforeNavigation)
113
115 SLATE_EVENT(FOnLoadUrl, OnLoadUrl)
116
118 SLATE_EVENT(FOnShowDialog, OnShowDialog)
119
121 SLATE_EVENT(FSimpleDelegate, OnDismissAllDialogs)
122
123 SLATE_EVENT(FOnSuppressContextMenu, OnSuppressContextMenu);
124
127
130
132
133
136
138
139 virtual bool SupportsKeyboardFocus() const override {return true;}
140
141 virtual void Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime) override;
142 virtual int32 OnPaint(const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyCullingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled) const override;
143
149 WEBBROWSER_API void Construct(const FArguments& InArgs, const TSharedPtr<IWebBrowserWindow>& InWebBrowserWindow = nullptr);
150
156 WEBBROWSER_API void LoadURL(FString NewURL);
157
164 WEBBROWSER_API void LoadString(FString Contents, FString DummyURL);
165
167 WEBBROWSER_API void Reload();
168
171
174
180 WEBBROWSER_API FString GetUrl() const;
181
188
190 WEBBROWSER_API bool IsLoaded() const;
191
193 WEBBROWSER_API bool IsLoading() const;
194
196 WEBBROWSER_API void ExecuteJavascript(const FString& ScriptText);
197
205 WEBBROWSER_API void GetSource(TFunction<void (const FString&)> Callback) const;
206
216 WEBBROWSER_API void BindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true);
217
225 WEBBROWSER_API void UnbindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true);
226
228
230
232
234
236 WEBBROWSER_API bool CanGoBack() const;
237
239 WEBBROWSER_API void GoBack();
240
242 WEBBROWSER_API bool CanGoForward() const;
243
246
249
250private:
251
253 WEBBROWSER_API FReply OnBackClicked();
254
256 WEBBROWSER_API FReply OnForwardClicked();
257
259 WEBBROWSER_API FText GetReloadButtonText() const;
260
262 WEBBROWSER_API FReply OnReloadClicked();
263
265 WEBBROWSER_API void OnUrlTextCommitted( const FText& NewText, ETextCommit::Type CommitType );
266
268 WEBBROWSER_API EVisibility GetViewportVisibility() const;
269
271 WEBBROWSER_API EVisibility GetLoadingThrobberVisibility() const;
272
273private:
274
276 TSharedPtr<SWebBrowserView> BrowserView;
277
280
282 FSimpleDelegate OnLoadCompleted;
283
285 FSimpleDelegate OnLoadError;
286
288 FSimpleDelegate OnLoadStarted;
289
291 FOnTextChanged OnTitleChanged;
292
294 FOnTextChanged OnUrlChanged;
295
297 FOnBeforePopupDelegate OnBeforePopup;
298
300 FOnConsoleMessageDelegate OnConsoleMessage;
301
303 FOnCreateWindowDelegate OnCreateWindow;
304
306 FOnCloseWindowDelegate OnCloseWindow;
307
309 FOnBeforeBrowse OnBeforeNavigation;
310
312 FOnLoadUrl OnLoadUrl;
313
315 FOnShowDialog OnShowDialog;
316
318 FSimpleDelegate OnDismissAllDialogs;
319
321 bool bShowInitialThrobber;
322
324 TSharedPtr<IWebBrowserWindow> WebBrowserWindow;
325};
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define SLATE_ATTRIBUTE(AttrType, AttrName)
Definition DeclarativeSyntaxSupport.h:192
#define SLATE_BEGIN_ARGS(InWidgetType)
Definition DeclarativeSyntaxSupport.h:63
#define SLATE_EVENT(DelegateName, EventName)
Definition DeclarativeSyntaxSupport.h:458
#define SLATE_END_ARGS()
Definition DeclarativeSyntaxSupport.h:116
#define SLATE_ARGUMENT(ArgType, ArgName)
Definition DeclarativeSyntaxSupport.h:208
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
#define DECLARE_DELEGATE_RetVal(ReturnValueType, DelegateName)
Definition DelegateCombinations.h:41
#define DECLARE_DELEGATE_RetVal_ThreeParams(ReturnValueType, DelegateName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:72
return true
Definition ExternalRpcRegistry.cpp:601
EWebBrowserDialogEventResponse
Definition IWebBrowserDialog.h:27
EPopupMethod
Definition PopupMethodReply.h:9
Definition PaintArgs.h:23
Definition Reply.h:24
Definition SlateRect.h:26
Definition DrawElements.h:220
Definition Text.h:385
Definition WidgetStyle.h:15
Definition ITextInputMethodSystem.h:169
Definition IWebBrowserAdapter.h:8
Definition IWebBrowserDialog.h:42
Definition IWebBrowserWindow.h:85
Definition SCompoundWidget.h:22
Definition SEditableTextBox.h:29
Definition SWebBrowser.h:23
WEBBROWSER_API void UnbindAdapter(const TSharedRef< IWebBrowserAdapter > &Adapter)
Definition SWebBrowser.cpp:523
WEBBROWSER_API void SetParentWindow(TSharedPtr< SWindow > Window)
Definition SWebBrowser.cpp:547
WEBBROWSER_API void GoForward()
Definition SWebBrowser.cpp:414
virtual int32 OnPaint(const FPaintArgs &Args, const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId, const FWidgetStyle &InWidgetStyle, bool bParentEnabled) const override
Definition SWebBrowser.cpp:102
WEBBROWSER_API void LoadURL(FString NewURL)
Definition SWebBrowser.cpp:302
WEBBROWSER_API FText GetTitleText() const
Definition SWebBrowser.cpp:334
DECLARE_DELEGATE_RetVal_TwoParams(bool, FOnBeforeBrowse, const FString &, const FWebNavigationRequest &) DECLARE_DELEGATE_RetVal_ThreeParams(bool
WEBBROWSER_API void ExecuteJavascript(const FString &ScriptText)
Definition SWebBrowser.cpp:483
WEBBROWSER_API bool IsLoaded() const
Definition SWebBrowser.cpp:362
WEBBROWSER_API void GetSource(TFunction< void(const FString &)> Callback) const
Definition SWebBrowser.cpp:491
WEBBROWSER_API void Reload()
Definition SWebBrowser.cpp:318
virtual bool SupportsKeyboardFocus() const override
Definition SWebBrowser.h:139
WEBBROWSER_API bool CanGoForward() const
Definition SWebBrowser.cpp:405
WEBBROWSER_API void UnbindInputMethodSystem()
Definition SWebBrowser.cpp:539
WEBBROWSER_API void BindUObject(const FString &Name, UObject *Object, bool bIsPermanent=true)
Definition SWebBrowser.cpp:499
WEBBROWSER_API void LoadString(FString Contents, FString DummyURL)
Definition SWebBrowser.cpp:310
WEBBROWSER_API bool CanGoBack() const
Definition SWebBrowser.cpp:382
WEBBROWSER_API void BindInputMethodSystem(ITextInputMethodSystem *TextInputMethodSystem)
Definition SWebBrowser.cpp:531
WEBBROWSER_API void BindAdapter(const TSharedRef< IWebBrowserAdapter > &Adapter)
Definition SWebBrowser.cpp:515
WEBBROWSER_API FString GetUrl() const
Definition SWebBrowser.cpp:343
FOnLoadUrl
Definition SWebBrowser.h:26
WEBBROWSER_API bool IsLoading() const
Definition SWebBrowser.cpp:372
WEBBROWSER_API void UnbindUObject(const FString &Name, UObject *Object, bool bIsPermanent=true)
Definition SWebBrowser.cpp:507
WEBBROWSER_API void GoBack()
Definition SWebBrowser.cpp:391
WEBBROWSER_API FText GetAddressBarUrlText() const
Definition SWebBrowser.cpp:353
WEBBROWSER_API void StopLoad()
Definition SWebBrowser.cpp:326
WEBBROWSER_API void Construct(const FArguments &InArgs, const TSharedPtr< IWebBrowserWindow > &InWebBrowserWindow=nullptr)
Definition SWebBrowser.cpp:156
Definition AndroidPlatformMisc.h:14
Definition SharedPointer.h:692
Definition SharedPointer.h:153
Definition SharedPointer.h:1295
Definition Object.h:95
Type
Definition SlateEnums.h:291
@ false
Definition radaudio_common.h:23
Definition Visibility.h:12
Definition Color.h:486
Definition Geometry.h:40
Definition Events.h:695
Definition IWebBrowserWindow.h:73
Definition Optional.h:131