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

Method dockControl

Engine/source/gui/containers/guiContainer.cpp:252–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250//-----------------------------------------------------------------------------
251
252bool GuiContainer::dockControl( GuiContainer *control, S32 dockingMode, RectI &clientRect )
253{
254 if( !control )
255 return false;
256
257 // Make sure this class support docking of this type
258 if( !(dockingMode & getValidDockingMask()))
259 return false;
260
261 // If our client rect has run out of room, we can't dock any more
262 if( !clientRect.isValidRect() )
263 return false;
264
265 // Dock Appropriately
266 RectI dockRect;
267 RectSpacingI rectShrinker;
268 ControlSizing sizingOptions = control->getSizingOptions();
269 switch( dockingMode )
270 {
271 case Docking::dockClient:
272
273 // Inset by padding
274 sizingOptions.mPadding.insetRect(clientRect);
275
276 // Dock to entirety of client rectangle
277 control->resize( clientRect.point, clientRect.extent );
278
279 // Remove Client Rect, can only have one client dock
280 clientRect.set(0,0,0,0);
281 break;
282 case Docking::dockTop:
283
284 dockRect = clientRect;
285 dockRect.extent.y = getMin( control->getHeight() + sizingOptions.mPadding.top + sizingOptions.mPadding.bottom , clientRect.extent.y );
286
287 // Subtract our rect
288 clientRect.point.y += dockRect.extent.y;
289 clientRect.extent.y -= dockRect.extent.y;
290
291 // Inset by padding
292 sizingOptions.mPadding.insetRect(dockRect);
293
294 // Resize
295 control->resize( dockRect.point, dockRect.extent );
296
297 break;
298 case Docking::dockBottom:
299
300 dockRect = clientRect;
301 dockRect.extent.y = getMin( control->getHeight() + sizingOptions.mPadding.top + sizingOptions.mPadding.bottom, clientRect.extent.y );
302 dockRect.point.y += clientRect.extent.y - dockRect.extent.y;
303
304 // Subtract our rect
305 clientRect.extent.y -= dockRect.extent.y;
306
307 // Inset by padding
308 sizingOptions.mPadding.insetRect(dockRect);
309

Callers

nothing calls this directly

Calls 8

getSizingOptionsMethod · 0.80
insetRectMethod · 0.80
setUpdateLayoutMethod · 0.80
isValidRectMethod · 0.45
resizeMethod · 0.45
setMethod · 0.45
getHeightMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected