MCPcopy Create free account
hub / github.com/SpartanJ/eepp / resizeWindowToLayout

Method resizeWindowToLayout

src/tools/uieditor/uieditor.cpp:548–571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

546}
547
548void App::resizeWindowToLayout() {
549 if ( mLayoutExpanded )
550 return;
551
552 Sizef size( mUIContainer->getSize() );
553 Rect borderSize( mWindow->getBorderSize() );
554 Sizei displayMode = Engine::instance()
555 ->getDisplayManager()
556 ->getDisplayIndex( mWindow->getCurrentDisplayIndex() )
557 ->getUsableBounds()
558 .getSize();
559 displayMode.x = displayMode.x - borderSize.Left - borderSize.Right;
560 displayMode.y = displayMode.y - borderSize.Top - borderSize.Bottom;
561
562 Float scaleW =
563 size.getWidth() > displayMode.getWidth() ? displayMode.getWidth() / size.getWidth() : 1.f;
564 Float scaleH = size.getHeight() > displayMode.getHeight()
565 ? displayMode.getHeight() / size.getHeight()
566 : 1.f;
567 Float scale = scaleW < scaleH ? scaleW : scaleH;
568
569 mWindow->setSize( (Uint32)( size.getWidth() * scale ), (Uint32)( size.getHeight() * scale ) );
570 mWindow->centerToDisplay();
571}
572
573UIWidget* App::createWidget( std::string widgetName ) {
574 return UIWidgetCreator::createFromName( mWidgetRegistered[widgetName] );

Callers

nothing calls this directly

Calls 10

getUsableBoundsMethod · 0.80
getDisplayIndexMethod · 0.80
getDisplayManagerMethod · 0.80
centerToDisplayMethod · 0.80
getSizeMethod · 0.45
getBorderSizeMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
setSizeMethod · 0.45

Tested by

no test coverage detected