| 99 | } |
| 100 | |
| 101 | sf::Vector2f Window::CalculateRequisition() { |
| 102 | float visual_border_width( Context::Get().GetEngine().GetProperty<float>( "BorderWidth", shared_from_this() ) ); |
| 103 | float gap( Context::Get().GetEngine().GetProperty<float>( "Gap", shared_from_this() ) ); |
| 104 | sf::Vector2f requisition( 2 * visual_border_width + 2 * gap, 2 * visual_border_width + 2 * gap ); |
| 105 | |
| 106 | if( HasStyle( TITLEBAR ) ) { |
| 107 | unsigned int title_font_size( Context::Get().GetEngine().GetProperty<unsigned int>( "FontSize", shared_from_this() ) ); |
| 108 | const sf::Font& title_font( *Context::Get().GetEngine().GetResourceManager().GetFont( Context::Get().GetEngine().GetProperty<std::string>( "FontName", shared_from_this() ) ) ); |
| 109 | float title_height( |
| 110 | Context::Get().GetEngine().GetFontLineHeight( title_font, title_font_size ) + |
| 111 | 2 * Context::Get().GetEngine().GetProperty<float>( "TitlePadding", shared_from_this() ) |
| 112 | ); |
| 113 | |
| 114 | requisition.y += title_height; |
| 115 | } |
| 116 | |
| 117 | if( GetChild() ) { |
| 118 | requisition += GetChild()->GetRequisition(); |
| 119 | } |
| 120 | else { |
| 121 | requisition.x = std::max( 50.f, requisition.x ); |
| 122 | requisition.y = std::max( 50.f, requisition.y * 2.f ); |
| 123 | } |
| 124 | |
| 125 | return requisition; |
| 126 | } |
| 127 | |
| 128 | const std::string& Window::GetName() const { |
| 129 | static const std::string name( "Window" ); |
nothing calls this directly
no test coverage detected