From be7a26dd12017d4ce1f445e7894217682d1fedce Mon Sep 17 00:00:00 2001 From: Bei Yang Date: Thu, 25 Mar 2010 01:20:11 +0000 Subject: [PATCH] initial add --- panda/src/awesomium/AwMouseAndKeyboard.cxx | 42 ++++++++++++++++ panda/src/awesomium/AwMouseAndKeyboard.h | 56 ++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 panda/src/awesomium/AwMouseAndKeyboard.cxx create mode 100644 panda/src/awesomium/AwMouseAndKeyboard.h diff --git a/panda/src/awesomium/AwMouseAndKeyboard.cxx b/panda/src/awesomium/AwMouseAndKeyboard.cxx new file mode 100644 index 0000000000..811486b276 --- /dev/null +++ b/panda/src/awesomium/AwMouseAndKeyboard.cxx @@ -0,0 +1,42 @@ +// Filename: AwMouseAndKeyboard.cxx +// Created by: Bei Yang (Mar2010) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// + +#include "config_awesomium.h" +#include "AwMouseAndKeyboard.h" +#include "dataNodeTransmit.h" + +TypeHandle AwMouseAndKeyboard::_type_handle; + +AwMouseAndKeyboard::AwMouseAndKeyboard(GraphicsWindow *window, int device, const string &name): +MouseAndKeyboard(window,device,name) +{ + //do nothing +} + + +void AwMouseAndKeyboard::do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output){ + + MouseAndKeyboard::do_transmit_data(trav,input,output); + + int num_events = _button_events->get_num_events(); + for (int i = 0; i < num_events; i++) { + const ButtonEvent &be = _button_events->get_event(i); + string event_name = be._button.get_name(); + printf("Button pressed: %s ", event_name); + if(be._type == ButtonEvent::T_down ) printf(" down "); + if(be._type == ButtonEvent::T_repeat ) printf(" repeat "); + if(be._type == ButtonEvent::T_resume_down ) printf(" resume down "); + if(be._type == ButtonEvent::T_resume_down ) printf(" up "); + } +} diff --git a/panda/src/awesomium/AwMouseAndKeyboard.h b/panda/src/awesomium/AwMouseAndKeyboard.h new file mode 100644 index 0000000000..23e82e6d3e --- /dev/null +++ b/panda/src/awesomium/AwMouseAndKeyboard.h @@ -0,0 +1,56 @@ +// Filename: awWebCore.h +// Created by: rurbino (12Oct09) +// +//////////////////////////////////////////////////////////////////// +// +// PANDA 3D SOFTWARE +// Copyright (c) Carnegie Mellon University. All rights reserved. +// +// All use of this software is subject to the terms of the revised BSD +// license. You should have received a copy of this license along +// with this source code in a file named "LICENSE." +// +//////////////////////////////////////////////////////////////////// +#ifndef AWWEBKEYBOARDMOUSE_H +#define AWWEBKEYBOARDMOUSE_H + +#include "pandabase.h" +#include "typedReferenceCount.h" +#include "luse.h" + +#include "mouseAndKeyboard.h" + + +//////////////////////////////////////////////////////////////////// +// Class : AwMouseAndKeyboard +// Description : Thin wrappings arround WebCore.h +//////////////////////////////////////////////////////////////////// +class EXPCL_PANDAAWESOMIUM AwMouseAndKeyboard : public MouseAndKeyboard { +PUBLISHED: + AwMouseAndKeyboard(GraphicsWindow *window, int device, const string &name); + +protected: + // Inherited from DataNode + virtual void do_transmit_data(DataGraphTraverser *trav, + const DataNodeTransmit &input, + DataNodeTransmit &output); + +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + MouseAndKeyboard::init_type(); + register_type(_type_handle, "AwMouseAndKeyboard", + MouseAndKeyboard::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: + static TypeHandle _type_handle; +}; + +#endif