MCPcopy Create free account
hub / github.com/TankOs/SFGUI / GetClientRect

Method GetClientRect

src/SFGUI/Window.cpp:45–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45sf::FloatRect Window::GetClientRect() const {
46 sf::FloatRect clientrect( { 0, 0 }, { GetAllocation().size.x, GetAllocation().size.y } );
47 float border_width( Context::Get().GetEngine().GetProperty<float>( "BorderWidth", shared_from_this() ) );
48 float gap( Context::Get().GetEngine().GetProperty<float>( "Gap", shared_from_this() ) );
49
50 clientrect.position.x += border_width + gap;
51 clientrect.position.y += border_width + gap;
52 clientrect.size.x -= 2 * border_width + 2 * gap;
53 clientrect.size.y -= 2 * border_width + 2 * gap;
54
55 if( HasStyle( TITLEBAR ) ) {
56 unsigned int title_font_size( Context::Get().GetEngine().GetProperty<unsigned int>( "FontSize", shared_from_this() ) );
57 const sf::Font& title_font( *Context::Get().GetEngine().GetResourceManager().GetFont( Context::Get().GetEngine().GetProperty<std::string>( "FontName", shared_from_this() ) ) );
58 float title_height(
59 Context::Get().GetEngine().GetFontLineHeight( title_font, title_font_size ) +
60 2 * Context::Get().GetEngine().GetProperty<float>( "TitlePadding", shared_from_this() )
61 );
62
63 clientrect.position.y += title_height;
64 clientrect.size.y -= title_height;
65 }
66
67 return clientrect;
68}
69
70void Window::HandleSizeChange() {
71 if( !GetChild() ) {

Callers

nothing calls this directly

Calls 1

GetFontLineHeightMethod · 0.80

Tested by

no test coverage detected