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

Method HandleMouseButtonEvent

examples/CustomWidget.cpp:196–214  ·  view source on GitHub ↗

This handler handles mouse button events

Source from the content-addressed store, hash-verified

194
195 // This handler handles mouse button events
196 void HandleMouseButtonEvent( sf::Mouse::Button button, bool press, int x, int y ) override {
197 if( !IsMouseInWidget() ) {
198 if( GetState() == State::ACTIVE ) {
199 SetState( State::NORMAL );
200 }
201
202 return;
203 }
204
205 if( button == sf::Mouse::Button::Left ) {
206 if( press ) {
207 SetLabel( sf::String( "Mouse Left Press: " + std::to_string( x ) + "," + std::to_string( y ) ) );
208 SetState( State::ACTIVE );
209 }
210 else if( GetState() == State::ACTIVE ) {
211 SetState( State::PRELIGHT );
212 }
213 }
214 }
215
216 sf::String m_label;
217

Callers

nothing calls this directly

Calls 1

StringClass · 0.85

Tested by

no test coverage detected