This handler handles mouse button events
| 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 |