MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / onMouseDown

Method onMouseDown

Engine/source/gui/containers/guiWindowCtrl.cpp:736–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734//-----------------------------------------------------------------------------
735
736void GuiWindowCtrl::onMouseDown(const GuiEvent &event)
737{
738 setUpdate();
739
740 mOrigBounds = getBounds();
741
742 mMouseDownPosition = event.mousePoint;
743 Point2I localPoint = globalToLocalCoord(event.mousePoint);
744
745 // Select this window - move it to the front, and set the first responder
746 selectWindow();
747
748 mMouseMovingWin = false;
749
750 S32 hitEdges = findHitEdges( event.mousePoint );
751
752 mResizeEdge = edgeNone;
753
754 // Set flag by default so we only clear it
755 // if we don't match either edge
756 mMouseResizeHeight = true;
757
758 // Check Bottom/Top edges (Mutually Exclusive)
759 if( mResizeHeight && hitEdges & edgeBottom )
760 mResizeEdge |= edgeBottom;
761 else if( mResizeHeight && hitEdges & edgeTop )
762 mResizeEdge |= edgeTop;
763 else
764 mMouseResizeHeight = false;
765
766 // Set flag by default so we only clear it
767 // if we don't match either edge
768 mMouseResizeWidth = true;
769
770 // Check Left/Right edges (Mutually Exclusive)
771 if( mResizeWidth && hitEdges & edgeLeft )
772 mResizeEdge |= edgeLeft;
773 else if( mResizeWidth && hitEdges & edgeRight )
774 mResizeEdge |= edgeRight;
775 else
776 mMouseResizeWidth = false;
777
778
779 // If we clicked within the title bar
780 if ( !(mResizeEdge & ( edgeTop | edgeLeft | edgeRight ) ) && localPoint.y < mTitleHeight)
781 {
782 if (mCanClose && mCloseButton.pointInRect(localPoint))
783 {
784 mCloseButtonPressed = mCanClose;
785 }
786 else if (mCanMaximize && mMaximizeButton.pointInRect(localPoint))
787 {
788 mMaximizeButtonPressed = mCanMaximize;
789 }
790 else if (mCanMinimize && mMinimizeButton.pointInRect(localPoint))
791 {
792 mMinimizeButtonPressed = mCanMinimize;
793 }

Callers

nothing calls this directly

Calls 2

getBoundsFunction · 0.85
pointInRectMethod · 0.80

Tested by

no test coverage detected