本文整理汇总了C++中FReply::CaptureMouse方法的典型用法代码示例。如果您正苦于以下问题:C++ FReply::CaptureMouse方法的具体用法?C++ FReply::CaptureMouse怎么用?C++ FReply::CaptureMouse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FReply
的用法示例。
在下文中一共展示了FReply::CaptureMouse方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnMouseButtonDown
FReply SPaperEditorViewport::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
TotalMouseDelta = 0;
if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton)
{
// RIGHT BUTTON is for dragging and Context Menu.
FReply ReplyState = FReply::Handled();
ReplyState.CaptureMouse( SharedThis(this) );
ReplyState.UseHighPrecisionMouseMovement( SharedThis(this) );
SoftwareCursorPosition = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ) );
// clear any interpolation when you manually pan
//DeferredMovementTargetObject = nullptr;
return ReplyState;
}
else if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
{
// START MARQUEE SELECTION.
const FVector2D GraphMousePos = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ) );
Marquee.Start( GraphMousePos, FMarqueeOperation::OperationTypeFromMouseEvent(MouseEvent) );
// Trigger a selection update now so that single-clicks without a drag still select something
OnSelectionChanged.ExecuteIfBound(Marquee, true);
PaperViewportClient->Invalidate();
return FReply::Handled().CaptureMouse( SharedThis(this) );
}
else
{
return FReply::Unhandled();
}
}
示例2: OnMouseMove
FReply FSequencerEditTool_Movement::OnMouseMove(SWidget& OwnerWidget, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (DelayedDrag.IsSet())
{
const FVirtualTrackArea VirtualTrackArea = SequencerWidget.Pin()->GetVirtualTrackArea();
FReply Reply = FReply::Handled();
if (DelayedDrag->IsDragging())
{
// If we're already dragging, just update the drag op if it exists
if (DragOperation.IsValid())
{
DragOperation->OnDrag(MouseEvent, MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()), VirtualTrackArea);
}
}
// Otherwise we can attempt a new drag
else if (DelayedDrag->AttemptDragStart(MouseEvent))
{
DragOperation = CreateDrag();
if (DragOperation.IsValid())
{
DragOperation->OnBeginDrag(MouseEvent, DelayedDrag->GetInitialPosition(), VirtualTrackArea);
// Steal the capture, as we're now the authoritative widget in charge of a mouse-drag operation
Reply.CaptureMouse(OwnerWidget.AsShared());
}
}
return Reply;
}
return FReply::Unhandled();
}
示例3: OnMouseButtonDown
FReply FWebBrowserViewport::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
// Capture mouse on left button down so that you can drag out of the viewport
FReply Reply = WebBrowserWindow->OnMouseButtonDown(MyGeometry, MouseEvent);
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && ViewportWidget.IsValid())
{
return Reply.CaptureMouse(ViewportWidget.Pin().ToSharedRef());
}
return Reply;
}
示例4: OnMouseMove
FReply STableViewBase::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if( MouseEvent.IsMouseButtonDown( EKeys::RightMouseButton ) )
{
const float ScrollByAmount = MouseEvent.GetCursorDelta().Y / MyGeometry.Scale;
// If scrolling with the right mouse button, we need to remember how much we scrolled.
// If we did not scroll at all, we will bring up the context menu when the mouse is released.
AmountScrolledWhileRightMouseDown += FMath::Abs( ScrollByAmount );
// Has the mouse moved far enough with the right mouse button held down to start capturing
// the mouse and dragging the view?
if( IsRightClickScrolling() )
{
// Make sure the active timer is registered to update the inertial scroll
if (!bIsScrollingActiveTimerRegistered)
{
bIsScrollingActiveTimerRegistered = true;
RegisterActiveTimer(0.f, FWidgetActiveTimerDelegate::CreateSP(this, &STableViewBase::UpdateInertialScroll));
}
TickScrollDelta -= ScrollByAmount;
const float AmountScrolled = this->ScrollBy( MyGeometry, -ScrollByAmount, AllowOverscroll );
FReply Reply = FReply::Handled();
// The mouse moved enough that we're now dragging the view. Capture the mouse
// so the user does not have to stay within the bounds of the list while dragging.
if(this->HasMouseCapture() == false)
{
Reply.CaptureMouse( AsShared() ).UseHighPrecisionMouseMovement( AsShared() );
SoftwareCursorPosition = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
bShowSoftwareCursor = true;
}
// Check if the mouse has moved.
if( AmountScrolled != 0 )
{
SoftwareCursorPosition.Y += ScrollByAmount;
}
return Reply;
}
}
return FReply::Unhandled();
}
示例5: OnMouseMove
FReply FScrollyZoomy::OnMouseMove( const TSharedRef<SWidget> MyWidget, IScrollableZoomable& ScrollableZoomable, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if (MouseEvent.IsMouseButtonDown(EKeys::RightMouseButton))
{
// If scrolling with the right mouse button, we need to remember how much we scrolled.
// If we did not scroll at all, we will bring up the context menu when the mouse is released.
AmountScrolledWhileRightMouseDown += FMath::Abs( MouseEvent.GetCursorDelta().X ) + FMath::Abs( MouseEvent.GetCursorDelta().Y );
// Has the mouse moved far enough with the right mouse button held down to start capturing
// the mouse and dragging the view?
if (IsRightClickScrolling())
{
this->HorizontalIntertia.AddScrollSample( MouseEvent.GetCursorDelta().X, FPlatformTime::Seconds() );
this->VerticalIntertia.AddScrollSample( MouseEvent.GetCursorDelta().Y, FPlatformTime::Seconds() );
const bool DidScroll = ScrollableZoomable.ScrollBy( MouseEvent.GetCursorDelta() );
FReply Reply = FReply::Handled();
// Capture the mouse if we need to
if (MyWidget->HasMouseCapture() == false)
{
Reply.CaptureMouse( MyWidget ).UseHighPrecisionMouseMovement( MyWidget );
SoftwareCursorPosition = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
bShowSoftwareCursor = true;
}
// Check if the mouse has moved.
if (DidScroll)
{
SoftwareCursorPosition += MouseEvent.GetCursorDelta();
}
return Reply;
}
}
return FReply::Unhandled();
}
示例6: OnMouseButtonDown
FReply FTextEditHelper::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& InMouseEvent, const TSharedRef< ITextEditorWidget >& TextEditor )
{
FReply Reply = FReply::Unhandled();
// If the mouse is already captured, then don't allow a new action to be taken
if( !TextEditor->GetWidget()->HasMouseCapture() )
{
if( InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton ||
InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// Am I getting focus right now?
const bool bIsGettingFocus = !TextEditor->GetWidget()->HasKeyboardFocus();
if( bIsGettingFocus )
{
// We might be receiving keyboard focus due to this event. Because the keyboard focus received callback
// won't fire until after this function exits, we need to make sure our widget's state is in order early
// Assume we'll be given keyboard focus, so load text for editing
TextEditor->LoadText();
// Reset 'mouse has moved' state. We'll use this in OnMouseMove to determine whether we
// should reset the selection range to the caret's position.
TextEditor->SetWasFocusedByLastMouseDown( true );
}
if( InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
if( InMouseEvent.IsShiftDown() )
{
TextEditor->MoveCursor( FMoveCursor::ViaScreenPointer( MyGeometry.AbsoluteToLocal( InMouseEvent.GetScreenSpacePosition( ) ), MyGeometry.Scale, ECursorAction::SelectText ) );
}
else
{
// Deselect any text that was selected
TextEditor->ClearSelection();
TextEditor->MoveCursor( FMoveCursor::ViaScreenPointer( MyGeometry.AbsoluteToLocal( InMouseEvent.GetScreenSpacePosition( ) ), MyGeometry.Scale, ECursorAction::MoveCursor ) );
}
// Start drag selection
TextEditor->BeginDragSelection();
}
else if( InMouseEvent.GetEffectingButton() == EKeys::RightMouseButton )
{
// If the user right clicked on a character that wasn't already selected, we'll clear
// the selection
if ( TextEditor->AnyTextSelected( ) && !TextEditor->IsTextSelectedAt( MyGeometry, InMouseEvent.GetScreenSpacePosition() ) )
{
// Deselect any text that was selected
TextEditor->ClearSelection();
}
}
// Right clicking to summon context menu, but we'll do that on mouse-up.
Reply = FReply::Handled();
Reply.CaptureMouse( TextEditor->GetWidget() );
Reply.SetUserFocus(TextEditor->GetWidget(), EFocusCause::Mouse);
}
}
return Reply;
}