You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
111 lines
3.4 KiB
C++
111 lines
3.4 KiB
C++
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
#include "WebBrowserPrivatePCH.h"
|
||
|
|
#include "WebBrowserViewport.h"
|
||
|
|
#include "IWebBrowserWindow.h"
|
||
|
|
|
||
|
|
FIntPoint FWebBrowserViewport::GetSize() const
|
||
|
|
{
|
||
|
|
return (WebBrowserWindow->GetTexture() != nullptr)
|
||
|
|
? FIntPoint(WebBrowserWindow->GetTexture()->GetWidth(), WebBrowserWindow->GetTexture()->GetHeight())
|
||
|
|
: FIntPoint();
|
||
|
|
}
|
||
|
|
|
||
|
|
FSlateShaderResource* FWebBrowserViewport::GetViewportRenderTargetTexture() const
|
||
|
|
{
|
||
|
|
return WebBrowserWindow->GetTexture();
|
||
|
|
}
|
||
|
|
|
||
|
|
void FWebBrowserViewport::Tick(const FGeometry& AllottedGeometry, double InCurrentTime, float DeltaTime)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->SetViewportSize(AllottedGeometry.GetLocalSize());
|
||
|
|
}
|
||
|
|
|
||
|
|
bool FWebBrowserViewport::RequiresVsync() const
|
||
|
|
{
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
FCursorReply FWebBrowserViewport::OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent )
|
||
|
|
{
|
||
|
|
// TODO: retrieve cursor type from WebBrowserWindow if we can figure that out from CefCursorHandle
|
||
|
|
return FCursorReply::Unhandled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
// Capture mouse on left button down so that you can drag out of the viewport
|
||
|
|
WebBrowserWindow->OnMouseButtonDown(MyGeometry, MouseEvent);
|
||
|
|
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && ViewportWidget.IsValid())
|
||
|
|
{
|
||
|
|
return FReply::Handled().CaptureMouse(ViewportWidget.Pin().ToSharedRef());
|
||
|
|
}
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
// Release mouse capture when left button released
|
||
|
|
WebBrowserWindow->OnMouseButtonUp(MyGeometry, MouseEvent);
|
||
|
|
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
|
||
|
|
{
|
||
|
|
return FReply::Handled().ReleaseMouseCapture();
|
||
|
|
}
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
void FWebBrowserViewport::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
void FWebBrowserViewport::OnMouseLeave(const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnMouseMove(MyGeometry, MouseEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnMouseWheel(MyGeometry, MouseEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnMouseButtonDoubleClick(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnMouseButtonDoubleClick(InMyGeometry, InMouseEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnKeyDown(const FGeometry& MyGeometry, const FKeyboardEvent& InKeyboardEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnKeyDown(InKeyboardEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnKeyUp(const FGeometry& MyGeometry, const FKeyboardEvent& InKeyboardEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnKeyUp(InKeyboardEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnKeyChar( const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent )
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnKeyChar(InCharacterEvent);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
FReply FWebBrowserViewport::OnKeyboardFocusReceived(const FKeyboardFocusEvent& InKeyboardFocusEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnFocus(true);
|
||
|
|
return FReply::Handled();
|
||
|
|
}
|
||
|
|
|
||
|
|
void FWebBrowserViewport::OnKeyboardFocusLost(const FKeyboardFocusEvent& InKeyboardFocusEvent)
|
||
|
|
{
|
||
|
|
WebBrowserWindow->OnFocus(false);
|
||
|
|
}
|