[cluttermm] Initial wrapping of ClutterDeviceManager.



commit cd11501efd2b582098e92b99bfb9fd3ca4491c11
Author: Chris Kühl <chrisk openismus com>
Date:   Mon Jan 24 00:52:34 2011 +0100

    Initial wrapping of ClutterDeviceManager.
    
    * clutter/cluttermm.h: Added header file for new class.
    * clutter/src/device-manager.[hg|ccg]: Initial wrapping of ClutterDeviceManager.
    * clutter/src/clutter_signals.defs: Added properties for new class.
    * clutter/src/filelist.am: Added new class to files_hg list.
    * codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
    * codegen/m4/convert_clutter.m4: Added DeviceManager & InputDevice conversions.

 ChangeLog                                        |   11 ++++
 clutter/cluttermm.h                              |    1 +
 clutter/src/clutter_signals.defs                 |   29 ++++++++++
 clutter/src/device-manager.ccg                   |   62 ++++++++++++++++++++++
 clutter/src/device-manager.hg                    |   53 ++++++++++++++++++
 clutter/src/filelist.am                          |    1 +
 codegen/extradefs/generate_extra_defs_clutter.cc |    1 +
 codegen/m4/convert_clutter.m4                    |    7 +++
 8 files changed, 165 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c75a3c3..d10296d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-24  Chris Kühl  <chrisk openismus com>
+
+	Initial wrapping of ClutterDeviceManager.
+
+	* clutter/cluttermm.h: Added header file for new class.
+	* clutter/src/device-manager.[hg|ccg]: Initial wrapping of ClutterDeviceManager.
+	* clutter/src/clutter_signals.defs: Added properties for new class.
+	* clutter/src/filelist.am: Added new class to files_hg list.
+	* codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
+	* codegen/m4/convert_clutter.m4: Added DeviceManager & InputDevice conversions.
+
 2011-01-22  Chris Kühl  <chrisk openismus com>
 
 	Initial wrapping of ClutterInputDevice.
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 75eda61..9d4821c 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -73,6 +73,7 @@
 #include <cluttermm/cairo-texture.h>
 #include <cluttermm/clone.h>
 #include <cluttermm/color.h>
+#include <cluttermm/device-manager.h>
 #include <cluttermm/event.h>
 #include <cluttermm/fixed-layout.h>
 #include <cluttermm/flow-layout.h>
diff --git a/clutter/src/clutter_signals.defs b/clutter/src/clutter_signals.defs
index 1487224..710c465 100644
--- a/clutter/src/clutter_signals.defs
+++ b/clutter/src/clutter_signals.defs
@@ -2182,6 +2182,35 @@
   )
 )
 
