Merge pull request #2317 from Areloch/setSplitPoint

Adds ability to set the split point of a guiSplitContainer
This commit is contained in:
Areloch 2019-03-30 15:33:57 -05:00 committed by GitHub
commit 60f4e82cce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -613,3 +613,25 @@ void GuiSplitContainer::onMouseDragged( const GuiEvent &event )
solvePanelConstraints(newDragPos, firstPanel, secondPanel, clientRect);
}
}
void GuiSplitContainer::setSplitPoint(Point2I splitPoint)
{
GuiContainer *firstPanel = dynamic_cast<GuiContainer*>(at(0));
GuiContainer *secondPanel = dynamic_cast<GuiContainer*>(at(1));
// This function will constrain the panels to their minExtents and update the mSplitPoint
if (firstPanel && secondPanel)
{
RectI clientRect = getClientRect();
solvePanelConstraints(splitPoint, firstPanel, secondPanel, clientRect);
layoutControls(clientRect);
}
}
DefineEngineMethod(GuiSplitContainer, setSplitPoint, void, (Point2I splitPoint), ,
"Set the position of the split handle.")
{
object->setSplitPoint(splitPoint);
}

View file

@ -87,6 +87,9 @@ public:
virtual void solvePanelConstraints(Point2I newDragPos, GuiContainer * firstPanel, GuiContainer * secondPanel, const RectI& clientRect);
virtual Point2I getMinExtent() const;
//Set the positin of the split handler
void setSplitPoint(Point2I splitPoint);
protected:
S32 mFixedPanel;