Gnash
0.8.10
|
The base class for interactive objects. More...
#include <InteractiveObject.h>
Public Member Functions | |
InteractiveObject (as_object *object, DisplayObject *parent) | |
virtual | ~InteractiveObject () |
virtual void | display (Renderer &renderer, const Transform &xform)=0 |
Render this InteractiveObject. | |
virtual bool | mouseEnabled () const =0 |
Whether the DisplayObject can handle a mouse event. | |
virtual bool | trackAsMenu () |
ActionScript property of Buttons and MovieClips altering mouse handling. | |
virtual StaticText * | getStaticText (std::vector< const SWF::TextRecord * > &, size_t &) |
Allow extraction of static text. | |
virtual SWFRect | getBounds () const =0 |
Returns local, untransformed bounds of this DisplayObject in TWIPS. | |
virtual InteractiveObject * | topmostMouseEntity (boost::int32_t, boost::int32_t)=0 |
Return the topmost entity covering the given point and enabled to receive mouse events. | |
virtual void | mouseEvent (const event_id &id)=0 |
Called whenever a mouse event affects this InteractiveObject. | |
virtual bool | pointInShape (boost::int32_t x, boost::int32_t y) const |
Return true if the given point falls in this DisplayObject's shape. | |
void | add_invalidated_bounds (InvalidatedRanges &ranges, bool force)=0 |
Add the DisplayObject's invalidated bounds *to* the given ranges list. |
The base class for interactive objects.
Objects of type InteractiveObject can receive focus, mouse events, and key events for user interaction. Derived classes include TextField, Button, and MovieClip.
gnash::InteractiveObject::InteractiveObject | ( | as_object * | object, |
DisplayObject * | parent | ||
) | [inline] |
References assert.
virtual gnash::InteractiveObject::~InteractiveObject | ( | ) | [inline, virtual] |
void gnash::InteractiveObject::add_invalidated_bounds | ( | InvalidatedRanges & | ranges, |
bool | force | ||
) | [pure virtual] |
Add the DisplayObject's invalidated bounds *to* the given ranges list.
NOTE that this method should include the bounds that it covered the last time clear_invalidated() was called, as those need to be rerendered as well (to clear the region previously occupied by this DisplayObject).
That's why it returns the *union* of old_invalidated_ranges and the current bounds. The function is also used internally by set_invalidated() to update m_old_invalidated_ranges itself (you may notice some kind of circular reference), but that's no problem since old_invalidated_ranges is NULL during that call.
It is used to determine what area needs to be re-rendered. The coordinates are world coordinates (in TWIPS). Only instances with _invalidated flag set are checked unless force is set.
Reimplemented from gnash::DisplayObject.
Implemented in gnash::MovieClip, gnash::TextField, and gnash::Button.
virtual void gnash::InteractiveObject::display | ( | Renderer & | renderer, |
const Transform & | xform | ||
) | [pure virtual] |
Render this InteractiveObject.
Implements gnash::DisplayObject.
Implemented in gnash::MovieClip, gnash::TextField, and gnash::Button.
virtual SWFRect gnash::InteractiveObject::getBounds | ( | ) | const [pure virtual] |
Returns local, untransformed bounds of this DisplayObject in TWIPS.
Container DisplayObjects (sprite and buttons) return the composite bounds of all their children, appropriately transformed with their local SWFMatrix.
Implements gnash::DisplayObject.
Implemented in gnash::TextField, gnash::MovieClip, and gnash::Button.
virtual StaticText* gnash::InteractiveObject::getStaticText | ( | std::vector< const SWF::TextRecord * > & | , |
size_t & | |||
) | [inline, virtual] |
Allow extraction of static text.
Default returns 0, implemented only for DefineText though DisplayObject.
Reimplemented from gnash::DisplayObject.
virtual bool gnash::InteractiveObject::mouseEnabled | ( | ) | const [pure virtual] |
Whether the DisplayObject can handle a mouse event.
Implemented in gnash::MovieClip, gnash::TextField, and gnash::Button.
virtual void gnash::InteractiveObject::mouseEvent | ( | const event_id & | id | ) | [pure virtual] |
Called whenever a mouse event affects this InteractiveObject.
All InteractiveObjects (Button, MovieClip, TextField) can handle mouse input, so must override this function.
Implemented in gnash::MovieClip, gnash::TextField, and gnash::Button.
virtual bool gnash::InteractiveObject::pointInShape | ( | boost::int32_t | x, |
boost::int32_t | y | ||
) | const [inline, virtual] |
Return true if the given point falls in this DisplayObject's shape.
Point coordinates are in world TWIPS
The default implementation warns about a missing override and invokes pointInBounds().
Implements gnash::DisplayObject.
Reimplemented in gnash::TextField, gnash::MovieClip, and gnash::Button.
References gnash::DisplayObject::pointInBounds().
virtual InteractiveObject* gnash::InteractiveObject::topmostMouseEntity | ( | boost::int32_t | , |
boost::int32_t | |||
) | [pure virtual] |
Return the topmost entity covering the given point and enabled to receive mouse events.
Return NULL if no "active" entity is found under the pointer.
Coordinates of the point are given in parent's coordinate space. This means that in order to convert the point to the local coordinate space you need to apply an inverse transformation using this DisplayObject SWFMatrix. Example:
point p(x,y); getMatrix().transform_by_inverse(p); -- p is now in local coordinates
Don't blame me for this mess, I'm just trying to document the existing functions ... --strk
x | X ordinate of the pointer, in parent's coordinate space. |
y | Y ordinate of the pointer, in parent's coordiante space. |
Reimplemented from gnash::DisplayObject.
Implemented in gnash::MovieClip, gnash::TextField, and gnash::Button.
virtual bool gnash::InteractiveObject::trackAsMenu | ( | ) | [inline, virtual] |
ActionScript property of Buttons and MovieClips altering mouse handling.
Reimplemented in gnash::MovieClip, and gnash::Button.