123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- #pragma once
- #include "CoreMinimal.h"
- #include "Input/CursorReply.h"
- #include "Input/Reply.h"
- #include "Widgets/SWindow.h"
- #include "SWebInterfaceBrowser.h"
- class Error;
- class FSlateShaderResource;
- class IWebInterfaceBrowserDialog;
- class IWebInterfaceBrowserPopupFeatures;
- enum class EWebInterfaceBrowserDialogEventResponse;
- enum class EWebInterfaceBrowserDocumentState
- {
- Completed,
- Error,
- Loading,
- NoDocument
- };
- enum class EWebInterfaceBrowserConsoleLogSeverity
- {
- Default,
- Verbose,
- Debug,
- Info,
- Warning,
- Error,
- Fatal
- };
- enum class EWebInterfaceTransitionSource
- {
- Unknown,
-
- Link,
-
- Explicit,
-
- AutoSubframe,
-
- ManualSubframe,
-
- FormSubmit,
-
- Reload
- };
- enum class EWebInterfaceTransitionSourceQualifier
- {
- Unknown,
-
- Blocked,
-
- ForwardBack,
-
- ChainStart,
-
- ChainEnd,
-
- ClientRedirect,
-
- ServerRedirect
- };
- struct FWebNavigationRequest
- {
- bool bIsRedirect;
- bool bIsMainFrame;
- bool bIsExplicitTransition;
- EWebInterfaceTransitionSource TransitionSource;
- EWebInterfaceTransitionSourceQualifier TransitionSourceQualifier;
- };
- class IWebInterfaceBrowserWindow
- {
- public:
-
- virtual void LoadURL(FString NewURL) = 0;
-
- virtual void LoadString(FString Contents, FString DummyURL) = 0;
-
- virtual void SetViewportSize(FIntPoint WindowSize, FIntPoint WindowPos = FIntPoint::NoneValue) = 0;
-
- virtual FIntPoint GetViewportSize() const = 0;
-
- virtual FSlateShaderResource* GetTexture(bool bIsPopup = false) = 0;
-
- virtual bool IsValid() const = 0;
-
- virtual bool IsInitialized() const = 0;
-
- virtual bool IsClosing() const = 0;
-
- virtual EWebInterfaceBrowserDocumentState GetDocumentLoadingState() const = 0;
-
- virtual FString GetTitle() const = 0;
-
- virtual FString GetUrl() const = 0;
-
- virtual void GetSource(TFunction<void (const FString&)> Callback) const = 0;
-
- virtual bool OnKeyDown(const FKeyEvent& InKeyEvent) = 0;
-
- virtual bool OnKeyUp(const FKeyEvent& InKeyEvent) = 0;
-
- virtual bool OnKeyChar(const FCharacterEvent& InCharacterEvent) = 0;
-
- virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) = 0;
-
- virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) = 0;
-
- virtual FReply OnMouseButtonDoubleClick(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) = 0;
-
- virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) = 0;
-
- virtual void OnMouseLeave(const FPointerEvent& MouseEvent) = 0;
-
- virtual void SetSupportsMouseWheel(bool bValue) = 0;
-
- virtual bool GetSupportsMouseWheel() const = 0;
-
- virtual FReply OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) = 0;
-
- virtual FReply OnTouchGesture(const FGeometry& MyGeometry, const FPointerEvent& GestureEvent, bool bIsPopup) = 0;
-
- virtual FCursorReply OnCursorQuery(const FGeometry& MyGeometry, const FPointerEvent& CursorEvent) = 0;
-
- virtual void OnFocus(bool SetFocus, bool bIsPopup) = 0;
-
- virtual void OnCaptureLost() = 0;
-
- virtual bool CanGoBack() const = 0;
-
- virtual void GoBack() = 0;
-
- virtual bool CanGoForward() const = 0;
-
- virtual void GoForward() = 0;
-
- virtual bool IsLoading() const = 0;
-
- virtual void Reload() = 0;
-
- virtual void StopLoad() = 0;
-
- virtual void ExecuteJavascript(const FString& Script) = 0;
-
- virtual void CloseBrowser(bool bForce, bool bBlockTillClosed = false) = 0;
-
- virtual void BindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true) = 0;
-
- virtual void UnbindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true) = 0;
- virtual void BindInputMethodSystem(ITextInputMethodSystem* TextInputMethodSystem) {}
- virtual void UnbindInputMethodSystem() {}
-
- virtual int GetLoadError() = 0;
-
-
- virtual void SetIsDisabled(bool bValue) = 0;
-
- virtual TSharedPtr<class SWindow> GetParentWindow() const = 0;
-
- virtual void SetParentWindow(TSharedPtr<class SWindow> Window) = 0;
- virtual void CheckTickActivity() {};
- public:
-
- DECLARE_EVENT_OneParam(IWebInterfaceBrowserWindow, FOnDocumentStateChanged, EWebInterfaceBrowserDocumentState );
- virtual FOnDocumentStateChanged& OnDocumentStateChanged() = 0;
-
- DECLARE_EVENT_OneParam(IWebInterfaceBrowserWindow, FOnTitleChanged, FString );
- virtual FOnTitleChanged& OnTitleChanged() = 0;
-
- DECLARE_EVENT_OneParam(IWebInterfaceBrowserWindow, FOnUrlChanged, FString );
- virtual FOnUrlChanged& OnUrlChanged() = 0;
-
- DECLARE_EVENT_OneParam(IWebInterfaceBrowserWindow, FOnToolTip, FString );
- virtual FOnToolTip& OnToolTip() = 0;
-
- DECLARE_EVENT(IWebInterfaceBrowserWindow, FOnNeedsRedraw)
- virtual FOnNeedsRedraw& OnNeedsRedraw() = 0;
-
-
- DECLARE_DELEGATE_RetVal_TwoParams(bool, FOnBeforeBrowse, const FString& , const FWebNavigationRequest& )
- virtual FOnBeforeBrowse& OnBeforeBrowse() = 0;
-
-
- DECLARE_DELEGATE_RetVal_ThreeParams(bool, FOnLoadUrl, const FString& , const FString& , FString& )
- virtual FOnLoadUrl& OnLoadUrl() = 0;
-
- DECLARE_DELEGATE_RetVal_TwoParams(bool, FOnBeforePopupDelegate, FString, FString);
- virtual FOnBeforePopupDelegate& OnBeforePopup() = 0;
-
- typedef TMap<FString, FString> FRequestHeaders;
- DECLARE_DELEGATE_FourParams(FOnBeforeResourceLoadDelegate, FString , FString , FRequestHeaders& , const bool );
- virtual FOnBeforeResourceLoadDelegate& OnBeforeResourceLoad() = 0;
-
- DECLARE_DELEGATE_FourParams(FOnResourceLoadCompleteDelegate, FString , FString , FString , int64 );
- virtual FOnResourceLoadCompleteDelegate& OnResourceLoadComplete() = 0;
-
- DECLARE_DELEGATE_FourParams(FOnConsoleMessageDelegate, const FString& , const FString& , int32 , EWebInterfaceBrowserConsoleLogSeverity );
- virtual FOnConsoleMessageDelegate& OnConsoleMessage() = 0;
-
- DECLARE_DELEGATE_RetVal_TwoParams(bool, FOnCreateWindow, const TWeakPtr<IWebInterfaceBrowserWindow>& , const TWeakPtr<IWebInterfaceBrowserPopupFeatures>& )
- virtual FOnCreateWindow& OnCreateWindow() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(bool, FOnCloseWindow, const TWeakPtr<IWebInterfaceBrowserWindow>& )
- virtual FOnCloseWindow& OnCloseWindow() = 0;
-
- DECLARE_EVENT_OneParam(IWebInterfaceBrowserWindow, FOnShowPopup, const FIntRect& )
- virtual FOnShowPopup& OnShowPopup() = 0;
-
- DECLARE_EVENT(IWebInterfaceBrowserWindow, FOnDismissPopup)
- virtual FOnDismissPopup& OnDismissPopup() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(EWebInterfaceBrowserDialogEventResponse, FOnShowDialog, const TWeakPtr<IWebInterfaceBrowserDialog>& )
- virtual FOnShowDialog& OnShowDialog() = 0;
-
- DECLARE_DELEGATE(FOnDismissAllDialogs)
- virtual FOnDismissAllDialogs& OnDismissAllDialogs() = 0;
-
- DECLARE_DELEGATE_RetVal(bool, FOnSuppressContextMenu);
- virtual FOnSuppressContextMenu& OnSuppressContextMenu() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(bool, FOnUnhandledKeyDown, const FKeyEvent& );
- virtual FOnUnhandledKeyDown& OnUnhandledKeyDown() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(bool, FOnUnhandledKeyUp, const FKeyEvent& );
- virtual FOnUnhandledKeyUp& OnUnhandledKeyUp() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(bool, FOnUnhandledKeyChar, const FCharacterEvent& );
- virtual FOnUnhandledKeyChar& OnUnhandledKeyChar() = 0;
-
- DECLARE_DELEGATE_RetVal_OneParam(bool, FOnDragWindow, const FPointerEvent& )
- virtual FOnDragWindow& OnDragWindow() = 0;
-
- DECLARE_DELEGATE_RetVal(bool, FOnCheckVisibility);
- virtual FOnCheckVisibility& OnCheckVisibility()
- {
- return OnCheckVisibilityDelegate;
- }
- virtual bool CheckVisibility()
- {
- return !OnCheckVisibilityDelegate.IsBound() || OnCheckVisibilityDelegate.Execute();
- }
- protected:
-
- virtual ~IWebInterfaceBrowserWindow() { };
- private:
-
- FOnCheckVisibility OnCheckVisibilityDelegate;
- };
|