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

Method CalculateRequisition

src/SFGUI/SpinButton.cpp:51–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51sf::Vector2f SpinButton::CalculateRequisition() {
52 const std::string& font_name( Context::Get().GetEngine().GetProperty<std::string>( "FontName", shared_from_this() ) );
53 unsigned int font_size( Context::Get().GetEngine().GetProperty<unsigned int>( "FontSize", shared_from_this() ) );
54 float border_width( Context::Get().GetEngine().GetProperty<float>( "BorderWidth", shared_from_this() ) );
55 float text_padding( Context::Get().GetEngine().GetProperty<float>( "Padding", shared_from_this() ) );
56 const sf::Font& font( *Context::Get().GetEngine().GetResourceManager().GetFont( font_name ) );
57 auto line_height = Context::Get().GetEngine().GetFontLineHeight( font, font_size );
58
59 return sf::Vector2f( 2 * (border_width + text_padding), line_height + 2 * ( border_width + text_padding ) );
60}
61
62const std::string& SpinButton::GetName() const {
63 static const std::string name( "SpinButton" );

Callers

nothing calls this directly

Calls 1

GetFontLineHeightMethod · 0.80

Tested by

no test coverage detected