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

Method parentResized

Engine/source/gui/containers/guiWindowCtrl.cpp:1717–1911  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1715//-----------------------------------------------------------------------------
1716
1717void GuiWindowCtrl::parentResized(const RectI &oldParentRect, const RectI &newParentRect)
1718{
1719 if(!mCanResize)
1720 return;
1721
1722 GuiControl *parent = getParent();
1723 if( !parent )
1724 return;
1725
1726 // Bail if were not sized both by windowrelative
1727 if( mHorizSizing != horizResizeWindowRelative || mHorizSizing != vertResizeWindowRelative )
1728 return Parent::parentResized( oldParentRect, newParentRect );
1729
1730 Point2I newPosition = getPosition();
1731 Point2I newExtent = getExtent();
1732
1733 bool doCollapse = false;
1734
1735 S32 deltaX = newParentRect.extent.x - oldParentRect.extent.x;
1736 S32 deltaY = newParentRect.extent.y - oldParentRect.extent.y;// + mProfile->mYPositionOffset;
1737
1738 if( newPosition.x > ( oldParentRect.extent.x / 2 ) )
1739 newPosition.x = newPosition.x + deltaX;
1740
1741 if (oldParentRect.extent.y != 0)
1742 {
1743 // Only if were apart of a group
1744 if ( mCanCollapse && mCollapseGroup >= 0 )
1745 {
1746 // Setup parsing mechanisms
1747 CollapseGroupNumVec collapseGroupNumVec;
1748
1749 // Lets grab the information we need (this should probably be already stored on each individual window object)
1750 S32 groupNum = mCollapseGroup;
1751 S32 groupMax = parent->mCollapseGroupVec[ groupNum ].size() - 1;
1752
1753 // Set up vars that we're going to be using
1754 S32 groupPos = 0;
1755 S32 groupExtent = 0;
1756 S32 tempGroupExtent = 0;
1757
1758 // Set up the vector/iterator combo we need
1759 collapseGroupNumVec = parent->mCollapseGroupVec[ groupNum ];
1760 CollapseGroupNumVec::iterator iter = collapseGroupNumVec.begin();
1761
1762 // Grab some more information we need later ( this info should also be located on each ind. window object )
1763 for( ; iter != collapseGroupNumVec.end(); iter++ )
1764 {
1765 if((*iter)->getCollapseGroupNum() == 0)
1766 {
1767 groupPos = (*iter)->getPosition().y;
1768 }
1769
1770 groupExtent += (*iter)->getExtent().y;
1771 }
1772
1773 // Use the information we just gatherered; only enter this block if we need to
1774 tempGroupExtent = groupPos + groupExtent;

Callers

nothing calls this directly

Calls 13

getPositionFunction · 0.85
getMinExtentFunction · 0.85
getBoundsFunction · 0.85
beginFunction · 0.85
endFunction · 0.85
getExtentMethod · 0.80
resizeFunction · 0.50
Point2IClass · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getPositionMethod · 0.45

Tested by

no test coverage detected