+;; From ClutterDeviceManager
+
+(define-signal device-added
+  (of-object "ClutterDeviceManager")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("ClutterInputDevice*" "p0")
+  )
+)
+
+(define-signal device-removed
+  (of-object "ClutterDeviceManager")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("ClutterInputDevice*" "p0")
+  )
+)
+
+(define-property backend
+  (of-object "ClutterDeviceManager")
+  (prop-type "GParamObject")
+  (docs "The ClutterBackend of the device manager")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From ClutterEvent
 
 ;; From FlowLayout
diff --git a/clutter/src/device-manager.ccg b/clutter/src/device-manager.ccg
new file mode 100644
index 0000000..9952272
--- /dev/null
+++ b/clutter/src/device-manager.ccg
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/backend.h>
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+
+Glib::RefPtr<DeviceManager> DeviceManager::get_default()
+{
+  return Glib::wrap(clutter_device_manager_get_default());
+}
+
+std::vector<Glib::RefPtr<InputDevice> > DeviceManager::list_devices()
+{
+  GSList* deviceList = clutter_device_manager_list_devices(gobj());
+
+  const guint deviceCount = g_slist_length(deviceList);
+  std::vector<Glib::RefPtr<InputDevice> > deviceVec;
+  deviceVec.reserve(deviceCount);
+
+  for(GSList* deviceNode = deviceList; deviceNode->next; deviceNode = deviceList->next)
+  {
+    deviceVec.push_back(Glib::wrap(static_cast<ClutterInputDevice*>(deviceNode->data), true));
+  }
+
+  return deviceVec;
+}
+
+std::vector<Glib::RefPtr<const InputDevice> > DeviceManager::list_devices() const
+{
+  GSList* deviceList = clutter_device_manager_list_devices(const_cast<ClutterDeviceManager*>(gobj()));
+
+  const guint deviceCount = g_slist_length(deviceList);
+  std::vector<Glib::RefPtr<const InputDevice> > deviceVec;
+  deviceVec.reserve(deviceCount);
+
+  for(GSList* deviceNode = deviceList; deviceNode->next; deviceNode = deviceList->next)
+  {
+    deviceVec.push_back(Glib::wrap(static_cast<ClutterInputDevice*>(deviceNode->data), true));
+  }
+
+  return deviceVec;
+}
+
+} // namespace Clutter
diff --git a/clutter/src/device-manager.hg b/clutter/src/device-manager.hg
new file mode 100644
index 0000000..4b39e0b
--- /dev/null
+++ b/clutter/src/device-manager.hg
@@ -0,0 +1,53 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <cluttermm/input-device.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Clutter
+{
+
+class Backend;
+
+class DeviceManager : public Glib::Object
+{
+  _CLASS_GOBJECT(DeviceManager, ClutterDeviceManager, CLUTTER_DEVICE_MANAGER, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+
+  Glib::RefPtr<DeviceManager> get_default();
+
+  _IGNORE(clutter_device_manager_peek_devices, clutter_device_manager_list_devices)
+  _WRAP_METHOD_DOCS_ONLY(clutter_device_manager_list_devices)
+  std::vector<Glib::RefPtr<InputDevice> >       list_devices();
+  std::vector<Glib::RefPtr<const InputDevice> > list_devices() const;
+
+  _WRAP_METHOD(Glib::RefPtr<InputDevice> get_device(int device_id), clutter_device_manager_get_device)
+  _WRAP_METHOD(Glib::RefPtr<InputDevice> get_core_device(InputDeviceType device_type), clutter_device_manager_get_core_device)
+
+  _IGNORE(clutter_get_input_device_for_id)
+
+  _WRAP_PROPERTY("backend", Glib::RefPtr<Backend>)
+};
+
+} // namespace Clutter
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index d799b0d..5c57792 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -33,6 +33,7 @@ files_hg =			\
 	clone.hg		\
 	color.hg		\
 	container.hg		\
+	device-manager.hg	\
 	effect.hg               \
 	fixed-layout.hg         \
 	flow-layout.hg          \
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc b/codegen/extradefs/generate_extra_defs_clutter.cc
index 0dc3f2e..76f1d6e 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -47,6 +47,7 @@ int main(int argc, char** argv)
     << get_defs(CLUTTER_TYPE_CLONE)
     << get_defs(CLUTTER_TYPE_COLOR)
     << get_defs(CLUTTER_TYPE_CONTAINER)
+    << get_defs(CLUTTER_TYPE_DEVICE_MANAGER)
     << get_defs(CLUTTER_TYPE_EFFECT)
     << get_defs(CLUTTER_TYPE_EVENT)
     << get_defs(CLUTTER_TYPE_FIXED_LAYOUT)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index 178efd4..c473dc3 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -35,6 +35,13 @@ _CONVERSION(`ClutterAnimator*',`Glib::RefPtr<const Animator>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Backend>&',`ClutterBackend*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`ClutterBackend*',`Glib::RefPtr<Backend>',`Glib::wrap($3)')
 
+_CONVERSION(`const Glib::RefPtr<InputDevice>&',`ClutterInputDevice*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`ClutterInputDevice*',`Glib::RefPtr<InputDevice>',`Glib::wrap($3)')
+_CONVERSION(`ClutterInputDevice*',`Glib::RefPtr<const InputDevice>',`Glib::wrap($3)')
+_CONVERSION(`ClutterInputDevice*',`const Glib::RefPtr<InputDevice>&', `Glib::wrap(($3),true)')
+
+_CONVERSION(`ClutterDeviceManager*',`Glib::RefPtr<DeviceManager>',`Glib::wrap($3)')
+
 _CONVERSION(`const Glib::RefPtr<Effect>&',`ClutterEffect*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Effect>&',`ClutterEffect*',__CONVERT_CONST_REFPTR_TO_P)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]