Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
pp::InputEvent Class Reference

#include <input_event.h>

Inheritance diagram for pp::InputEvent:
pp::Resource pp::IMEInputEvent pp::KeyboardInputEvent pp::MouseInputEvent pp::TouchInputEvent pp::WheelInputEvent

Public Member Functions

 InputEvent ()
 Default constructor that creates an is_null() InputEvent object.
 
 InputEvent (PP_Resource input_event_resource)
 
PP_InputEvent_Type GetType () const
 
PP_TimeTicks GetTimeStamp () const
 
uint32_t GetModifiers () const
 
- Public Member Functions inherited from pp::Resource
 Resource ()
 The default constructor.
 
 Resource (const Resource &other)
 
virtual ~Resource ()
 Destructor.
 
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)
 
void Clear ()
 Sets this resource to null. This releases ownership of the 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.

Example:

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

Constructor & Destructor Documentation

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.

Parameters
[in]input_event_resourceA input event resource ID.

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.

Returns
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.

Returns
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.

Returns
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: