| 25 | } |
| 26 | |
| 27 | sf::Vector2f CheckButton::CalculateRequisition() { |
| 28 | const std::string& font_name( Context::Get().GetEngine().GetProperty<std::string>( "FontName", shared_from_this() ) ); |
| 29 | unsigned int font_size( Context::Get().GetEngine().GetProperty<unsigned int>( "FontSize", shared_from_this() ) ); |
| 30 | const sf::Font& font( *Context::Get().GetEngine().GetResourceManager().GetFont( font_name ) ); |
| 31 | float spacing( Context::Get().GetEngine().GetProperty<float>( "Spacing", shared_from_this() ) ); |
| 32 | float box_size( Context::Get().GetEngine().GetProperty<float>( "BoxSize", shared_from_this() ) ); |
| 33 | sf::Vector2f requisition( box_size, box_size ); |
| 34 | |
| 35 | if( GetLabel().getSize() > 0 ) { |
| 36 | auto metrics = Context::Get().GetEngine().GetTextStringMetrics( GetLabel(), font, font_size ); |
| 37 | requisition.x += metrics.x + spacing; |
| 38 | requisition.y = std::max( requisition.y, Context::Get().GetEngine().GetFontLineHeight( font, font_size ) ); |
| 39 | } |
| 40 | |
| 41 | return requisition; |
| 42 | } |
| 43 | |
| 44 | void CheckButton::HandleSizeChange() { |
| 45 | float spacing( Context::Get().GetEngine().GetProperty<float>( "Spacing", shared_from_this() ) ); |
nothing calls this directly
no test coverage detected