Files
UnrealEngineUWP/Engine/Source/Developer/WebBrowser/Public/WebBrowserViewport.h
Matthew Griffin fef7e15bce Adding WebBrowser Developer project
Web Browser project mostly exposes interfaces, hiding all of the CEF3 implementation and technically allowing us to slot in another web system if necessary. Normal process will be to request a browser window interface from the web browser singleton. There is also an implementation of ISlateViewport so that it can be displayed via an SViewport.
The UnrealCEFSubProcess executable is needed for CEF3 to run additional processes for rendering etc. I don't expect this to change very often so it should hopefully just be built once and distributed, since we can't currently specify a program dependency for other modules.
Added a CEF3Utils project to share .dll loading code between web browser and the separate sub process executable.

[CL 2317298 by Matthew Griffin in Main branch]
2014-10-02 10:53:05 -04:00

59 lines
2.5 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SlateCore.h"
// Forward Declarations
class IWebBrowserWindow;
/**
* A Slate viewport to display a Web Browser Window
*/
class WEBBROWSER_API FWebBrowserViewport : 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)
*/
FWebBrowserViewport(TSharedPtr<IWebBrowserWindow> InWebBrowserWindow, TSharedPtr<SWidget> InViewportWidget)
: WebBrowserWindow(InWebBrowserWindow)
, ViewportWidget(InViewportWidget)
{ }
/**
* Destructor.
*/
~FWebBrowserViewport( )
{
}
// 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 FKeyboardEvent& InKeyboardEvent ) override;
virtual FReply OnKeyUp( const FGeometry& MyGeometry, const FKeyboardEvent& InKeyboardEvent ) override;
virtual FReply OnKeyChar( const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent ) override;
virtual FReply OnKeyboardFocusReceived( const FKeyboardFocusEvent& InKeyboardFocusEvent ) override;
virtual void OnKeyboardFocusLost( const FKeyboardFocusEvent& InKeyboardFocusEvent ) override;
private:
/** The web browser this viewport will display */
TSharedPtr<IWebBrowserWindow> WebBrowserWindow;
/** The viewport widget using this interface */
TWeakPtr<SWidget> ViewportWidget;
};