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


#include <glibmm.h>

#include <gtkmm/mediastream.h>
#include <gtkmm/private/mediastream_p.h>


/* Copyright (C) 2018 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, see <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>

namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gtk
{


/* The *_Class implementation: */

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

    // Add derived versions of interfaces, if the C type implements any interfaces:
  Gdk::Paintable::add_interface(get_type());

  }

  return *this;
}


void MediaStream_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);

  klass->play = &play_vfunc_callback;
  klass->pause = &pause_vfunc_callback;
  klass->seek = &seek_vfunc_callback;
  klass->update_audio = &update_audio_vfunc_callback;
  klass->realize = &realize_vfunc_callback;
  klass->unrealize = &unrealize_vfunc_callback;

}

gboolean MediaStream_Class::play_vfunc_callback(GtkMediaStream* self)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->play_vfunc());
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->play)
    return (*base->play)(self);

  using RType = gboolean;
  return RType();
}
void MediaStream_Class::pause_vfunc_callback(GtkMediaStream* self)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->pause_vfunc();
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->pause)
    (*base->pause)(self);
}
void MediaStream_Class::seek_vfunc_callback(GtkMediaStream* self, gint64 timestamp)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->seek_vfunc(timestamp);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->seek)
    (*base->seek)(self, timestamp);
}
void MediaStream_Class::update_audio_vfunc_callback(GtkMediaStream* self, gboolean muted, double volume)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->update_audio_vfunc(muted
, volume);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->update_audio)
    (*base->update_audio)(self, muted, volume);
}
void MediaStream_Class::realize_vfunc_callback(GtkMediaStream* self, GdkSurface* surface)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->realize_vfunc(Glib::wrap(surface, true)
);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->realize)
    (*base->realize)(self, surface);
}
void MediaStream_Class::unrealize_vfunc_callback(GtkMediaStream* self, GdkSurface* surface)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        obj->unrealize_vfunc(Glib::wrap(surface, true)
);
        return;
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->unrealize)
    (*base->unrealize)(self, surface);
}


Glib::ObjectBase* MediaStream_Class::wrap_new(GObject* object)
{
  return new MediaStream((GtkMediaStream*)object);
}


/* The implementation: */

GtkMediaStream* MediaStream::gobj_copy()
{
  reference();
  return gobj();
}

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

}

