// Generated by gmmproc 2.63.1 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gdkmm/device.h>
#include <gdkmm/private/device_p.h>


/* Copyright 2002 The gtkmm 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gdk/gdk.h>
#include <gdkmm/cursor.h>
#include <gdkmm/devicetool.h>
#include <gdkmm/devicewithpad.h>
#include <gdkmm/display.h>
#include <gdkmm/seat.h>
#include <gdkmm/surface.h>

using Type = Gdk::Device::Type;

namespace Gdk
{

std::vector<TimeCoord> Device::get_history(const Glib::RefPtr<Surface>& surface, guint32 start, guint32 stop) const
{
  GdkTimeCoord** coords = nullptr;
  int events_count = 0;

  // we don't care about returned value - false means that either getting history is unsupported or no motion events happened.
  // it is undistinguishable.
  gdk_device_get_history(const_cast<GdkDevice*>(gobj()), Glib::unwrap(surface), start, stop, &coords, &events_count);
  return Glib::ArrayHandler<TimeCoord, TimeCoordPtrTraits>::array_to_vector(coords, events_count, Glib::OWNERSHIP_DEEP);
}

Glib::RefPtr<Surface> Device::get_surface_at_position()
{
  auto retvalue = Glib::wrap(gdk_device_get_surface_at_position(gobj(), nullptr, nullptr));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Surface> Device::get_surface_at_position() const
{
  return const_cast<Device*>(this)->get_surface_at_position();
}

std::vector<std::string> Device::list_axes() const
{
  auto glist = gdk_device_list_axes(const_cast<GdkDevice*>(gobj()));
  return Glib::ListHandler<std::string, AtomStringTraits>::list_to_vector(glist, Glib::OWNERSHIP_SHALLOW);
}

// Custom wrap_new() because we want to create a DeviceWithPad, if the underlying
// C class implements the GdkDevicePad interface.
Glib::ObjectBase* Device_Class::wrap_new(GObject* object)
{
  // GdkDevice is an abstract class. C functions that return a GdkDevice* usually
  // (always?) return a pointer to a subclass of GdkDevice. Some subclasses, e.g.
  // GdkWaylandDevicePad, implement the GdkDevicePad interface.
  // Give C++ programmers a chance to access methods in that interface, although
  // gtkmm does not wrap subclasses of GdkDevice.

  if (GDK_IS_DEVICE_PAD(object))
     return new DeviceWithPad((GdkDevice*)object);
  return new Device((GdkDevice*)object);
}

bool Device::has_device_pad() const
{
  return dynamic_cast<const DeviceWithPad*>(this) != nullptr;
}

Glib::RefPtr<DeviceWithPad> Device::device_with_pad_cast()
{
  auto retvalue = Glib::make_refptr_for_instance<DeviceWithPad>(dynamic_cast<DeviceWithPad*>(this));
  if (retvalue)
    retvalue->reference();
  return retvalue;
}

Glib::RefPtr<const DeviceWithPad> Device::device_with_pad_cast() const
{
  return const_cast<Device*>(this)->device_with_pad_cast();
}

} // namespace Gdk

namespace
{


static const Glib::SignalProxyInfo Device_signal_changed_info =
{
  "changed",
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
  (GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};


static void Device_signal_tool_changed_callback(GdkDevice* self, GdkDeviceTool* p0,void* data)
{
  using namespace Gdk;
  using SlotType = sigc::slot<void(const Glib::RefPtr<DeviceTool>&)>;

  auto obj = dynamic_cast<Device*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
);
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }
}

static const Glib::SignalProxyInfo Device_signal_tool_changed_info =
{
  "tool-changed",
  (GCallback) &Device_signal_tool_changed_callback,
  (GCallback) &Device_signal_tool_changed_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gdk::EventMask>::value_type()
{
  return gdk_event_mask_get_type();
}

// static
GType Glib::Value<Gdk::InputMode>::value_type()
{
  return gdk_input_mode_get_type();
}

// static
GType Glib::Value<Gdk::InputSource>::value_type()
{
  return gdk_input_source_get_type();
}

// static
GType Glib::Value<Gdk::GrabStatus>::value_type()
{
  return gdk_grab_status_get_type();
}

// static
GType Glib::Value<Gdk::Device::Type>::value_type()
{
  return gdk_device_type_get_type();
}


namespace Glib
{

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

} /* namespace Glib */


namespace Gdk
{


/* The *_Class implementation: */

const Glib::Class& Device_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_ = &Device_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(gdk_device_get_type());

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

  }

  return *this;
}


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


}


/* The implementation: */

GdkDevice* Device::gobj_copy()
{
  reference();
  return gobj();
}

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

}

Device::Device(GdkDevice* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Device::Device(Device&& src) noexcept
: Glib::Object(std::move(src))
{}

Device& Device::operator=(Device&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  return *this;
}


Device::~Device() noexcept
{}


Device::CppClassType Device::device_class_; // initialize static member

GType Device::get_type()
{
  return device_class_.init().get_type();
}


GType Device::get_base_type()
{
  return gdk_device_get_type();
}


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

}

Glib::ustring Device::get_name() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gdk_device_get_name(const_cast<GdkDevice*>(gobj())));
}

bool Device::get_has_cursor() const
{
  return gdk_device_get_has_cursor(const_cast<GdkDevice*>(gobj()));
}

InputSource Device::get_source() const
{
  return static_cast<InputSource>(gdk_device_get_source(const_cast<GdkDevice*>(gobj())));
}

InputMode Device::get_mode() const
{
  return static_cast<InputMode>(gdk_device_get_mode(const_cast<GdkDevice*>(gobj())));
}

bool Device::set_mode(InputMode mode)
{
  return gdk_device_set_mode(gobj(), static_cast<GdkInputMode>(mode));
}

int Device::get_n_keys() const
{
  return gdk_device_get_n_keys(const_cast<GdkDevice*>(gobj()));
}

bool Device::get_key(guint index_, guint& keyval, ModifierType& modifiers) const
{
  return gdk_device_get_key(const_cast<GdkDevice*>(gobj()), index_, &(keyval), ((GdkModifierType*) &(modifiers)));
}

void Device::set_key(guint index_, guint keyval, ModifierType modifiers)
{
  gdk_device_set_key(gobj(), index_, keyval, static_cast<GdkModifierType>(modifiers));
}

AxisUse Device::get_axis_use(guint index_) const
{
  return static_cast<AxisUse>(gdk_device_get_axis_use(const_cast<GdkDevice*>(gobj()), index_));
}

void Device::set_axis_use(guint index_, AxisUse use)
{
  gdk_device_set_axis_use(gobj(), index_, static_cast<GdkAxisUse>(use));
}

void Device::get_state(const Glib::RefPtr<Surface>& surface, double& axes, ModifierType& mask)
{
  gdk_device_get_state(gobj(), Glib::unwrap(surface), &(axes), ((GdkModifierType*) &(mask)));
}

std::vector<Glib::RefPtr<Gdk::Device> > Device::list_slave_devices()
{
  return Glib::ListHandler<Glib::RefPtr<Gdk::Device> >::list_to_vector(gdk_device_list_slave_devices(gobj()), Glib::OWNERSHIP_SHALLOW);
}

int Device::get_n_axes() const
{
  return gdk_device_get_n_axes(const_cast<GdkDevice*>(gobj()));
}

bool Device::get_axis_value(double& axes, GdkAtom axis_label, double& value) const
{
  return gdk_device_get_axis_value(const_cast<GdkDevice*>(gobj()), &(axes), axis_label, &(value));
}

bool Device::get_axis(double& axes, AxisUse use, double& value) const
{
  return gdk_device_get_axis(const_cast<GdkDevice*>(gobj()), &(axes), static_cast<GdkAxisUse>(use), &(value));
}

Glib::RefPtr<Display> Device::get_display()
{
  auto retvalue = Glib::wrap(gdk_device_get_display(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Display> Device::get_display() const
{
  return const_cast<Device*>(this)->get_display();
}

Glib::RefPtr<Device> Device::get_associated_device()
{
  auto retvalue = Glib::wrap(gdk_device_get_associated_device(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Device> Device::get_associated_device() const
{
  return const_cast<Device*>(this)->get_associated_device();
}

Type Device::get_device_type() const
{
  return static_cast<Type>(gdk_device_get_device_type(const_cast<GdkDevice*>(gobj())));
}

Glib::RefPtr<Surface> Device::get_surface_at_position(double& win_x, double& win_y)
{
  auto retvalue = Glib::wrap(gdk_device_get_surface_at_position(gobj(), &(win_x), &(win_y)));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Surface> Device::get_surface_at_position(double& win_x, double& win_y) const
{
  return const_cast<Device*>(this)->get_surface_at_position(win_x, win_y);
}

Glib::RefPtr<Surface> Device::get_last_event_surface()
{
  auto retvalue = Glib::wrap(gdk_device_get_last_event_surface(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Surface> Device::get_last_event_surface() const
{
  return const_cast<Device*>(this)->get_last_event_surface();
}

Glib::ustring Device::get_vendor_id() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(gdk_device_get_vendor_id(const_cast<GdkDevice*>(gobj())));
}

Glib::ustring Device::get_product_id()
{
  return Glib::convert_const_gchar_ptr_to_ustring(gdk_device_get_product_id(gobj()));
}

Glib::RefPtr<Seat> Device::get_seat()
{
  auto retvalue = Glib::wrap(gdk_device_get_seat(gobj()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const Seat> Device::get_seat() const
{
  return const_cast<Device*>(this)->get_seat();
}

AxisFlags Device::get_axes() const
{
  return static_cast<AxisFlags>(gdk_device_get_axes(const_cast<GdkDevice*>(gobj())));
}


Glib::SignalProxy<void()> Device::signal_changed()
{
  return Glib::SignalProxy<void() >(this, &Device_signal_changed_info);
}


Glib::SignalProxy<void(const Glib::RefPtr<DeviceTool>&)> Device::signal_tool_changed()
{
  return Glib::SignalProxy<void(const Glib::RefPtr<DeviceTool>&) >(this, &Device_signal_tool_changed_info);
}


static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Display>>::value,
  "Type Glib::RefPtr<Display> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> > Device::property_display() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Display> >(this, "display");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > Device::property_name() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Type>::value,
  "Type Type cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< Type > Device::property_type() const
{
  return Glib::PropertyProxy_ReadOnly< Type >(this, "type");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Device>>::value,
  "Type Glib::RefPtr<Device> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Device> > Device::property_associated_device() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Device> >(this, "associated-device");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<InputSource>::value,
  "Type InputSource cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< InputSource > Device::property_input_source() const
{
  return Glib::PropertyProxy_ReadOnly< InputSource >(this, "input-source");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<InputMode>::value,
  "Type InputMode cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< InputMode > Device::property_input_mode() 
{
  return Glib::PropertyProxy< InputMode >(this, "input-mode");
}

Glib::PropertyProxy_ReadOnly< InputMode > Device::property_input_mode() const
{
  return Glib::PropertyProxy_ReadOnly< InputMode >(this, "input-mode");
}

Glib::PropertyProxy_ReadOnly< bool > Device::property_has_cursor() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "has-cursor");
}

Glib::PropertyProxy_ReadOnly< guint > Device::property_n_axes() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "n-axes");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > Device::property_vendor_id() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "vendor-id");
}

Glib::PropertyProxy_ReadOnly< Glib::ustring > Device::property_product_id() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "product-id");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<Seat>>::value,
  "Type Glib::RefPtr<Seat> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy< Glib::RefPtr<Seat> > Device::property_seat() 
{
  return Glib::PropertyProxy< Glib::RefPtr<Seat> >(this, "seat");
}

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Seat> > Device::property_seat() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Seat> >(this, "seat");
}

Glib::PropertyProxy_ReadOnly< guint > Device::property_num_touches() const
{
  return Glib::PropertyProxy_ReadOnly< guint >(this, "num-touches");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<AxisFlags>::value,
  "Type AxisFlags cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< AxisFlags > Device::property_axes() const
{
  return Glib::PropertyProxy_ReadOnly< AxisFlags >(this, "axes");
}

static_assert(Glib::Traits::ValueCompatibleWithWrapProperty<Glib::RefPtr<DeviceTool>>::value,
  "Type Glib::RefPtr<DeviceTool> cannot be used in _WRAP_PROPERTY. "
  "There is no suitable template specialization of Glib::Value<>.");

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DeviceTool> > Device::property_tool() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<DeviceTool> >(this, "tool");
}


} // namespace Gdk


