// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/device-manager.h>
#include <cluttermm/private/device-manager_p.h>

/* 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

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Clutter::DeviceManager> wrap(ClutterDeviceManager* object, bool take_copy)
{
  return Glib::RefPtr<Clutter::DeviceManager>( dynamic_cast<Clutter::DeviceManager*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Clutter
{


/* The *_Class implementation: */

const Glib::Class& DeviceManager_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &DeviceManager_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(clutter_device_manager_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void DeviceManager_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


}


Glib::ObjectBase* DeviceManager_Class::wrap_new(GObject* object)
{
  return new DeviceManager((ClutterDeviceManager*)object);
}


/* The implementation: */

ClutterDeviceManager* DeviceManager::gobj_copy()
{
  reference();
  return gobj();
}

DeviceManager::DeviceManager(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

DeviceManager::DeviceManager(ClutterDeviceManager* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


DeviceManager::~DeviceManager()
{}


DeviceManager::CppClassType DeviceManager::devicemanager_class_; // initialize static member

GType DeviceManager::get_type()
{
  return devicemanager_class_.init().get_type();
}


GType DeviceManager::get_base_type()
{
  return clutter_device_manager_get_type();
}


DeviceManager::DeviceManager()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(devicemanager_class_.init()))
{
  

}

Glib::RefPtr<InputDevice> DeviceManager::get_device(int device_id)
{

  Glib::RefPtr<InputDevice> retvalue = Glib::wrap(clutter_device_manager_get_device(gobj(), device_id));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const InputDevice> DeviceManager::get_device(int device_id) const
{
  return const_cast<DeviceManager*>(this)->get_device(device_id);
}

Glib::RefPtr<InputDevice> DeviceManager::get_core_device(InputDeviceType device_type)
{

  Glib::RefPtr<InputDevice> retvalue = Glib::wrap(clutter_device_manager_get_core_device(gobj(), ((ClutterInputDeviceType)(device_type))));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const InputDevice> DeviceManager::get_core_device(InputDeviceType device_type) const
{
  return const_cast<DeviceManager*>(this)->get_core_device(device_type);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Backend> > DeviceManager::property_backend() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Backend> >(this, "backend");
}
#endif //GLIBMM_PROPERTIES_ENABLED


} // namespace Clutter


