* Called every time there's a mouse click on the surface. * Allows the surface to have custom functionality for this action, * and can be called externally to simulate the action. * @param action Pointer to an action. * @param state State that the action handlers belong to. */
| 292 | * @param state State that the action handlers belong to. |
| 293 | */ |
| 294 | void InteractiveSurface::mouseClick(Action *action, State *state) |
| 295 | { |
| 296 | std::map<Uint8, ActionHandler>::iterator allHandler = _click.find(0); |
| 297 | std::map<Uint8, ActionHandler>::iterator oneHandler = _click.find(action->getDetails()->button.button); |
| 298 | if (allHandler != _click.end()) |
| 299 | { |
| 300 | ActionHandler handler = allHandler->second; |
| 301 | (state->*handler)(action); |
| 302 | } |
| 303 | if (oneHandler != _click.end()) |
| 304 | { |
| 305 | ActionHandler handler = oneHandler->second; |
| 306 | (state->*handler)(action); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * Called every time the mouse moves into the surface. |
nothing calls this directly
no test coverage detected