MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getCursor

Method getCursor

Engine/source/gui/containers/guiWindowCtrl.cpp:1643–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1641//-----------------------------------------------------------------------------
1642
1643void GuiWindowCtrl::getCursor(GuiCursor *&cursor, bool &showCursor, const GuiEvent &lastGuiEvent)
1644{
1645 GuiCanvas *pRoot = getRoot();
1646 if( !pRoot )
1647 return;
1648 PlatformWindow *pWindow = static_cast<GuiCanvas*>(getRoot())->getPlatformWindow();
1649 AssertFatal(pWindow != NULL,"GuiControl without owning platform window! This should not be possible.");
1650 PlatformCursorController *pController = pWindow->getCursorController();
1651 AssertFatal(pController != NULL,"PlatformWindow without an owned CursorController!");
1652
1653 S32 desiredCursor = PlatformCursorController::curArrow;
1654 S32 hitEdges = findHitEdges( lastGuiEvent.mousePoint );
1655
1656 if( hitEdges & edgeBottom && hitEdges & edgeLeft && mResizeHeight )
1657 desiredCursor = PlatformCursorController::curResizeNESW;
1658 else if( hitEdges & edgeBottom && hitEdges & edgeRight && mResizeHeight )
1659 desiredCursor = PlatformCursorController::curResizeNWSE;
1660 else if( hitEdges & edgeBottom && mResizeHeight )
1661 desiredCursor = PlatformCursorController::curResizeHorz;
1662 else if( hitEdges & edgeTop && hitEdges & edgeLeft && mResizeHeight )
1663 desiredCursor = PlatformCursorController::curResizeNWSE;
1664 else if( hitEdges & edgeTop && hitEdges & edgeRight && mResizeHeight )
1665 desiredCursor = PlatformCursorController::curResizeNESW;
1666 else if( hitEdges & edgeTop && mResizeHeight )
1667 desiredCursor = PlatformCursorController::curResizeHorz;
1668 else if ( hitEdges & edgeLeft && mResizeWidth )
1669 desiredCursor = PlatformCursorController::curResizeVert;
1670 else if( hitEdges & edgeRight && mResizeWidth )
1671 desiredCursor = PlatformCursorController::curResizeVert;
1672 else
1673 desiredCursor = PlatformCursorController::curArrow;
1674
1675 // Bail if we're already at the desired cursor
1676 if(pRoot->mCursorChanged == desiredCursor )
1677 return;
1678
1679 // Now change the cursor shape
1680 pController->popCursor();
1681 pController->pushCursor(desiredCursor);
1682 pRoot->mCursorChanged = desiredCursor;
1683}
1684
1685//-----------------------------------------------------------------------------
1686

Callers

nothing calls this directly

Calls 4

getPlatformWindowMethod · 0.80
getCursorControllerMethod · 0.80
popCursorMethod · 0.80
pushCursorMethod · 0.80

Tested by

no test coverage detected