本文整理汇总了C++中FPointerEvent类的典型用法代码示例。如果您正苦于以下问题:C++ FPointerEvent类的具体用法?C++ FPointerEvent怎么用?C++ FPointerEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FPointerEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnColorBoxClicked
FReply SGraphPinColor::OnColorBoxClicked(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
{
SelectedColor = GetColor();
TArray<FLinearColor*> LinearColorArray;
LinearColorArray.Add(&SelectedColor);
FColorPickerArgs PickerArgs;
PickerArgs.bIsModal = true;
PickerArgs.ParentWidget = AsShared();
PickerArgs.DisplayGamma = TAttribute<float>::Create(TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma));
PickerArgs.LinearColorArray = &LinearColorArray;
PickerArgs.OnColorCommitted = FOnLinearColorValueChanged::CreateSP(this, &SGraphPinColor::OnColorCommitted);
PickerArgs.bUseAlpha = true;
OpenColorPicker(PickerArgs);
return FReply::Handled();
}
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: StartDraggingTab
FReply SDockingTabWell::StartDraggingTab( TSharedRef<SDockTab> TabToStartDragging, FVector2D InTabGrabOffsetFraction, const FPointerEvent& MouseEvent )
{
Tabs.Remove(TabToStartDragging);
// We just removed the foreground tab.
ForegroundTabIndex = INDEX_NONE;
ParentTabStackPtr.Pin()->OnTabRemoved(TabToStartDragging->GetLayoutIdentifier());
// Tha tab well keeps track of which tab we are dragging; we treat is specially during rendering and layout.
TabBeingDraggedPtr = TabToStartDragging;
TabGrabOffsetFraction = InTabGrabOffsetFraction;
// We are about to start dragging a tab, so make sure its offset is correct
this->ChildBeingDraggedOffset = ComputeDraggedTabOffset( MouseEvent.FindGeometry(SharedThis(this)), MouseEvent, InTabGrabOffsetFraction );
// Start dragging.
TSharedRef<FDockingDragOperation> DragDropOperation =
FDockingDragOperation::New(
TabToStartDragging,
InTabGrabOffsetFraction,
GetDockArea().ToSharedRef(),
ParentTabStackPtr.Pin()->GetTabStackGeometry().Size
);
return FReply::Handled().BeginDragDrop( DragDropOperation );
}
示例4: OnMouseButtonDown
/**
* See SWidget::OnMouseButtonDown.
*
* @param MyGeometry The Geometry of the widget receiving the event
* @param MouseEvent Information about the input event
*
* @return Whether the event was handled along with possible requests for the system to take action.
*/
FReply SCheckBox::OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if ( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
bIsPressed = true;
if( ClickMethod == EButtonClickMethod::MouseDown )
{
ToggleCheckedState();
const ECheckBoxState State = IsCheckboxChecked.Get();
if(State == ECheckBoxState::Checked)
{
PlayCheckedSound();
}
else if(State == ECheckBoxState::Unchecked)
{
PlayUncheckedSound();
}
// Set focus to this button, but don't capture the mouse
return FReply::Handled().SetUserFocus(AsShared(), EFocusCause::Mouse);
}
else
{
// Capture the mouse, and also set focus to this button
return FReply::Handled().CaptureMouse(AsShared()).SetUserFocus(AsShared(), EFocusCause::Mouse);
}
}
else if ( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && OnGetMenuContent.IsBound() )
{
FWidgetPath WidgetPath = MouseEvent.GetEventPath() != nullptr ? *MouseEvent.GetEventPath() : FWidgetPath();
FSlateApplication::Get().PushMenu(
AsShared(),
WidgetPath,
OnGetMenuContent.Execute(),
MouseEvent.GetScreenSpacePosition(),
FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu )
);
return FReply::Handled();
}
else
{
return FReply::Unhandled();
}
}
示例5: ChangeSelection
void SVisualLoggerTimelinesContainer::ChangeSelection(TSharedPtr<SLogVisualizerTimeline> InTimeline, const FPointerEvent& MouseEvent)
{
if (MouseEvent.IsLeftShiftDown() == false)
{
if (MouseEvent.IsLeftControlDown())
{
SetSelectionState(InTimeline, !InTimeline->IsSelected(), false);
}
else
{
SetSelectionState(InTimeline, true, true);
}
}
else
{
if (CachedSelectedTimelines.Num() == 0 && TimelineItems.Num())
{
SetSelectionState(TimelineItems[0], true, true);
}
TSharedPtr<SLogVisualizerTimeline> LastSelected = CachedSelectedTimelines.Num() ? CachedSelectedTimelines[CachedSelectedTimelines.Num() - 1] : nullptr;
if (LastSelected.IsValid())
{
bool bStartedSelection = false;
for (TSharedPtr<SLogVisualizerTimeline>& TimelineItem : TimelineItems)
{
if (TimelineItem == LastSelected || InTimeline == TimelineItem)
{
if (!bStartedSelection)
{
bStartedSelection = true;
}
else
{
bStartedSelection = false;
break;
}
}
if (bStartedSelection)
{
SetSelectionState(TimelineItem, true, false);
}
}
}
SetSelectionState(InTimeline, true, false);
}
}
示例6: 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();
}
示例7: OnSectionDoubleClicked
virtual FReply OnSectionDoubleClicked( const FGeometry& SectionGeometry, const FPointerEvent& MouseEvent ) override
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
Sequencer.Pin()->FocusSubMovieScene( MovieSceneInstance.Pin().ToSharedRef() );
}
return FReply::Handled();
}
示例8: OnMouseMove
FReply STrack::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
if (bDraggingBar && OnBarDrag.IsBound())
{
/** Update drag bar position if we are dragging */
FVector2D CursorPos = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() );
float NewDataPos = FMath::Clamp( LocalToDataX(CursorPos.X, MyGeometry), TrackMinValue.Get(), TrackMaxValue.Get() );
OnBarDrag.Execute(DraggableBarIndex, NewDataPos);
}
else if(DraggableBars.IsBound())
{
/** Update what bar is draggable if we arent already dragging */
UpdateDraggableBarIndex(MyGeometry, MouseEvent.GetScreenSpacePosition());
}
return FReply::Unhandled();
}
示例9: CheckForEdgeInteraction
void SSection::CheckForEdgeInteraction( const FPointerEvent& MouseEvent, const FGeometry& SectionGeometry )
{
bLeftEdgeHovered = false;
bRightEdgeHovered = false;
bLeftEdgePressed = false;
bRightEdgePressed = false;
if (!SectionInterface->SectionIsResizable())
{
return;
}
// Make areas to the left and right of the geometry. We will use these areas to determine if someone dragged the left or right edge of a section
FGeometry SectionRectLeft = SectionGeometry.MakeChild(
FVector2D::ZeroVector,
FVector2D( SequencerSectionConstants::SectionGripSize, SectionGeometry.Size.Y )
);
FGeometry SectionRectRight = SectionGeometry.MakeChild(
FVector2D( SectionGeometry.Size.X - SequencerSectionConstants::SectionGripSize, 0 ),
SectionGeometry.Size
);
if( SectionRectLeft.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ) )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
bLeftEdgePressed = true;
}
else
{
bLeftEdgeHovered = true;
}
}
else if( SectionRectRight.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ) )
{
if( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton )
{
bRightEdgePressed = true;
}
else
{
bRightEdgeHovered = true;
}
}
}
示例10: OnMouseMove
FReply SPaperEditorViewport::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
const bool bIsRightMouseButtonDown = MouseEvent.IsMouseButtonDown(EKeys::RightMouseButton);
const bool bIsLeftMouseButtonDown = MouseEvent.IsMouseButtonDown(EKeys::LeftMouseButton);
if (HasMouseCapture())
{
// Track how much the mouse moved since the mouse down.
const FVector2D CursorDelta = MouseEvent.GetCursorDelta();
TotalMouseDelta += CursorDelta.Size();
if (bIsRightMouseButtonDown)
{
FReply ReplyState = FReply::Handled();
if (!CursorDelta.IsZero())
{
bShowSoftwareCursor = true;
}
bIsPanning = true;
ViewOffset -= CursorDelta / GetZoomAmount();
return ReplyState;
}
else if (bIsLeftMouseButtonDown)
{
// TSharedPtr<SNode> NodeBeingDragged = NodeUnderMousePtr.Pin();
// Update the amount to pan panel
UpdateViewOffset(MyGeometry, MouseEvent.GetScreenSpacePosition());
const bool bCursorInDeadZone = TotalMouseDelta <= FSlateApplication::Get().GetDragTriggerDistance();
{
// We are marquee selecting
const FVector2D GraphMousePos = PanelCoordToGraphCoord( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ) );
Marquee.Rect.UpdateEndPoint(GraphMousePos);
return FReply::Handled();
}
}
}
return FReply::Unhandled();
}
示例11: OnMouseButtonDown
FReply SARActionItemWidget::OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (CurrentAbility.IsValid())
{
return FReply::Handled().DetectDrag(SharedThis(this), MouseEvent.GetEffectingButton()).CaptureMouse(SharedThis(this));
}
return FReply::Unhandled();
}
示例12: OnMouseMove
FReply SVisualLoggerTimelinesContainer::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
if (MouseEvent.GetEffectingButton() != EKeys::LeftMouseButton)
{
return TimeSliderController->OnMouseMove(*this, MyGeometry, MouseEvent);
}
return FReply::Unhandled();
}
示例13: OnMouseButtonDoubleClick
FReply SColorGradientEditor::OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent )
{
if( IsEditingEnabled.Get() == true )
{
// Select the stop under the mouse and open a color picker when it is double clicked
SelectedStop = GetGradientStopAtPoint( InMouseEvent.GetScreenSpacePosition(), InMyGeometry );
if( SelectedStop.IsValid( *CurveOwner ) )
{
ContextMenuPosition = InMouseEvent.GetScreenSpacePosition();
OpenGradientStopColorPicker();
return FReply::Handled();
}
}
return FReply::Unhandled();
}
示例14: OnMouseButtonUp
FReply FSequencerTimeSliderController::OnMouseButtonUp( TSharedRef<SWidget> WidgetOwner, const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
bool bHandleLeftMouseButton = MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && WidgetOwner->HasMouseCapture();
bool bHandleRightMouseButton = MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && WidgetOwner->HasMouseCapture() && TimeSliderArgs.AllowZoom ;
if ( bHandleRightMouseButton )
{
if (!bPanning)
{
// return unhandled in case our parent wants to use our right mouse button to open a context menu
return FReply::Unhandled().ReleaseMouseCapture();
}
bPanning = false;
return FReply::Handled().ReleaseMouseCapture();
}
else if ( bHandleLeftMouseButton )
{
if( bDraggingScrubber )
{
TimeSliderArgs.OnEndScrubberMovement.ExecuteIfBound();
}
else
{
FScrubRangeToScreen RangeToScreen( TimeSliderArgs.ViewRange.Get(), MyGeometry.Size );
FVector2D CursorPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetLastScreenSpacePosition());
float NewValue = RangeToScreen.LocalXToInput(CursorPos.X);
const USequencerSnapSettings* SnapSettings = GetDefault<USequencerSnapSettings>();
if ( SnapSettings->GetIsSnapEnabled() && SnapSettings->GetSnapPlayTimeToInterval() )
{
NewValue = SnapSettings->SnapToInterval( NewValue );
}
CommitScrubPosition( NewValue, /*bIsScrubbing=*/false );
}
bDraggingScrubber = false;
return FReply::Handled().ReleaseMouseCapture();
}
return FReply::Unhandled();
}
示例15: OnMouseButtonUp
FReply SScrubWidget::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent )
{
bool bHandleLeftMouseButton = MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && this->HasMouseCapture();
bool bHandleRightMouseButton = MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && this->HasMouseCapture() && bAllowZoom;
if ( bHandleRightMouseButton )
{
bPanning = false;
FTrackScaleInfo TimeScaleInfo(ViewInputMin.Get(), ViewInputMax.Get(), 0.f, 0.f, MyGeometry.Size);
FVector2D CursorPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetLastScreenSpacePosition());
float NewValue = TimeScaleInfo.LocalXToInput(CursorPos.X);
if( !bMouseMovedDuringPanning )
{
CreateContextMenu(NewValue, MouseEvent);
}
return FReply::Handled().ReleaseMouseCapture();
}
else if ( bHandleLeftMouseButton )
{
if(DraggingBar)
{
DraggingBar = false;
}
else if( bDragging )
{
OnEndSliderMovement.ExecuteIfBound( ValueAttribute.Get() );
}
else
{
FTrackScaleInfo TimeScaleInfo(ViewInputMin.Get(), ViewInputMax.Get(), 0.f, 0.f, MyGeometry.Size);
FVector2D CursorPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetLastScreenSpacePosition());
float NewValue = TimeScaleInfo.LocalXToInput(CursorPos.X);
CommitValue( NewValue, true, false );
}
bDragging = false;
return FReply::Handled().ReleaseMouseCapture();
}
return FReply::Unhandled();
}