Commit eb4911ed authored by Murray Cumming's avatar Murray Cumming

DeviceManager: Use _WRAP_METHOD() more instead of hand-coding.

parent a9e37ede
......@@ -15,48 +15,12 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cluttermm/backend.h>
//#include <cluttermm/backend.h>
#include <clutter/clutter.h>
#include <cluttermm/input-device.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
......@@ -15,7 +15,8 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glibmm/object.h>
#include <cluttermm/types.h>
#include <cluttermm/backend.h>
#include <cluttermm/input-device.h>
_DEFS(cluttermm,clutter)
......@@ -24,30 +25,30 @@ _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)
_DERIVES_INITIALLY_UNOWNED()
protected:
_CTOR_DEFAULT()
public:
Glib::RefPtr<DeviceManager> get_default();
_WRAP_METHOD(static Glib::RefPtr<DeviceManager> get_default(), clutter_device_manager_get_default, refreturn)
_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;
#m4 _CONVERSION(`GSList*',`std::vector< Glib::RefPtr<InputDevice> >',`Glib::SListHandler< Glib::RefPtr<InputDevice> >::slist_to_vector($3, Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(std::vector< Glib::RefPtr<InputDevice> > list_devices(), clutter_device_manager_list_devices)
#m4 _CONVERSION(`const GSList*',`std::vector< Glib::RefPtr<const InputDevice> >',`Glib::SListHandler< Glib::RefPtr<const InputDevice> >::slist_to_vector(const_cast<GSList*>($3), Glib::OWNERSHIP_SHALLOW)')
_WRAP_METHOD(std::vector< Glib::RefPtr<const InputDevice> > list_devices() const, clutter_device_manager_peek_devices)
_WRAP_METHOD(Glib::RefPtr<InputDevice> get_device(int device_id), clutter_device_manager_get_device, refreturn)
_WRAP_METHOD(Glib::RefPtr<const InputDevice> get_device(int device_id) const, clutter_device_manager_get_device, refreturn, constversion)
_WRAP_METHOD(Glib::RefPtr<InputDevice> get_core_device(InputDeviceType device_type), clutter_device_manager_get_core_device, refreturn)
_WRAP_METHOD(Glib::RefPtr<const InputDevice> get_core_device(InputDeviceType device_type) const, clutter_device_manager_get_core_device, refreturn, constversion)
_IGNORE(clutter_get_input_device_for_id)
_IGNORE(clutter_get_input_device_for_id)// deprecated.
_WRAP_PROPERTY("backend", Glib::RefPtr<Backend>)
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment