Native Client

pp::InputEvent Class Reference

This class represents an input event resource. More...

Inheritance diagram for pp::InputEvent:

List of all members.

Public Functions

 InputEvent ()
 InputEvent (PP_Resource input_event_resource)
 ~InputEvent ()
PP_InputEvent_Type GetType () const
PP_TimeTicks GetTimeStamp () const
uint32_t GetModifiers () const

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()) { case PP_INPUTEVENT_TYPE_MOUSE_DOWN { pp::MouseInputEvent mouse_event(event); return HandleMouseDown(mouse_event.GetMousePosition()); } default: return false; }

Constructor and Destructor Details

pp::InputEvent::InputEvent ( )

Default constructor that creates an is_null() InputEvent object.

pp::InputEvent::InputEvent ( PP_Resource  input_event_resource) [explicit]

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 ( )

Function Details

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:

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.