Public Member Functions | List of all members
pp::InputEvent Class Reference

#include <input_event.h>

Inheritance diagram for pp::InputEvent:
Inheritance graph
Collaboration diagram for pp::InputEvent:
Collaboration graph

Public Member Functions

 InputEvent ()
 Default constructor that creates an is_null() InputEvent object. More...
 InputEvent (PP_Resource input_event_resource)
 ~InputEvent ()
PP_InputEvent_Type GetType () const
PP_TimeTicks GetTimeStamp () const
uint32_t GetModifiers () const
- Public Member Functions inherited from pp::Resource
 Resource ()
 The default constructor. More...
 Resource (const Resource &other)
virtual ~Resource ()
 Destructor. More...
Resourceoperator= (const Resource &other)
bool is_null () const
PP_Resource pp_resource () const
PP_Resource detach ()

Additional Inherited Members

- Protected Member Functions inherited from pp::Resource
 Resource (PP_Resource resource)
 Resource (PassRef, PP_Resource resource)
void PassRefFromConstructor (PP_Resource resource)

Detailed Description

This class represents an input event resource. Normally you will get passed this object through the HandleInputEvent() function on the Instance object.

Typically you would check the type of the event and then create the appropriate event-specific object to query the properties.


bool MyInstance::HandleInputEvent(const pp::InputEvent& event) {
switch (event.GetType()) {
pp::MouseInputEvent mouse_event(event);
return HandleMouseDown(mouse_event.GetMousePosition());
return false;

Definition at line 46 of file input_event.h.

Constructor & Destructor Documentation

pp::InputEvent::InputEvent ( )

Default constructor that creates an is_null() InputEvent object.

pp::InputEvent::InputEvent ( PP_Resource  input_event_resource)

This constructor constructs an input event from the provided input event resource ID. The InputEvent object will be is_null() if the given resource is not a valid input event.

[in]input_event_resourceA input event resource ID.
pp::InputEvent::~InputEvent ( )

Member Function Documentation

uint32_t pp::InputEvent::GetModifiers ( ) const

GetModifiers() returns a bitfield indicating which modifiers were down at the time of the event. This is a combination of the flags in the PP_InputEvent_Modifier enum.

The modifiers associated with the event, or 0 if the given resource is not a valid event resource.
PP_TimeTicks pp::InputEvent::GetTimeStamp ( ) const

GetTimeStamp() returns the time that the event was generated. The time will be before the current time since processing and dispatching the event has some overhead. Use this value to compare the times the user generated two events without being sensitive to variable processing time.

The return value is in time ticks, which is a monotonically increasing clock not related to the wall clock time. It will not change if the user changes their clock or daylight savings time starts, so can be reliably used to compare events. This means, however, that you can't correlate event times to a particular time of day on the system clock.

A PP_TimeTicks containing the time the event was generated.
PP_InputEvent_Type pp::InputEvent::GetType ( ) const

GetType() returns the type of input event for this input event object.

A PP_InputEvent_Type if successful, PP_INPUTEVENT_TYPE_UNDEFINED if the resource is invalid.

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