// Generated by gtkmmproc -- DO NOT MODIFY!


#include <cluttermm/media.h>
#include <cluttermm/private/media_p.h>

/* Copyright (C) 2007 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.
 */

namespace Clutter
{

} //namespace Clutter


namespace
{


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


} // anonymous namespace


namespace Glib
{

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

} // namespace Glib


namespace Clutter
{


/* The *_Class implementation: */

const Glib::Interface_Class& Media_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Interface_Class has to know the interface init function
    // in order to add interfaces to implementing types.
    class_init_func_ = &Media_Class::iface_init_function;

    // We can not derive from another interface, and it is not necessary anyway.
    gtype_ = clutter_media_get_type();
  }

  return *this;
}

void Media_Class::iface_init_function(void* g_iface, void*)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);

  //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
  //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
  g_assert(klass != 0); 


  klass->eos = &eos_callback;
}


void Media_Class::eos_callback(ClutterMedia* self)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->on_eos();
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  BaseClassType *const base = static_cast<BaseClassType*>(
        g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
)    );

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


Glib::ObjectBase* Media_Class::wrap_new(GObject* object)
{
  return new Media((ClutterMedia*)(object));
}


/* The implementation: */

Media::Media()
:
  Glib::Interface(media_class_.init())
{}

Media::Media(ClutterMedia* castitem)
:
  Glib::Interface((GObject*)(castitem))
{}

Media::Media(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}

Media::~Media()
{}

// static
void Media::add_interface(GType gtype_implementer)
{
  media_class_.init().add_interface(gtype_implementer);
}

Media::CppClassType Media::media_class_; // initialize static member

GType Media::get_type()
{
  return media_class_.init().get_type();
}


GType Media::get_base_type()
{
  return clutter_media_get_type();
}


void Media::set_uri(const Glib::ustring& uri)
{
clutter_media_set_uri(gobj(), uri.c_str()); 
}

Glib::ustring Media::get_uri() const
{
  return Glib::convert_return_gchar_ptr_to_ustring(clutter_media_get_uri(const_cast<ClutterMedia*>(gobj())));
}

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

bool Media::get_playing() const
{
  return clutter_media_get_playing(const_cast<ClutterMedia*>(gobj()));
}

void Media::set_progress(double progress)
{
clutter_media_set_progress(gobj(), progress); 
}

double Media::get_progress() const
{
  return clutter_media_get_progress(const_cast<ClutterMedia*>(gobj()));
}

void Media::set_subtitle_uri(const gchar * uri)
{
clutter_media_set_subtitle_uri(gobj(), uri); 
}

std::string Media::get_subtitle_uri() const
{
  return Glib::convert_return_gchar_ptr_to_stdstring(clutter_media_get_subtitle_uri(const_cast<ClutterMedia*>(gobj())));
}

void Media::set_subtitle_font_name(const std::string& font_name)
{
clutter_media_set_subtitle_font_name(gobj(), font_name.c_str()); 
}

std::string Media::get_subtitle_font_name() const
{
  return Glib::convert_return_gchar_ptr_to_stdstring(clutter_media_get_subtitle_font_name(const_cast<ClutterMedia*>(gobj())));
}

void Media::set_audio_volume(double volume)
{
clutter_media_set_audio_volume(gobj(), volume); 
}

double Media::get_audio_volume() const
{
  return clutter_media_get_audio_volume(const_cast<ClutterMedia*>(gobj()));
}

double Media::get_buffer_percent() const
{
  return clutter_media_get_buffer_fill(const_cast<ClutterMedia*>(gobj()));
}

void Media::set_filename(const Glib::ustring& filename)
{
clutter_media_set_filename(gobj(), filename.c_str()); 
}

bool Media::get_can_seek() const
{
  return clutter_media_get_can_seek(const_cast<ClutterMedia*>(gobj()));
}

double Media::get_duration() const
{
  return clutter_media_get_duration(const_cast<ClutterMedia*>(gobj()));
}


Glib::SignalProxy0< void > Media::signal_eos()
{
  return Glib::SignalProxy0< void >(this, &Media_signal_eos_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<double> Media::property_buffer_fill() const
{
  return Glib::PropertyProxy_ReadOnly<double>(this, "buffer-fill");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Media::property_can_seek() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "can-seek");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<guint> Media::property_duration() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "duration");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> Media::property_playing() 
{
  return Glib::PropertyProxy<bool>(this, "playing");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> Media::property_playing() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "playing");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<double> Media::property_progress() 
{
  return Glib::PropertyProxy<double>(this, "progress");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<double> Media::property_progress() const
{
  return Glib::PropertyProxy_ReadOnly<double>(this, "progress");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> Media::property_uri() 
{
  return Glib::PropertyProxy<Glib::ustring>(this, "uri");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> Media::property_uri() const
{
  return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "uri");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<double> Media::property_audio_volume() 
{
  return Glib::PropertyProxy<double>(this, "audio-volume");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<double> Media::property_audio_volume() const
{
  return Glib::PropertyProxy_ReadOnly<double>(this, "audio-volume");
}
#endif //GLIBMM_PROPERTIES_ENABLED


void Clutter::Media::on_eos()
{
  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
)  );

  if(base && base->eos)
    (*base->eos)(gobj());
}


} // namespace Clutter