MediaStream::MediaStream(GtkMediaStream* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


MediaStream::MediaStream(MediaStream&& src) noexcept
: Glib::Object(std::move(src))
  , Gdk::Paintable(std::move(src))
{}

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


MediaStream::~MediaStream() noexcept
{}


MediaStream::CppClassType MediaStream::mediastream_class_; // initialize static member

GType MediaStream::get_type()
{
  return mediastream_class_.init().get_type();
}


GType MediaStream::get_base_type()
{
  return gtk_media_stream_get_type();
}


bool MediaStream::is_prepared() const
{
  return gtk_media_stream_is_prepared(const_cast<GtkMediaStream*>(gobj()));
}

Glib::Error MediaStream::get_error() const
{
  return Glib::Error(const_cast<GError*>(gtk_media_stream_get_error(const_cast<GtkMediaStream*>(gobj()))), true);
}

bool MediaStream::has_audio() const
{
  return gtk_media_stream_has_audio(const_cast<GtkMediaStream*>(gobj()));
}

bool MediaStream::has_video() const
{
  return gtk_media_stream_has_video(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::play()
{
  gtk_media_stream_play(gobj());
}

void MediaStream::pause()
{
  gtk_media_stream_pause(gobj());
}

bool MediaStream::get_playing() const
{
  return gtk_media_stream_get_playing(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::set_playing(bool playing)
{
  gtk_media_stream_set_playing(gobj(), static_cast<int>(playing));
}

bool MediaStream::get_ended() const
{
  return gtk_media_stream_get_ended(const_cast<GtkMediaStream*>(gobj()));
}

gint64 MediaStream::get_timestamp() const
{
  return gtk_media_stream_get_timestamp(const_cast<GtkMediaStream*>(gobj()));
}

gint64 MediaStream::get_duration() const
{
  return gtk_media_stream_get_duration(const_cast<GtkMediaStream*>(gobj()));
}

bool MediaStream::is_seekable() const
{
  return gtk_media_stream_is_seekable(const_cast<GtkMediaStream*>(gobj()));
}

bool MediaStream::is_seeking() const
{
  return gtk_media_stream_is_seeking(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::seek(gint64 timestamp)
{
  gtk_media_stream_seek(gobj(), timestamp);
}

bool MediaStream::get_loop() const
{
  return gtk_media_stream_get_loop(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::set_loop(bool loop)
{
  gtk_media_stream_set_loop(gobj(), static_cast<int>(loop));
}

bool MediaStream::get_muted() const
{
  return gtk_media_stream_get_muted(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::set_muted(bool muted)
{
  gtk_media_stream_set_muted(gobj(), static_cast<int>(muted));
}

double MediaStream::get_volume() const
{
  return gtk_media_stream_get_volume(const_cast<GtkMediaStream*>(gobj()));
}

void MediaStream::set_volume(double volume)
{
  gtk_media_stream_set_volume(gobj(), volume);
}

void MediaStream::realize(const Glib::RefPtr<Gdk::Surface>& surface)
{
  gtk_media_stream_realize(gobj(), Glib::unwrap(surface));
}

void MediaStream::unrealize(const Glib::RefPtr<Gdk::Surface>& surface)
{
  gtk_media_stream_unrealize(gobj(), Glib::unwrap(surface));
}

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void MediaStream::prepared(bool has_audio, bool has_video, bool seekable, gint64 duration)
{
  gtk_media_stream_prepared(gobj(), static_cast<int>(has_audio), static_cast<int>(has_video), static_cast<int>(seekable), duration);
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void MediaStream::unprepared()
{
  gtk_media_stream_unprepared(gobj());
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

void MediaStream::stream_prepared(bool has_audio, bool has_video, bool seekable, gint64 duration)
{
  gtk_media_stream_stream_prepared(gobj(), static_cast<int>(has_audio), static_cast<int>(has_video), static_cast<int>(seekable), duration);
}

void MediaStream::stream_unprepared()
{
  gtk_media_stream_stream_unprepared(gobj());
}

void MediaStream::update(gint64 timestamp)
{
  gtk_media_stream_update(gobj(), timestamp);
}

#ifndef GTKMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void MediaStream::ended()
{
  gtk_media_stream_ended(gobj());
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GTKMM_DISABLE_DEPRECATED

void MediaStream::stream_ended()
{
  gtk_media_stream_stream_ended(gobj());
}

void MediaStream::seek_success()
{
  gtk_media_stream_seek_success(gobj());
}

void MediaStream::seek_failed()
{
  gtk_media_stream_seek_failed(gobj());
}

void MediaStream::set_error(const Glib::Error& error)
{
  gtk_media_stream_gerror(gobj(), g_error_copy((error).gobj()));
}


Glib::PropertyProxy< bool > MediaStream::property_prepared() 
{
  return Glib::PropertyProxy< bool >(this, "prepared");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_prepared() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "prepared");
}

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

Glib::PropertyProxy_ReadOnly< Glib::Error > MediaStream::property_error() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::Error >(this, "error");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_has_audio() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "has-audio");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_has_video() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "has-video");
}

Glib::PropertyProxy< bool > MediaStream::property_playing() 
{
  return Glib::PropertyProxy< bool >(this, "playing");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_playing() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "playing");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_ended() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "ended");
}

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

Glib::PropertyProxy_ReadOnly< gint64 > MediaStream::property_timestamp() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "timestamp");
}

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

Glib::PropertyProxy_ReadOnly< gint64 > MediaStream::property_duration() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "duration");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_seekable() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "seekable");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_seeking() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "seeking");
}

Glib::PropertyProxy< bool > MediaStream::property_loop() 
{
  return Glib::PropertyProxy< bool >(this, "loop");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_loop() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "loop");
}

Glib::PropertyProxy< bool > MediaStream::property_muted() 
{
  return Glib::PropertyProxy< bool >(this, "muted");
}

Glib::PropertyProxy_ReadOnly< bool > MediaStream::property_muted() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "muted");
}

Glib::PropertyProxy< double > MediaStream::property_volume() 
{
  return Glib::PropertyProxy< double >(this, "volume");
}

Glib::PropertyProxy_ReadOnly< double > MediaStream::property_volume() const
{
  return Glib::PropertyProxy_ReadOnly< double >(this, "volume");
}


bool Gtk::MediaStream::play_vfunc() 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->play)
  {
    bool retval((*base->play)(gobj()));
    return retval;
  }

  using RType = bool;
  return RType();
}
void Gtk::MediaStream::pause_vfunc() 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->pause)
  {
    (*base->pause)(gobj());
  }
}
void Gtk::MediaStream::seek_vfunc(gint64 timestamp) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->seek)
  {
    (*base->seek)(gobj(),timestamp);
  }
}
void Gtk::MediaStream::update_audio_vfunc(bool muted, double volume) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->update_audio)
  {
    (*base->update_audio)(gobj(),static_cast<int>(muted),volume);
  }
}
void Gtk::MediaStream::realize_vfunc(const Glib::RefPtr<Gdk::Surface>& surface) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->realize)
  {
    (*base->realize)(gobj(),Glib::unwrap(surface));
  }
}
void Gtk::MediaStream::unrealize_vfunc(const Glib::RefPtr<Gdk::Surface>& surface) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->unrealize)
  {
    (*base->unrealize)(gobj(),Glib::unwrap(surface));
  }
}


} // namespace Gtk


