| Index: ppapi/cpp/input_event.cc
|
| ===================================================================
|
| --- ppapi/cpp/input_event.cc (revision 0)
|
| +++ ppapi/cpp/input_event.cc (revision 0)
|
| @@ -0,0 +1,95 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ppapi/cpp/input_event.h"
|
| +
|
| +#include "ppapi/cpp/common.h"
|
| +#include "ppapi/cpp/instance.h"
|
| +#include "ppapi/cpp/module.h"
|
| +#include "ppapi/cpp/module_impl.h"
|
| +#include "ppapi/cpp/point.h"
|
| +#include "ppapi/cpp/var.h"
|
| +
|
| +namespace pp {
|
| +
|
| +namespace {
|
| +
|
| +template <> const char* interface_name<PPB_InputEvent>() {
|
| + return PPB_INPUT_EVENT_INTERFACE;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +InputEvent::InputEvent() : Resource() {
|
| +}
|
| +
|
| +InputEvent::InputEvent(PP_Resource input_event_resource)
|
| + : Resource(input_event_resource) {
|
| +}
|
| +
|
| +InputEvent::~InputEvent() {
|
| +}
|
| +
|
| +PP_InputEvent_Type InputEvent::GetEventType() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return PP_INPUTEVENT_TYPE_UNDEFINED;
|
| + return get_interface<PPB_InputEvent>()->GetEventType(pp_resource());
|
| +}
|
| +
|
| +PP_TimeTicks InputEvent::GetEventTimeStamp() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return 0.0f;
|
| + return get_interface<PPB_InputEvent>()->GetEventTimeStamp(pp_resource());
|
| +}
|
| +
|
| +uint32_t InputEvent::GetEventModifiers() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return 0;
|
| + return get_interface<PPB_InputEvent>()->GetEventModifiers(pp_resource());
|
| +}
|
| +
|
| +PP_InputEvent_MouseButton InputEvent::GetMouseButton() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return PP_INPUTEVENT_MOUSEBUTTON_NONE;
|
| + return get_interface<PPB_InputEvent>()->GetMouseButton(pp_resource());
|
| +}
|
| +
|
| +Point InputEvent::GetMousePosition() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return Point();
|
| + return get_interface<PPB_InputEvent>()->GetMousePosition(pp_resource());
|
| +}
|
| +
|
| +int32_t InputEvent::GetMouseClickCount() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return 0;
|
| + return get_interface<PPB_InputEvent>()->GetMouseClickCount(pp_resource());
|
| +}
|
| +
|
| +FloatPoint InputEvent::GetWheelDelta() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return FloatPoint();
|
| + return get_interface<PPB_InputEvent>()->GetWheelDelta(pp_resource());
|
| +}
|
| +
|
| +FloatPoint InputEvent::GetWheelTicks() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return FloatPoint();
|
| + return get_interface<PPB_InputEvent>()->GetWheelTicks(pp_resource());
|
| +}
|
| +
|
| +uint32_t InputEvent::GetKeyCode() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return 0;
|
| + return get_interface<PPB_InputEvent>()->GetKeyCode(pp_resource());
|
| +}
|
| +
|
| +Var InputEvent::GetCharacterText() const {
|
| + if (!has_interface<PPB_InputEvent>())
|
| + return PP_INPUTEVENT_TYPE_UNDEFINED;
|
| + return Var(Var::PassRef(),
|
| + get_interface<PPB_InputEvent>()->GetCharacterText(pp_resource()));
|
| +}
|
| +
|
| +} // namespace pp
|
|
|
| Property changes on: ppapi/cpp/input_event.cc
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|