FReply STableViewBase::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if ( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton ) { OnRightMouseButtonUp( MouseEvent ); FReply Reply = FReply::Handled().ReleaseMouseCapture(); bShowSoftwareCursor = false; // If we have mouse capture, snap the mouse back to the closest location that is within the list's bounds if ( HasMouseCapture() ) { FSlateRect ListScreenSpaceRect = MyGeometry.GetClippingRect(); FVector2D CursorPosition = MyGeometry.LocalToAbsolute( SoftwareCursorPosition ); FIntPoint BestPositionInList( FMath::RoundToInt( FMath::Clamp( CursorPosition.X, ListScreenSpaceRect.Left, ListScreenSpaceRect.Right ) ), FMath::RoundToInt( FMath::Clamp( CursorPosition.Y, ListScreenSpaceRect.Top, ListScreenSpaceRect.Bottom ) ) ); Reply.SetMousePos(BestPositionInList); } return Reply; } return FReply::Unhandled(); }
bool SGraphPanel::IsNodeTitleVisible(const class UEdGraphNode* Node, bool bRequestRename) { bool bTitleVisible = false; TSharedRef<SNode>* pWidget = NodeToWidgetLookup.Find(Node); if (pWidget != NULL) { TWeakPtr<SGraphNode> GraphNode = StaticCastSharedRef<SGraphNode>(*pWidget); if(GraphNode.IsValid() && !HasMouseCapture()) { FSlateRect TitleRect = GraphNode.Pin()->GetTitleRect(); const FVector2D TopLeft = FVector2D( TitleRect.Left, TitleRect.Top ); const FVector2D BottomRight = FVector2D( TitleRect.Right, TitleRect.Bottom ); if( IsRectVisible( TopLeft, BottomRight )) { bTitleVisible = true; } else if( bRequestRename ) { bTitleVisible = JumpToRect( TopLeft, BottomRight ); } if( bTitleVisible && bRequestRename ) { GraphNode.Pin()->RequestRename(); SelectAndCenterObject(Node, false); } } } return bTitleVisible; }
FReply SColorGradientEditor::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if( HasMouseCapture() && IsEditingEnabled.Get() == true ) { DistanceDragged += FMath::Abs( MouseEvent.GetCursorDelta().X ); if( MouseEvent.IsMouseButtonDown( EKeys::LeftMouseButton ) && SelectedStop.IsValid( *CurveOwner ) ) { const float DragThresholdDist = 5.0f; if( !bDraggingStop ) { if( DistanceDragged >= DragThresholdDist ) { // Start a transaction, we just started dragging a stop bDraggingStop = true; GEditor->BeginTransaction( LOCTEXT("MoveGradientStop", "Move Gradient Stop") ); CurveOwner->ModifyOwner(); } return FReply::Handled(); } else { // Already dragging a stop, move it FTrackScaleInfo ScaleInfo(ViewMinInput.Get(), ViewMaxInput.Get(), 0.0f, 1.0f, MyGeometry.Size); float MouseTime = ScaleInfo.LocalXToInput( MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ).X ); MoveStop( SelectedStop, MouseTime ); return FReply::Handled(); } } } return FReply::Unhandled(); }
FReply SButton::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { FReply Reply = FReply::Unhandled(); const bool bMustBePressed = ClickMethod == EButtonClickMethod::DownAndUp; const bool bMeetsPressedRequirements = (!bMustBePressed || (bIsPressed && bMustBePressed)); if (bMeetsPressedRequirements && IsEnabled() && ( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton || MouseEvent.IsTouchEvent() ) ) { Release(); if( ClickMethod == EButtonClickMethod::MouseDown ) { // NOTE: If we're configured to click on mouse-down/precise-tap, then we never capture the mouse thus // may never receive an OnMouseButtonUp() call. We make sure that our bIsPressed // state is reset by overriding OnMouseLeave(). } else { bool bEventOverButton = IsHovered(); if (!bEventOverButton && MouseEvent.IsTouchEvent()) { bEventOverButton = MyGeometry.IsUnderLocation(MouseEvent.GetScreenSpacePosition()); } if (bEventOverButton) { // If we asked for a precise tap, all we need is for the user to have not moved their pointer very far. const bool bTriggerForTouchEvent = IsPreciseTapOrClick(MouseEvent); // If we were asked to allow the button to be clicked on mouse up, regardless of whether the user // pressed the button down first, then we'll allow the click to proceed without an active capture const bool bTriggerForMouseEvent = ( ClickMethod == EButtonClickMethod::MouseUp || HasMouseCapture() ); if( (bTriggerForTouchEvent || bTriggerForMouseEvent) && OnClicked.IsBound() == true ) { Reply = OnClicked.Execute(); } } } //If the user of the button didn't handle this click, then the button's //default behavior handles it. if ( Reply.IsEventHandled() == false ) { Reply = FReply::Handled(); } //If the user hasn't requested a new mouse captor and the button still has mouse capture, //then the default behavior of the button is to release mouse capture. if (Reply.GetMouseCaptor().IsValid() == false && HasMouseCapture()) { Reply.ReleaseMouseCapture(); } } Invalidate(EInvalidateWidget::Layout); return Reply; }
void SSection::OnMouseLeave( const FPointerEvent& MouseEvent ) { SCompoundWidget::OnMouseLeave( MouseEvent ); if( !HasMouseCapture() ) { ResetHoveredState(); } }
void SProfilerThreadView::OnMouseLeave( const FPointerEvent& MouseEvent ) { if( !HasMouseCapture() ) { bIsLeftMousePressed = false; bIsRightMousePressed = false; CursorType = EThreadViewCursor::Default; } }
FReply SColorWheel::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if (!HasMouseCapture()) { return FReply::Unhandled(); } ProcessMouseAction(MyGeometry, MouseEvent, true); return FReply::Handled(); }
bool DesktopWindowManager::ReleaseMouseCapture(view::Widget* widget) { if(!widget || mouse_capture_!=widget) { return false; } DCHECK(HasMouseCapture()); ReleaseMouseCapture(); mouse_capture_ = NULL; return true; }
void DesktopWindowManager::StartResizeDrag( view::Widget* widget, const gfx::Point& point, int hittest_code) { DCHECK(!window_controller_.get()); DCHECK(!HasMouseCapture()); if(!widget->IsMaximized() && !widget->IsMinimized() && (widget->widget_delegate() || widget->widget_delegate()->CanResize())) { SetMouseCapture(); window_controller_.reset(new ResizeWindowController(widget)); } }
FReply SColorWheel::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton && HasMouseCapture()) { OnMouseCaptureEnd.ExecuteIfBound(); return FReply::Handled().ReleaseMouseCapture(); } else { return FReply::Unhandled(); } }
bool DesktopWindowManager::SetMouseCapture(view::Widget* widget) { if(mouse_capture_) { return false; } if(mouse_capture_ == widget) { return true; } DCHECK(!HasMouseCapture()); SetMouseCapture(); mouse_capture_ = widget; return true; }
FReply SSlider::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if ((MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) && HasMouseCapture()) { SetCursor(EMouseCursor::Default); OnMouseCaptureEnd.ExecuteIfBound(); // Release capture for controller/keyboard when switching to mouse. ResetControllerState(); return FReply::Handled().ReleaseMouseCapture(); } return FReply::Unhandled(); }
FCursorReply SSequencerTrackArea::OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent ) const { if (CursorEvent.IsMouseButtonDown(EKeys::RightMouseButton) && HasMouseCapture()) { return FCursorReply::Cursor(EMouseCursor::GrabHandClosed); } auto SequencerPin = SequencerWidget.Pin(); if (SequencerPin.IsValid()) { return SequencerPin->GetEditTool().OnCursorQuery(MyGeometry, CursorEvent); } return FCursorReply::Unhandled(); }
FReply STableViewBase::OnTouchEnded( const FGeometry& MyGeometry, const FPointerEvent& InTouchEvent ) { AmountScrolledWhileRightMouseDown = 0; bStartedTouchInteraction = false; if (HasMouseCapture()) { return FReply::Handled().ReleaseMouseCapture(); } else { return FReply::Handled(); } }
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(); }
void SPaperEditorViewport::Tick( const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime ) { // Handle any deferred panning if (bRequestDeferredPan) { bRequestDeferredPan = false; UpdateViewOffset(AllottedGeometry, DeferredPanPosition); } if (!HasMouseCapture()) { bShowSoftwareCursor = false; bIsPanning = false; } PaperViewportClient->SetZoomPos( ViewOffset, GetZoomAmount() ); PaperViewportClient->bNeedsRedraw = true; bool bSelectionModified = false; if (Marquee.IsValid()) { bSelectionModified = true; OnSelectionChanged.ExecuteIfBound(Marquee, true); } if (bSelectionModified || bIsPanning || FSlateThrottleManager::Get().IsAllowingExpensiveTasks()) { // Setup the selection set for the viewport PaperViewportClient->SelectionRectangles.Empty(); if (Marquee.IsValid()) { FViewportSelectionRectangle& Rect = *(new (PaperViewportClient->SelectionRectangles) FViewportSelectionRectangle); Rect.Color = FColorList::Yellow; Rect.Color.A = 0.45f; Rect.TopLeft = Marquee.Rect.GetUpperLeft(); Rect.Dimensions = Marquee.Rect.GetSize(); } // Tick and render the viewport PaperViewportClient->Tick(InDeltaTime); GEditor->UpdateSingleViewportClient(PaperViewportClient.Get(), /*bInAllowNonRealtimeViewportToDraw=*/ true, /*bLinkedOrthoMovement=*/ false); } }
void DesktopWindowManager::StartMoveDrag( view::Widget* widget, const gfx::Point& point) { DCHECK(!window_controller_.get()); DCHECK(!HasMouseCapture()); if(!widget->IsMaximized() && !widget->IsMinimized()) { gfx::Point new_point = point; if(desktop_->non_client_view()) { gfx::Rect client = desktop_->non_client_view()->frame_view()-> GetBoundsForClientView(); new_point.Offset(client.x(), client.y()); } SetMouseCapture(); window_controller_.reset(new MoveWindowController(widget, new_point)); } }
FReply STransformHandle::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { if ( HasMouseCapture() && MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton ) { const bool bRequiresRecompile = false; Designer->MarkDesignModifed(bRequiresRecompile); if ( ScopedTransaction ) { delete ScopedTransaction; ScopedTransaction = nullptr; } Action = ETransformAction::None; return FReply::Handled().ReleaseMouseCapture(); } return FReply::Unhandled(); }
FReply SSequencerTrackArea::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { auto SequencerPin = SequencerWidget.Pin(); if (SequencerPin.IsValid()) { FReply Reply = SequencerPin->GetEditTool().OnMouseMove(*this, MyGeometry, MouseEvent); if (Reply.IsEventHandled()) { return Reply; } } if (MouseEvent.IsMouseButtonDown(EKeys::RightMouseButton) && HasMouseCapture()) { TreeView.Pin()->ScrollByDelta( -MouseEvent.GetCursorDelta().Y ); } return TimeSliderController->OnMouseMove( SharedThis(this), MyGeometry, MouseEvent ); }
/** * See SWidget::OnMouseButtonUp. * * @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::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if ( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton ) { bIsPressed = false; if( ClickMethod == EButtonClickMethod::MouseDown ) { // NOTE: If we're configured to click on mouse-down, then we never capture the mouse thus // may never receive an OnMouseButtonUp() call. We make sure that our bIsPressed // state is reset by overriding OnMouseLeave(). } else { const bool IsUnderMouse = MyGeometry.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ); if ( IsUnderMouse ) { // If we were asked to allow the button to be clicked on mouse up, regardless of whether the user // pressed the button down first, then we'll allow the click to proceed without an active capture if( ClickMethod == EButtonClickMethod::MouseUp || HasMouseCapture() ) { ToggleCheckedState(); const TAttribute<ESlateCheckBoxState::Type>& State = IsCheckboxChecked.Get(); if(State == ESlateCheckBoxState::Checked) { PlayCheckedSound(); } else if(State == ESlateCheckBoxState::Unchecked) { PlayUncheckedSound(); } } } } return FReply::Handled().ReleaseMouseCapture(); } return FReply::Unhandled(); }
virtual FReply OnMouseButtonUp(const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent) override { if (!InMouseEvent.IsControlDown()) { return SCheckBox::OnMouseButtonUp(InMyGeometry, InMouseEvent); } if (InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) { bIsPressed = false; if (IsHovered() && HasMouseCapture()) { if (OnLayerCtrlClicked.IsBound()) { return OnLayerCtrlClicked.Execute(); } } } return FReply::Handled().ReleaseMouseCapture(); }
FReply SAnimationOutlinerTreeNode::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && HasMouseCapture() ) { TSharedPtr<SWidget> MenuContent = DisplayNode->OnSummonContextMenu(MyGeometry, MouseEvent); if (MenuContent.IsValid()) { FSlateApplication::Get().PushMenu( AsShared(), MenuContent.ToSharedRef(), MouseEvent.GetScreenSpacePosition(), FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu ) ); return FReply::Handled().ReleaseMouseCapture().SetUserFocus(MenuContent.ToSharedRef(), EFocusCause::SetDirectly); } return FReply::Handled().ReleaseMouseCapture(); } return FReply::Unhandled(); }
FReply SSection::OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if( bDragging && DragOperation.IsValid() ) { // If dragging tell the operation we are no longer dragging DragOperation->OnEndDrag(ParentSectionArea); } else { if( ( MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton || MouseEvent.GetEffectingButton() == EKeys::RightMouseButton ) && HasMouseCapture() && MyGeometry.IsUnderLocation( MouseEvent.GetScreenSpacePosition() ) ) { HandleSelection( MyGeometry, MouseEvent ); } if( MouseEvent.GetEffectingButton() == EKeys::RightMouseButton && HasMouseCapture() ) { TSharedPtr<SWidget> MenuContent = OnSummonContextMenu( MyGeometry, MouseEvent ); if (MenuContent.IsValid()) { FWidgetPath WidgetPath = MouseEvent.GetEventPath() != nullptr ? *MouseEvent.GetEventPath() : FWidgetPath(); FSlateApplication::Get().PushMenu( AsShared(), WidgetPath, MenuContent.ToSharedRef(), MouseEvent.GetScreenSpacePosition(), FPopupTransitionEffect( FPopupTransitionEffect::ContextMenu ) ); return FReply::Handled().ReleaseMouseCapture().SetUserFocus(MenuContent.ToSharedRef(), EFocusCause::SetDirectly); } } } ResetState(); return FReply::Handled().ReleaseMouseCapture(); }
FReply SProfilerThreadView::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { // SCOPE_LOG_TIME_FUNC(); FReply Reply = FReply::Unhandled(); if( IsReady() ) { const FVector2D LocalMousePosition = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ); HoveredPositionX = 0.0;//PositionToFrameIndex( LocalMousePosition.X ); HoveredPositionY = 0.0; const float CursorPosXDelta = -MouseEvent.GetCursorDelta().X; const float ScrollSpeed = 1.0f / ZoomFactorX; if( MouseEvent.IsMouseButtonDown( EKeys::LeftMouseButton ) ) { if( HasMouseCapture() && !MouseEvent.GetCursorDelta().IsZero() ) { DistanceDragged += CursorPosXDelta*ScrollSpeed*0.1; // Inform other widgets that we have scrolled the thread-view. SetPositionX( FMath::Clamp( DistanceDragged, 0.0, TotalRangeXMS - RangeXMS ) ); CursorType = EThreadViewCursor::Hand; Reply = FReply::Handled(); } } else { CursorType = EThreadViewCursor::Default; } } return Reply; }
FReply SPaperEditorViewport::OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { // Did the user move the cursor sufficiently far, or is it in a dead zone? // In Dead zone - implies actions like summoning context menus and general clicking. // Out of Dead Zone - implies dragging actions like moving nodes and marquee selection. const bool bCursorInDeadZone = TotalMouseDelta <= FSlateApplication::Get().GetDragTriggerDistance(); if (MouseEvent.GetEffectingButton() == EKeys::RightMouseButton) { FReply ReplyState = FReply::Handled(); if (HasMouseCapture()) { FSlateRect ThisPanelScreenSpaceRect = MyGeometry.GetClippingRect(); const FVector2D ScreenSpaceCursorPos = MyGeometry.LocalToAbsolute( GraphCoordToPanelCoord( SoftwareCursorPosition ) ); FIntPoint BestPositionInViewport( FMath::RoundToInt( FMath::Clamp( ScreenSpaceCursorPos.X, ThisPanelScreenSpaceRect.Left, ThisPanelScreenSpaceRect.Right ) ), FMath::RoundToInt( FMath::Clamp( ScreenSpaceCursorPos.Y, ThisPanelScreenSpaceRect.Top, ThisPanelScreenSpaceRect.Bottom ) ) ); if (!bCursorInDeadZone) { ReplyState.SetMousePos(BestPositionInViewport); } } TSharedPtr<SWidget> WidgetToFocus; if (bCursorInDeadZone) { //WidgetToFocus = OnSummonContextMenu(MyGeometry, MouseEvent); } bShowSoftwareCursor = false; bIsPanning = false; return (WidgetToFocus.IsValid()) ? ReplyState.ReleaseMouseCapture().SetUserFocus(WidgetToFocus.ToSharedRef(), EFocusCause::SetDirectly) : ReplyState.ReleaseMouseCapture(); } else if (MouseEvent.GetEffectingButton() == EKeys::LeftMouseButton) { if (OnHandleLeftMouseRelease(MyGeometry, MouseEvent)) { } else if (bCursorInDeadZone) { //@TODO: Move to selection manager // if ( NodeUnderMousePtr.IsValid() ) // { // // We clicked on a node! // TSharedRef<SNode> NodeWidgetUnderMouse = NodeUnderMousePtr.Pin().ToSharedRef(); // // SelectionManager.ClickedOnNode(NodeWidgetUnderMouse->GetObjectBeingDisplayed(), MouseEvent); // // // We're done interacting with this node. // NodeUnderMousePtr.Reset(); // } // else if (HasMouseCapture()) { // We clicked on the panel background //@TODO: There isn't a marquee operation for clear, need to signal to remove existing sets too! //Marquee.End(); //OnSelectionChanged.ExecuteIfBound(Marquee, false); } } else if (Marquee.IsValid()) { //ApplyMarqueeSelection(Marquee, SelectionManager.SelectedNodes, SelectionManager.SelectedNodes); //SelectionManager.OnSelectionChanged.ExecuteIfBound(SelectionManager.SelectedNodes); OnSelectionChanged.ExecuteIfBound(Marquee, true); } // The existing marquee operation ended; reset it. Marquee = FMarqueeOperation(); if (bIsPanning) { // We have released the left mouse button. But we're still panning // (i.e. RIGHT MOUSE is down), so we want to hold on to capturing mouse input. return FReply::Handled(); } else { // We aren't panning, so we can release the mouse capture. return FReply::Handled().ReleaseMouseCapture(); } } return FReply::Unhandled(); }
FReply SSection::OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) { if( HasMouseCapture() ) { // Have mouse capture and there are drag operations that need to be performed if( MouseEvent.IsMouseButtonDown( EKeys::LeftMouseButton ) ) { DistanceDragged += FMath::Abs( MouseEvent.GetCursorDelta().X ); FVector2D LocalMousePos = MyGeometry.AbsoluteToLocal( MouseEvent.GetScreenSpacePosition() ); if( !bDragging ) { // If we are not dragging determine if the mouse has moved far enough to start a drag if( DistanceDragged >= SequencerSectionConstants::SectionDragStartDistance ) { bDragging = true; if( PressedKey.IsValid() ) { // Clear selected sections when beginning to drag keys GetSequencer().GetSelection().EmptySelectedSections(); bool bSelectDueToDrag = true; HandleKeySelection( PressedKey, MouseEvent, bSelectDueToDrag ); bool bKeysUnderMouse = true; CreateDragOperation( MyGeometry, MouseEvent, bKeysUnderMouse ); } else { // Clear selected keys when beginning to drag a section GetSequencer().GetSelection().EmptySelectedKeys(); HandleSectionSelection( MouseEvent ); bool bKeysUnderMouse = false; CreateDragOperation( MyGeometry, MouseEvent, bKeysUnderMouse ); } if( DragOperation.IsValid() ) { DragOperation->OnBeginDrag(LocalMousePos, ParentSectionArea); } } } else if( DragOperation.IsValid() ) { // Already in a drag, tell all operations to perform their drag implementations FTimeToPixel TimeToPixelConverter = SectionInterface->GetSectionObject()->IsInfinite() ? FTimeToPixel( ParentGeometry, GetSequencer().GetViewRange()) : FTimeToPixel( MyGeometry, TRange<float>( SectionInterface->GetSectionObject()->GetStartTime(), SectionInterface->GetSectionObject()->GetEndTime() ) ); DragOperation->OnDrag( MouseEvent, LocalMousePos, TimeToPixelConverter, ParentSectionArea ); } } return FReply::Handled(); } else { // Not dragging ResetHoveredState(); // Checked for hovered key // @todo Sequencer - Needs visual cue HoveredKey = GetKeyUnderMouse( MouseEvent.GetScreenSpacePosition(), MyGeometry ); // Only check for edge interaction if not hovering over a key if( !HoveredKey.IsValid() ) { CheckForEdgeInteraction( MouseEvent, MyGeometry ); } } return FReply::Unhandled(); }
// // ICWindowTitle::HandleEvent // U32 ICWindowTitle::HandleEvent(Event &e) { if (e.type == Input::EventID()) { // Input events switch (e.subType) { case Input::MOUSEBUTTONDOWN: case Input::MOUSEBUTTONDBLCLK: { if (e.input.code == Input::LeftButtonCode()) { // Don't move window if it has immovable style ICWindow *parentWnd = IFace::Promote<ICWindow>(parent); if (parentWnd && !(parentWnd->GetWinStyle() & ICWindow::STYLE_IMMOVABLE)) { // Take mouse capture GetMouseCapture(); // Raise window SendNotify(parent, ICWindowMsg::Raise, FALSE); // Start dragging dragPos = Point<S32>(e.input.mouseX, e.input.mouseY); } } break; } case Input::MOUSEBUTTONUP: case Input::MOUSEBUTTONDBLCLKUP: { if (e.input.code == Input::LeftButtonCode()) { // Release mouse capture if (HasMouseCapture()) { ReleaseMouseCapture(); } // Handled return (TRUE); } // Not handled break; } case Input::MOUSEMOVE: { if (HasMouseCapture()) { ASSERT(parent); // Track the mouse Point<S32> mouse = Point<S32>(e.input.mouseX, e.input.mouseY); Point<S32> newPos = parent->GetPos() + mouse - dragPos; parent->MoveTo(newPos); dragPos = mouse; // Don't allow button to process this return (TRUE); } break; } } } // This event can't be handled by this control, so pass it to the parent class return (IControl::HandleEvent(e)); }
// // HandleEvent // // Passes events through to the user // U32 ICGrid::HandleEvent(Event &e) { if (e.type == Input::EventID()) { // Input events switch (e.subType) { case Input::MOUSEBUTTONDOWN: case Input::MOUSEBUTTONDBLCLK: { // Is the click inside the client area if (InClient(Point<S32>(e.input.mouseX, e.input.mouseY))) { // Ignore if we already have capture if (IFace::GetCapture() != this) { // Grab capture GetMouseCapture(); // Save mouse code captureCode = e.input.code; } } break; } case Input::MOUSEBUTTONUP: case Input::MOUSEBUTTONDBLCLKUP: { if (HasMouseCapture() && e.input.code == captureCode) { ReleaseMouseCapture(); // Get mouse position relative to client window Point<S32> p = ScreenToClient(Point<S32>(e.input.mouseX, e.input.mouseY)); // Calculate the (flipped) cell positions U32 x = xFlip ? gridSize.x - (p.x / cellSize.x) - 1 : p.x / cellSize.x; U32 y = yFlip ? gridSize.y - (p.y / cellSize.y) - 1 : p.y / cellSize.y; // Set currently selected if (x < gridSize.x && y < gridSize.y) { selected.Set(x, y); } if (captureCode == Input::LeftButtonCode()) { CallEventHandler(0x90E4DA5D); // "LeftClick" } else if (captureCode == Input::MidButtonCode()) { CallEventHandler(0x316EC946); // "MiddleClick" } else if (captureCode == Input::RightButtonCode()) { CallEventHandler(0x173F5F78); // "RightClick" } return (TRUE); } break; } } } // Allow parent class to process this event return IControl::HandleEvent(e); }