Native Client

pp::WheelInputEvent Class Reference

Inheritance diagram for pp::WheelInputEvent:

List of all members.

Public Functions

 WheelInputEvent ()
 WheelInputEvent (const InputEvent &event)
 WheelInputEvent (Instance *instance, PP_TimeTicks time_stamp, uint32_t modifiers, const FloatPoint &wheel_delta, const FloatPoint &wheel_ticks, bool scroll_by_page)
FloatPoint GetDelta () const
FloatPoint GetTicks () const
bool GetScrollByPage () const

Constructor and Destructor Details

pp::WheelInputEvent::WheelInputEvent ( )

Constructs an is_null() wheel input event object.

pp::WheelInputEvent::WheelInputEvent ( const InputEvent event) [explicit]

This constructor constructs a wheel input event object from the provided generic input event.

If the given event is itself is_null() or is not a wheel input event, the wheel object will be is_null().

Parameters:
[in]Ageneric input event.
pp::WheelInputEvent::WheelInputEvent ( Instance instance,
PP_TimeTicks  time_stamp,
uint32_t  modifiers,
const FloatPoint wheel_delta,
const FloatPoint wheel_ticks,
bool  scroll_by_page 
)

Constructs a wheel input even from the given parameters.

Parameters:
[in]instanceThe instance for which this event occured.
[in]time_stampA PP_TimeTicks indicating the time when the event occured.
[in]modifiersA bit field combination of the PP_InputEvent_Modifier flags.
[in]wheel_deltaThe scroll wheel's horizontal and vertical scroll amounts.
[in]wheel_ticksThe number of "clicks" of the scroll wheel that have produced the event.
[in]scroll_by_pageWhen true, the user is requesting to scroll by pages. When false, the user is requesting to scroll by lines.

Function Details

FloatPoint pp::WheelInputEvent::GetDelta ( ) const

GetDelta() returns the amount vertically and horizontally the user has requested to scroll by with their mouse wheel.

A scroll down or to the right (where the content moves up or left) is represented as positive values, and a scroll up or to the left (where the content moves down or right) is represented as negative values.

This amount is system dependent and will take into account the user's preferred scroll sensitivity and potentially also nonlinear acceleration based on the speed of the scrolling.

Devices will be of varying resolution. Some mice with large detents will only generate integer scroll amounts. But fractional values are also possible, for example, on some trackpads and newer mice that don't have "clicks".

Returns:
The vertial and horizontal scroll values. The units are either in pixels (when scroll_by_page is false) or pages (when scroll_by_page is true). For example, y = -3 means scroll up 3 pixels when scroll_by_page is false, and scroll up 3 pages when scroll_by_page is true.
bool pp::WheelInputEvent::GetScrollByPage ( ) const

GetScrollByPage() indicates if the scroll delta x/y indicates pages or lines to scroll by.

Returns:
true if the event is a wheel event and the user is scrolling by pages, false if not or if the resource is not a wheel event.
FloatPoint pp::WheelInputEvent::GetTicks ( ) const

GetTicks() returns the number of "clicks" of the scroll wheel that have produced the event.

The value may have system-specific acceleration applied to it, depending on the device. The positive and negative meanings are the same as for GetDelta().

If you are scrolling, you probably want to use the delta values. These tick events can be useful if you aren't doing actual scrolling and don't want or pixel values. An example may be cycling between different items in a game.

Returns:
The number of "clicks" of the scroll wheel. You may receive fractional values for the wheel ticks if the mouse wheel is high resolution or doesn't have "clicks". If your program wants discrete events (as in the "picking items" example) you should accumulate fractional click values from multiple messages until the total value reaches positive or negative one. This should represent a similar amount of scrolling as for a mouse that has a discrete mouse wheel.

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.