UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FViewportClient Class Reference

#include <ViewportClient.h>

+ Inheritance diagram for FViewportClient:

Public Member Functions

virtual ~FViewportClient ()
 
virtual void Precache ()
 
virtual ENGINE_API void RedrawRequested (FViewport *Viewport)
 
virtual ENGINE_API void RequestInvalidateHitProxy (FViewport *Viewport)
 
virtual void Draw (FViewport *Viewport, FCanvas *Canvas)
 
virtual bool ProcessScreenShots (FViewport *Viewport)
 
virtual UWorldGetWorld () const
 
virtual struct FEngineShowFlagsGetEngineShowFlags ()
 
virtual bool InputKey (const FInputKeyEventArgs &EventArgs)
 
virtual ENGINE_API bool InputAxis (FViewport *Viewport, FInputDeviceId InputDevice, FKey Key, float Delta, float DeltaTime, int32 NumSamples=1, bool bGamepad=false) final
 
virtual bool InputAxis (const FInputKeyEventArgs &Args)
 
virtual bool InputChar (FViewport *Viewport, int32 ControllerId, TCHAR Character)
 
virtual ENGINE_API bool InputTouch (FViewport *Viewport, int32 ControllerId, uint32 Handle, ETouchType::Type Type, const FVector2D &TouchLocation, float Force, FDateTime DeviceTimestamp, uint32 TouchpadIndex) final
 
virtual bool InputTouch (FViewport *Viewport, const FInputDeviceId DeviceId, uint32 Handle, ETouchType::Type Type, const FVector2D &TouchLocation, float Force, uint32 TouchpadIndex, const uint64 Timestamp)
 
virtual ENGINE_API bool InputGesture (FViewport *Viewport, EGestureEvent GestureType, const FVector2D &GestureDelta, bool bIsDirectionInvertedFromDevice) final
 
virtual bool InputGesture (FViewport *Viewport, const FInputDeviceId DeviceId, EGestureEvent GestureType, const FVector2D &GestureDelta, bool bIsDirectionInvertedFromDevice, const uint64 Timestamp)
 
virtual ENGINE_API bool InputMotion (FViewport *Viewport, int32 ControllerId, const FVector &Tilt, const FVector &RotationRate, const FVector &Gravity, const FVector &Acceleration) final
 
virtual bool InputMotion (FViewport *Viewport, const FInputDeviceId DeviceId, const FVector &Tilt, const FVector &RotationRate, const FVector &Gravity, const FVector &Acceleration, const uint64 Timestamp)
 
virtual void SetIsSimulateInEditorViewport (bool bInIsSimulateInEditorViewport)
 
virtual bool WantsPollingMouseMovement (void) const
 
virtual void MouseEnter (FViewport *Viewport, int32 x, int32 y)
 
virtual void MouseLeave (FViewport *Viewport)
 
virtual void MouseMove (FViewport *Viewport, int32 X, int32 Y)
 
virtual void CapturedMouseMove (FViewport *InViewport, int32 InMouseX, int32 InMouseY)
 
virtual void ProcessAccumulatedPointerInput (FViewport *InViewport)
 
virtual EMouseCursor::Type GetCursor (FViewport *Viewport, int32 X, int32 Y)
 
virtual ENGINE_API TOptional< TSharedRef< SWidget > > MapCursor (FViewport *Viewport, const FCursorReply &CursorReply)
 
virtual TOptional< boolQueryShowFocus (const EFocusCause InFocusCause) const
 
virtual void LostFocus (FViewport *Viewport)
 
virtual void ReceivedFocus (FViewport *Viewport)
 
virtual bool IsFocused (FViewport *Viewport)
 
virtual void Activated (FViewport *Viewport, const FWindowActivateEvent &InActivateEvent)
 
virtual void Deactivated (FViewport *Viewport, const FWindowActivateEvent &InActivateEvent)
 
virtual bool IsInPermanentCapture ()
 
virtual bool WindowCloseRequested ()
 
virtual void CloseRequested (FViewport *Viewport)
 
virtual bool RequiresHitProxyStorage ()
 
virtual bool RequiresUncapturedAxisInput () const
 
virtual bool RequiresKeyboardInput () const
 
virtual bool IsOrtho () const
 
virtual bool IsInGameView () const
 
virtual class UWorldConditionalSetWorld ()
 
virtual void ConditionalRestoreWorld (class UWorld *InWorld)
 
virtual bool OverrideHighResScreenshotCaptureRegion (FIntRect &OutCaptureRegion)
 
virtual FStatUnitDataGetStatUnitData () const
 
virtual FStatHitchesDataGetStatHitchesData () const
 
virtual const TArray< FString > * GetEnabledStats () const
 
virtual void SetEnabledStats (const TArray< FString > &InEnabledStats)
 
virtual bool IsStatEnabled (const FString &InName) const
 
virtual void SetShowStats (bool bWantStats)
 
virtual bool IgnoreInput ()
 
virtual EMouseCaptureMode GetMouseCaptureMode () const
 
virtual bool CaptureMouseOnLaunch ()
 
virtual bool LockDuringCapture ()
 
virtual bool ShouldAlwaysLockMouse ()
 
virtual bool HideCursorDuringCapture () const
 
virtual ENGINE_API FPopupMethodReply OnQueryPopupMethod () const
 
virtual bool HandleNavigation (const uint32 InUserIndex, TSharedPtr< SWidget > InDestination)
 
virtual bool ShouldDPIScaleSceneCanvas () const
 
virtual float GetDPIScale () const
 

Detailed Description

An abstract interface to a viewport's client. The viewport's client processes input received by the viewport, and draws the viewport.

Constructor & Destructor Documentation

◆ ~FViewportClient()

virtual FViewportClient::~FViewportClient ( )
inlinevirtual

Member Function Documentation

◆ Activated()

virtual void FViewportClient::Activated ( FViewport Viewport,
const FWindowActivateEvent InActivateEvent 
)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ CapturedMouseMove()

virtual void FViewportClient::CapturedMouseMove ( FViewport InViewport,
int32  InMouseX,
int32  InMouseY 
)
inlinevirtual

Called when the mouse is moved while a window input capture is in effect

Parameters
InViewportViewport that captured the mouse input
InMouseXNew mouse cursor X coordinate
InMouseYNew mouse cursor Y coordinate

◆ CaptureMouseOnLaunch()

virtual bool FViewportClient::CaptureMouseOnLaunch ( )
inlinevirtual

Gets whether or not the viewport captures the Mouse on launch of the application Technically this controls capture on the first window activate, so in situations where the application is launched but isn't activated the effect is delayed until activation.

Reimplemented in UGameViewportClient.

◆ CloseRequested()

virtual void FViewportClient::CloseRequested ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ ConditionalRestoreWorld()

virtual void FViewportClient::ConditionalRestoreWorld ( class UWorld InWorld)
inlinevirtual

Restores GWorld to InWorld

Parameters
InWorldThe world to restore

◆ ConditionalSetWorld()

virtual class UWorld * FViewportClient::ConditionalSetWorld ( )
inlinevirtual

Sets GWorld to the appropriate world for this client

Returns
the previous GWorld

◆ Deactivated()

virtual void FViewportClient::Deactivated ( FViewport Viewport,
const FWindowActivateEvent InActivateEvent 
)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ Draw()

virtual void FViewportClient::Draw ( FViewport Viewport,
FCanvas Canvas 
)
inlinevirtual

Reimplemented in FUMGViewportClient, and UGameViewportClient.

◆ GetCursor()

virtual EMouseCursor::Type FViewportClient::GetCursor ( FViewport Viewport,
int32  X,
int32  Y 
)
inlinevirtual

Retrieves the cursor that should be displayed by the OS

Parameters
Viewportthe viewport that contains the cursor
Xthe x position of the cursor
Ythe Y position of the cursor
Returns
the cursor that the OS should display

Reimplemented in UGameViewportClient.

◆ GetDPIScale()

virtual float FViewportClient::GetDPIScale ( ) const
inlinevirtual
Returns
The DPI Scale of this viewport

Reimplemented in FCommonViewportClient.

◆ GetEnabledStats()

virtual const TArray< FString > * FViewportClient::GetEnabledStats ( ) const
inlinevirtual

Get a ptr to the enabled stats list

Reimplemented in UGameViewportClient.

◆ GetEngineShowFlags()

virtual struct FEngineShowFlags * FViewportClient::GetEngineShowFlags ( )
inlinevirtual

Reimplemented in UGameViewportClient.

◆ GetMouseCaptureMode()

virtual EMouseCaptureMode FViewportClient::GetMouseCaptureMode ( ) const
inlinevirtual

Gets the mouse capture behavior when the viewport is clicked

Reimplemented in UGameViewportClient.

◆ GetStatHitchesData()

virtual FStatHitchesData * FViewportClient::GetStatHitchesData ( ) const
inlinevirtual

Get a ptr to the stat unit data for this viewport

Reimplemented in UGameViewportClient.

◆ GetStatUnitData()

virtual FStatUnitData * FViewportClient::GetStatUnitData ( ) const
inlinevirtual

Get a ptr to the stat unit data for this viewport

Reimplemented in UGameViewportClient.

◆ GetWorld()

virtual UWorld * FViewportClient::GetWorld ( ) const
inlinevirtual

Reimplemented in UGameViewportClient, and FUMGViewportClient.

◆ HandleNavigation()

virtual bool FViewportClient::HandleNavigation ( const uint32  InUserIndex,
TSharedPtr< SWidget InDestination 
)
inlinevirtual

Optionally do custom handling of a navigation.

Reimplemented in UGameViewportClient.

◆ HideCursorDuringCapture()

virtual bool FViewportClient::HideCursorDuringCapture ( ) const
inlinevirtual

Gets whether or not the cursor is hidden when the viewport captures the mouse

Reimplemented in UGameViewportClient.

◆ IgnoreInput()

virtual bool FViewportClient::IgnoreInput ( )
inlinevirtual

Check whether we should ignore input.

Reimplemented in UGameViewportClient.

◆ InputAxis() [1/2]

virtual bool FViewportClient::InputAxis ( const FInputKeyEventArgs Args)
inlinevirtual

Check an axis movement received by the viewport. If this viewport client uses this input and wants to consume it (stop it from being passed along to further viewports) then it should return true.

Parameters
ArgsThe input event arguments for this axis movement.
Returns
True to consume the axis movement, false to pass it on.

Reimplemented in UGameViewportClient.

◆ InputAxis() [2/2]

PRAGMA_DISABLE_DEPRECATION_WARNINGS bool FViewportClient::InputAxis ( FViewport Viewport,
FInputDeviceId  InputDevice,
FKey  Key,
float  Delta,
float  DeltaTime,
int32  NumSamples = 1,
bool  bGamepad = false 
)
finalvirtual

Check an axis movement received by the viewport. If the viewport client uses the movement, it should return true to consume it.

Parameters
Viewport- The viewport which the axis movement is from.
InputDevice- The input device that triggered this axis movement
Key- The name of the axis which moved.
Delta- The axis movement delta.
DeltaTime- The time since the last axis update.
NumSamples- The number of device samples that contributed to this Delta, useful for things like smoothing
bGamepad- input came from gamepad (ie xbox controller)
Returns
True to consume the axis movement, false to pass it on.

◆ InputChar()

virtual bool FViewportClient::InputChar ( FViewport Viewport,
int32  ControllerId,
TCHAR  Character 
)
inlinevirtual

Check a character input received by the viewport. If the viewport client uses the character, it should return true to consume it.

Parameters
Viewport- The viewport which the axis movement is from.
ControllerId- The controller which the axis movement is from.
Character- The character.
Returns
True to consume the character, false to pass it on.

Reimplemented in UGameViewportClient.

◆ InputGesture() [1/2]

virtual bool FViewportClient::InputGesture ( FViewport Viewport,
const FInputDeviceId  DeviceId,
EGestureEvent  GestureType,
const FVector2D GestureDelta,
bool  bIsDirectionInvertedFromDevice,
const uint64  Timestamp 
)
inlinevirtual

Check a gesture event received by the viewport. If the viewport client uses the event, it should return true to consume it.

Parameters
Viewport- The viewport which the event is from.
DeviceId- The input device id from which this gesture came from
GestureType- The type of gesture being input
GestureDelta- Delta values of this gesture from the previous instance of it
Timestamp- The timestamp of when this input event was originally polled in the form of CPU cycles.
Returns
True to consume the gesture event, false to pass it on.

◆ InputGesture() [2/2]

bool FViewportClient::InputGesture ( FViewport Viewport,
EGestureEvent  GestureType,
const FVector2D GestureDelta,
bool  bIsDirectionInvertedFromDevice 
)
finalvirtual

Check a gesture event received by the viewport. If the viewport client uses the event, it should return true to consume it.

Parameters
Viewport- The viewport which the event is from.
GestureType-
GestureDelta-
Returns
True to consume the gesture event, false to pass it on.

◆ InputKey()

virtual bool FViewportClient::InputKey ( const FInputKeyEventArgs EventArgs)
inlinevirtual

Check a key event received by the viewport. If the viewport client uses the event, it should return true to consume it.

Parameters
EventArgs- The Input event args.
Returns
True to consume the key event, false to pass it on.

Reimplemented in UGameViewportClient.

◆ InputMotion() [1/2]

virtual bool FViewportClient::InputMotion ( FViewport Viewport,
const FInputDeviceId  DeviceId,
const FVector Tilt,
const FVector RotationRate,
const FVector Gravity,
const FVector Acceleration,
const uint64  Timestamp 
)
inlinevirtual

Each frame, the input system will update the motion data.

Parameters
Viewport- The viewport which the key event is from.
DeviceId- The input device which this event is from
TiltThe current orientation of the device
RotationRateHow fast the tilt is changing
GravityDescribes the current gravity of the device
AccelerationDescribes the acceleration of the device
TimestampThe timestamp of when this input event was originally polled in the form of CPU cycles.
Returns
True to consume the motion event, false to pass it on.

Reimplemented in UGameViewportClient.

◆ InputMotion() [2/2]

bool FViewportClient::InputMotion ( FViewport Viewport,
int32  ControllerId,
const FVector Tilt,
const FVector RotationRate,
const FVector Gravity,
const FVector Acceleration 
)
finalvirtual

Each frame, the input system will update the motion data.

Parameters
Viewport- The viewport which the key event is from.
ControllerId- The controller which the key event is from.
TiltThe current orientation of the device
RotationRateHow fast the tilt is changing
GravityDescribes the current gravity of the device
AccelerationDescribes the acceleration of the device
Returns
True to consume the motion event, false to pass it on.

◆ InputTouch() [1/2]

virtual bool FViewportClient::InputTouch ( FViewport Viewport,
const FInputDeviceId  DeviceId,
uint32  Handle,
ETouchType::Type  Type,
const FVector2D TouchLocation,
float  Force,
uint32  TouchpadIndex,
const uint64  Timestamp 
)
inlinevirtual

Check a key event received by the viewport. If the viewport client uses the event, it should return true to consume it.

Parameters
Viewport- The viewport which the event is from.
DeviceId- The input device id from which this event is from
Handle- Identifier unique to this touch event
Type- What kind of touch event this is (see ETouchType)
TouchLocation- Screen position of the touch
Force- How hard the touch is
TouchpadIndex- For devices with multiple touchpads, this is the index of which one
Timestamp- The timestamp of when this input event was originally polled in the form of CPU cycles.
Returns
True to consume the key event, false to pass it on.

Reimplemented in UGameViewportClient.

◆ InputTouch() [2/2]

bool FViewportClient::InputTouch ( FViewport Viewport,
int32  ControllerId,
uint32  Handle,
ETouchType::Type  Type,
const FVector2D TouchLocation,
float  Force,
FDateTime  DeviceTimestamp,
uint32  TouchpadIndex 
)
finalvirtual

Check a key event received by the viewport. If the viewport client uses the event, it should return true to consume it.

Parameters
Viewport- The viewport which the event is from.
ControllerId- The controller which the key event is from.
Handle- Identifier unique to this touch event
Type- What kind of touch event this is (see ETouchType)
TouchLocation- Screen position of the touch
Force- How hard the touch is
DeviceTimestamp- Timestamp of the event
TouchpadIndex- For devices with multiple touchpads, this is the index of which one
Returns
True to consume the key event, false to pass it on.

◆ IsFocused()

virtual bool FViewportClient::IsFocused ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ IsInGameView()

virtual bool FViewportClient::IsInGameView ( ) const
inlinevirtual

Returns true if this viewport is excluding non-game elements from its display

◆ IsInPermanentCapture()

virtual bool FViewportClient::IsInPermanentCapture ( )
inlinevirtual

Reimplemented in UGameViewportClient.

◆ IsOrtho()

virtual bool FViewportClient::IsOrtho ( ) const
inlinevirtual

Returns true if this viewport is orthogonal. If hit proxies are ever used in-game, this will need to be overridden correctly in GameViewportClient.

Reimplemented in UGameViewportClient.

◆ IsStatEnabled()

virtual bool FViewportClient::IsStatEnabled ( const FString &  InName) const
inlinevirtual

Check whether a specific stat is enabled for this viewport

Reimplemented in UGameViewportClient.

◆ LockDuringCapture()

virtual bool FViewportClient::LockDuringCapture ( )
inlinevirtual

Gets whether or not the cursor is locked to the viewport when the viewport captures the mouse

Reimplemented in UGameViewportClient.

◆ LostFocus()

virtual void FViewportClient::LostFocus ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ MapCursor()

PRAGMA_ENABLE_DEPRECATION_WARNINGS TOptional< TSharedRef< SWidget > > FViewportClient::MapCursor ( FViewport Viewport,
const FCursorReply CursorReply 
)
virtual

Called to map a cursor reply to an actual widget to render.

Returns
the widget that should be rendered for this cursor, return TOptional<TSharedRef<SWidget>>() if no mapping.

Reimplemented in UGameViewportClient.

◆ MouseEnter()

virtual void FViewportClient::MouseEnter ( FViewport Viewport,
int32  x,
int32  y 
)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ MouseLeave()

virtual void FViewportClient::MouseLeave ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ MouseMove()

virtual void FViewportClient::MouseMove ( FViewport Viewport,
int32  X,
int32  Y 
)
inlinevirtual

◆ OnQueryPopupMethod()

FPopupMethodReply FViewportClient::OnQueryPopupMethod ( ) const
virtual

Should we make new windows for popups or create an overlay in the current window.

Reimplemented in UGameViewportClient.

◆ OverrideHighResScreenshotCaptureRegion()

virtual bool FViewportClient::OverrideHighResScreenshotCaptureRegion ( FIntRect OutCaptureRegion)
inlinevirtual

Allow viewport client to override the current capture region

Parameters
OutCaptureRegionRef to rectangle where we will write the overridden region
Returns
true if capture region has been overridden, false otherwise

◆ Precache()

virtual void FViewportClient::Precache ( )
inlinevirtual

Reimplemented in UGameViewportClient.

◆ ProcessAccumulatedPointerInput()

virtual void FViewportClient::ProcessAccumulatedPointerInput ( FViewport InViewport)
inlinevirtual

Called from slate when input is finished for this frame, and we should process any queued mouse moves.

◆ ProcessScreenShots()

virtual bool FViewportClient::ProcessScreenShots ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ QueryShowFocus()

virtual TOptional< bool > FViewportClient::QueryShowFocus ( const EFocusCause  InFocusCause) const
inlinevirtual

Called to determine if we should render the focus brush.

Parameters
InFocusCauseThe cause of focus

Reimplemented in UGameViewportClient.

◆ ReceivedFocus()

virtual void FViewportClient::ReceivedFocus ( FViewport Viewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ RedrawRequested()

void FViewportClient::RedrawRequested ( FViewport Viewport)
virtual

Reimplemented in UGameViewportClient.

◆ RequestInvalidateHitProxy()

void FViewportClient::RequestInvalidateHitProxy ( FViewport Viewport)
virtual

◆ RequiresHitProxyStorage()

virtual bool FViewportClient::RequiresHitProxyStorage ( )
inlinevirtual

Reimplemented in UGameViewportClient.

◆ RequiresKeyboardInput()

virtual bool FViewportClient::RequiresKeyboardInput ( ) const
inlinevirtual

Determine if the viewport client is going to need any keyboard input

Returns
true if keyboard input is needed

◆ RequiresUncapturedAxisInput()

virtual bool FViewportClient::RequiresUncapturedAxisInput ( ) const
inlinevirtual

Determines whether this viewport client should receive calls to InputAxis() if the game's window is not currently capturing the mouse. Used by the UI system to easily receive calls to InputAxis while the viewport's mouse capture is disabled.

Reimplemented in UGameViewportClient.

◆ SetEnabledStats()

virtual void FViewportClient::SetEnabledStats ( const TArray< FString > &  InEnabledStats)
inlinevirtual

Sets all the stats that should be enabled for the viewport

Reimplemented in UGameViewportClient.

◆ SetIsSimulateInEditorViewport()

virtual void FViewportClient::SetIsSimulateInEditorViewport ( bool  bInIsSimulateInEditorViewport)
inlinevirtual

Reimplemented in UGameViewportClient.

◆ SetShowStats()

virtual void FViewportClient::SetShowStats ( bool  bWantStats)
inlinevirtual

Sets whether stats should be visible for the viewport

◆ ShouldAlwaysLockMouse()

virtual bool FViewportClient::ShouldAlwaysLockMouse ( )
inlinevirtual

Gets whether or not the cursor should always be locked to the viewport.

Reimplemented in UGameViewportClient.

◆ ShouldDPIScaleSceneCanvas()

virtual bool FViewportClient::ShouldDPIScaleSceneCanvas ( ) const
inlinevirtual
Returns
Whether or not the scene canvas should be scaled. Note: The debug canvas is always scaled

Reimplemented in UGameViewportClient.

◆ WantsPollingMouseMovement()

virtual bool FViewportClient::WantsPollingMouseMovement ( void  ) const
inlinevirtual

◆ WindowCloseRequested()

virtual bool FViewportClient::WindowCloseRequested ( )
inlinevirtual

Called when the top level window associated with the viewport has been requested to close. At this point, the viewport has not been closed and the operation may be canceled. This may not called from PIE, Editor Windows, on consoles, or before the game ends from other methods. This is only when the platform specific window is closed.

Returns
True if the viewport may be closed, false otherwise.

Reimplemented in UGameViewportClient.


The documentation for this class was generated from the following files: