WebInterfaceBrowserViewport.h
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Engine/Source/Runtime/WebBrowser/Public/WebBrowserViewport.h
#pragma once
#include "CoreMinimal.h"
#include "Input/CursorReply.h"
#include "Input/Reply.h"
#include "Rendering/RenderingCommon.h"
class FSlateShaderResource;
class IWebInterfaceBrowserWindow;
/**
* A Slate viewport to display a Web Browser Window
*/
class WEBBROWSERUI_API FWebInterfaceBrowserViewport : public ISlateViewport
{
public:
/**
* Default Constructor
*
* @param InWebBrowserWindow The Web Browser Window this viewport will display
* @param InViewportWidget The Widget displaying this viewport (needed to capture mouse)
* @param InIsPopup Used to initialize a viewport for showing browser popup menus instead of the main window.
*/
FWebInterfaceBrowserViewport(TSharedPtr<IWebInterfaceBrowserWindow> InWebBrowserWindow, bool InIsPopup = false)
: WebBrowserWindow(InWebBrowserWindow)
, bIsPopup(InIsPopup)
{ }
/**
* Destructor.
*/
~FWebInterfaceBrowserViewport( )
{
}
// ISlateViewport interface
virtual FIntPoint GetSize() const override;
virtual FSlateShaderResource* GetViewportRenderTargetTexture() const override;
virtual void Tick( const FGeometry& AllottedGeometry, double InCurrentTime, float DeltaTime ) override;
virtual bool RequiresVsync() const override;
virtual FCursorReply OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent ) override;
virtual FReply OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual void OnMouseEnter( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual void OnMouseLeave( const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent ) override;
virtual FReply OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) override;
virtual FReply OnKeyUp( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) override;
virtual FReply OnKeyChar( const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent ) override;
virtual FReply OnFocusReceived( const FFocusEvent& InFocusEvent ) override;
virtual void OnFocusLost( const FFocusEvent& InFocusEvent ) override;
private:
/** The web browser this viewport will display */
TSharedPtr<IWebInterfaceBrowserWindow> WebBrowserWindow;
/** Whether this viewport is showing the browser window or a popup menu widget */
bool const bIsPopup;
};