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

Method HandleMouseButtonEvent

src/SFGUI/Button.cpp:58–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58void Button::HandleMouseButtonEvent( sf::Mouse::Button button, bool press, int /*x*/, int /*y*/ ) {
59 if( !IsMouseInWidget() ) {
60 if( GetState() == State::ACTIVE ) {
61 SetState( State::NORMAL );
62 }
63
64 return;
65 }
66
67 if( button == sf::Mouse::Button::Left ) {
68 if( press ) {
69 SetState( State::ACTIVE );
70 }
71 else if( GetState() == State::ACTIVE ) {
72 SetState( State::PRELIGHT );
73 }
74 }
75}
76
77sf::Vector2f Button::CalculateRequisition() {
78 float padding( Context::Get().GetEngine().GetProperty<float>( "Padding", shared_from_this() ) );

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected