Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: manager/EAHitBox.cpp
- Revision:
- 3:24fbf4dbd7e5
- Parent:
- 1:f04bcaea1d60
diff -r 2b860e764545 -r 24fbf4dbd7e5 manager/EAHitBox.cpp
--- a/manager/EAHitBox.cpp Sun Mar 28 20:15:15 2010 +0000
+++ b/manager/EAHitBox.cpp Wed Mar 31 22:22:21 2010 +0000
@@ -1,13 +1,15 @@
#include "mbed.h"
#include "EAHitBox.h"
+#include "EAHitHandler.h"
EAHitBox::EAHitBox()
: _next(NULL),
- _widget(NULL),
+ _handler(NULL),
_width(0),
_height(0),
_x(0),
_y(0),
+ _enabled(true),
_action(NULL)
{
}
@@ -19,7 +21,7 @@
bool EAHitBox::checkContains(short x, short y)
{
bool result = false;
-
+
if (
(x > this->x())
&&
@@ -34,10 +36,20 @@
result = true;
}
- if ((result == true) && (_action != NULL))
+ if ((result == true) && (enabled() == true))
{
// Hit inside and an action is defined.
- _action(this, x, y);
+ if (_handler != NULL)
+ {
+ // Call member function on object.
+ _handler->actionHandler(this, x, y);
+ }
+
+ if (_action != NULL)
+ {
+ // Call global handler.
+ _action(this, x, y);
+ }
}
return result;