libRocket
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Rocket::Core::Event Class Reference

#include <Event.h>

Inheritance diagram for Rocket::Core::Event:
Rocket::Core::ScriptInterface Rocket::Core::ReferenceCountable

Public Types

enum  EventPhase { PHASE_UNKNOWN, PHASE_CAPTURE, PHASE_TARGET, PHASE_BUBBLE }
 

Public Member Functions

 Event ()
 Constructor. More...
 
 Event (Element *target, const String &type, const Dictionary &parameters, bool interruptible=false)
 
virtual ~Event ()
 Destructor. More...
 
EventPhase GetPhase () const
 
void SetPhase (EventPhase phase)
 
void SetCurrentElement (Element *element)
 
Element * GetCurrentElement () const
 
Element * GetTargetElement () const
 
const String & GetType () const
 
bool operator== (const String &type) const
 
bool IsPropagating () const
 
void StopPropagation ()
 Stops the propagation of the event wherever it is. More...
 
template<typename T >
T GetParameter (const String &key, const T &default_value)
 
const Dictionary * GetParameters () const
 
virtual void OnReferenceDeactivate ()
 Release this event. More...
 
- Public Member Functions inherited from Rocket::Core::ScriptInterface
virtual ~ScriptInterface ()
 
virtual ScriptObject GetScriptObject () const
 
- Public Member Functions inherited from Rocket::Core::ReferenceCountable
 ReferenceCountable (int initial_count=1)
 
virtual ~ReferenceCountable ()
 Destructor. The reference count must be 0 when this is invoked. More...
 
virtual int GetReferenceCount ()
 Returns the number of references outstanding against this object. More...
 
virtual void AddReference ()
 Increases the reference count. If this pushes the count above 0, OnReferenceActivate() will be called. More...
 
virtual void RemoveReference ()
 Decreases the reference count. If this pushes the count to 0, OnReferenceDeactivate() will be called. More...
 
ReferenceCountable & operator= (const ReferenceCountable &copy)
 Catches incorrect copy attempts. More...
 

Protected Attributes

String type
 
Dictionary parameters
 
Element * target_element
 
Element * current_element
 

Friends

class Factory
 

Additional Inherited Members

- Static Public Member Functions inherited from Rocket::Core::ReferenceCountable
static void DumpLeakReport ()
 If any reference countable objects are still allocated, this function will write a leak report to the log. More...
 
- Protected Member Functions inherited from Rocket::Core::ReferenceCountable
virtual void OnReferenceActivate ()
 A hook method called when the reference count climbs from 0. More...
 

Detailed Description

An event that propogates through the element hierarchy. Events follow the DOM3 event specification. See http://www.w3.org/TR/DOM-Level-3-Events/events.html.

Author
Lloyd Weehuizen

Member Enumeration Documentation

Enumerator
PHASE_UNKNOWN 
PHASE_CAPTURE 
PHASE_TARGET 
PHASE_BUBBLE 

Constructor & Destructor Documentation

Rocket::Core::Event::Event ( )

Constructor.

Rocket::Core::Event::Event ( Element *  target,
const String &  type,
const Dictionary &  parameters,
bool  interruptible = false 
)

Constructor

Parameters
[in]targetThe target element of this event
[in]typeThe event type
[in]parametersThe event parameters
[in]interruptibleCan this event have is propagation stopped?
virtual Rocket::Core::Event::~Event ( )
virtual

Destructor.

Member Function Documentation

Element* Rocket::Core::Event::GetCurrentElement ( ) const

Get the current element in the propagation.

Returns
The current element in propagation.
template<typename T >
T Rocket::Core::Event::GetParameter ( const String &  key,
const T &  default_value 
)
inline

Returns the value of one of the event's parameters.

Parameters
key[in]The name of the desired parameter.
Returns
The value of the requested parameter.
const Dictionary* Rocket::Core::Event::GetParameters ( ) const

Access the dictionary of parameters

Returns
The dictionary of parameters
EventPhase Rocket::Core::Event::GetPhase ( ) const

Get the current propagation phase.

Returns
Current phase the event is in.
Element* Rocket::Core::Event::GetTargetElement ( ) const

Get the target element

Returns
The target element of this event
const String& Rocket::Core::Event::GetType ( ) const

Get the event type.

Returns
The event type.
bool Rocket::Core::Event::IsPropagating ( ) const

Has the event been stopped?

Returns
True if the event is still propogating
virtual void Rocket::Core::Event::OnReferenceDeactivate ( )
virtual

Release this event.

Reimplemented from Rocket::Core::ReferenceCountable.

bool Rocket::Core::Event::operator== ( const String &  type) const

Checks if the event is of a certain type.

Parameters
typeThe name of the type to check for.
Returns
True if the event is of the requested type, false otherwise.
void Rocket::Core::Event::SetCurrentElement ( Element *  element)

Set the current element in the propagation.

Parameters
[in]elementThe current element.
void Rocket::Core::Event::SetPhase ( EventPhase  phase)

Set the current propagation phase

Parameters
phaseSwitch the phase the event is in
void Rocket::Core::Event::StopPropagation ( )

Stops the propagation of the event wherever it is.

Friends And Related Function Documentation

friend class Factory
friend

Member Data Documentation

Element* Rocket::Core::Event::current_element
protected
Dictionary Rocket::Core::Event::parameters
protected
Element* Rocket::Core::Event::target_element
protected
String Rocket::Core::Event::type
protected

The documentation for this class was generated from the following file: