Logo Search packages:      
Sourcecode: ardour version File versions  Download package

object.cc

// -*- c++ -*-
//  Generated by gtkmmproc from ./../object.gen_h -- DO NOT MODIFY!
#include <gtk--/object.h>
#include <gtk--/private/object_p.h>
#include <stdio.h>
#include <stdarg.h>
#include <gtk--/main.h>

#ifdef SIGC_CXX_NAMESPACES
using namespace SigC;
#endif

/*
static gint gtkmm_object_destroy_callback(GtkObject *o)
{
  gtk_object_destroy(o);
  return 0;
}
*/

void gtkmm_object_destroy(GtkObject *o)
{
  Gtk::wrap(o)->destroy_();
}

namespace Gtk
{

void Object::destroy_()
{
  if (!destroyed_&&!GTK_OBJECT_DESTROYED(gtkobject))
//    gtk_idle_add_priority(gtk_main_level(),
//                        GtkFunction(&gtkmm_object_destroy_callback),
//                  gtkobj());
    gtk_object_destroy(gtkobject);
  destroyed_=true;
}

void Object::gtkmm_sigsegv(const char *pos) {
    char c[10240];
    sprintf(c,"gtkmm_sigsegv(%s): assertion failed inside gtk--. Please make a stack dump with gdb and send it to gtkmm-main@sourceforge.net\n", pos);
    g_warning(c);
    char *f=0;
    *f=0; // sigsegv.
  };

Object::Object(GtkObject *castitem)
  {
    initialize_class();
    gtkobject = castitem;
    referenced_=true;
    destroyed_=false;

    if (!gtkobject) {
      g_warning("Do NOT call constructors with 0 argument! use default constructor instead, if such thing exists!\n");
      g_warning("castitem == 0 bug; not again!!! Flaming death...");
      gtkmm_sigsegv("Gtk::Object::Object(castitem)");
    }

    // THIS WORKS, DO NOT CHANGE!!!
    gtk_object_ref(gtkobject);
    gtk_object_sink(gtkobject);

    if (!gtk_object_get_data_by_id(gtkobject,quark_))
      gtk_object_set_data_by_id_full(gtkobject,quark_,(gpointer)this,&destroy_notify_);
    else
      g_warning("This object already has a wrapper.  Danger, danger!\n");

  }

Object::~Object()
  {
    // DON'T TOUCH THIS! (order is important, and objects change transparently)

    // remove our hook.
    GtkObject *object=gtkobject;
    gtkobject=0;
    if (object)
      {
        gtk_object_remove_no_notify_by_id(object,quark_);
        if (!GTK_OBJECT_DESTROYED(object))
          gtk_object_destroy(object);
        if (referenced_)
          gtk_object_unref(object);
      }
  }

void
Object::reference()
  {
    gtk_object_ref(gtkobject);
  }

void
Object::unreference()
  {
    gtk_object_unref(gtkobject);
  }

  // This should indicate that this was a C++ wrapper generated
  // by the translating API and not directly.
  // It must:
  //   remove the reference to the object so that object lifetime is not
  //     increased
void Object::set_dynamic()
  {
    if (!referenced_) return;

    // tell libsigc that the object is disposable
    ObjectScoped::set_dynamic();
    ObjectScoped::set_sink();

    // remove our reference
    if (gtkobject->ref_count==1)
      {
      // Cowardly refuse to remove last reference make floating instead
      gtkobject->flags|=GTK_FLOATING;
      }
    else
      gtk_object_unref(gtkobject);

    referenced_=0;
  }

void Object::destroy_notify_(gpointer p)
  {
    Object* o=(Object*)p;
    if (!o->referenced_)
      delete o;
    else
      o->gtkobject=0;
  }

void Object::set_type(GtkType type)
  {
   if (gtkobject)
     gtkobject->klass=(GtkObjectClass*)gtk_type_class(type);
  }

}

namespace Gtk {
Gtk::Object *wrap (GtkObject *o)
  {
    return static_cast<Gtk::Object *> (Gtk::wrap_auto ((GtkObject *) (o)));
  }
}

namespace Gtk {
Object_Class Object::object_class = {0};

Object* Object_Class::wrap_new(GtkObject* o)
  {
    Object* cpp=manage(new Object((GtkObject*)(o)));
    return cpp;
  }

bool Object::isA( Object *checkcast)
  {
    return GTK_IS_OBJECT(checkcast->gtkobj());
  }

GtkType Object::get_type()
  {
    return object_class.get_type();
  }

GtkType Object_Class::get_type()
  {
    if (!type)
      {
        CppClassParent::CppObjectType::get_type();
        GtkTypeInfo info =
          {
            "Gtk__Object",
            sizeof(BaseObjectType),
            sizeof(BaseClassType),
            (GtkClassInitFunc) class_init_function,
            (GtkObjectInitFunc) object_init_function,
            /* reserved_1 */ NULL,
            /* reserved_2 */ NULL,
            /*base_class_init_func */ (GtkClassInitFunc) NULL
          };
        type=gtk_type_unique(gtk_object_get_type(), &info);
      }
    return type;
  }

const char* const Object::signal_names[]={
   "destroy",
   0};

void Object::initialize_class()
  {

     object_self=this;

  }

void Object_Class::class_init_function(GtkObjectClass *klass)
  {
    CppClassParent::class_init_function((BaseClassParent*)klass);
  }

void Object_Class::object_init_function(GtkObject *)
  {}

}

void Gtk::Object::set_user_data(gpointer data)
  {
    gtk_object_set_user_data(gtkobj(),data);
  }

gpointer Gtk::Object::get_user_data() const
  {
    return gtk_object_get_user_data(const_cast<GtkObject*>(gtkobj()));
  }

void Gtk::Object::set_data(const string& key,gpointer data)
  {
    gtk_object_set_data(gtkobj(),key.c_str(),data);
  }

gpointer Gtk::Object::get_data(const string& key) const
  {
    return gtk_object_get_data(const_cast<GtkObject*>(gtkobj()),key.c_str());
  }

gpointer Gtk::Object::get_data_by_id(GQuark data_id) const
  {
    return gtk_object_get_data_by_id(const_cast<GtkObject*>(gtkobj()),data_id);
  }

void Gtk::Object::set_data_full(const string& key,gpointer data,GtkDestroyNotify destroy)
  {
    gtk_object_set_data_full(gtkobj(),key.c_str(),data,destroy);
  }

void Gtk::Object::set_data_by_id(GQuark data_id,gpointer data)
  {
    gtk_object_set_data_by_id(gtkobj(),data_id,data);
  }

void Gtk::Object::set_data_by_id_full(GQuark data_id,gpointer data,GtkDestroyNotify destroy)
  {
    gtk_object_set_data_by_id_full(gtkobj(),data_id,data,destroy);
  }

void Gtk::Object::remove_data(const string& key)
  {
    gtk_object_remove_data(gtkobj(),key.c_str());
  }

void Gtk::Object::remove_no_notify(const string& key)
  {
    gtk_object_remove_no_notify(gtkobj(),key.c_str());
  }

void Gtk::Object::remove_data_by_id(GQuark data_id)
  {
    gtk_object_remove_data_by_id(gtkobj(),data_id);
  }

void Gtk::Object::remove_no_notify_by_id(GQuark data_id)
  {
    gtk_object_remove_no_notify_by_id(gtkobj(),data_id);
  }

void Gtk::Object::weakref(GtkDestroyNotify notify,gpointer data)
  {
    gtk_object_weakref(gtkobj(),notify,data);
  }

void Gtk::Object::weakunref(GtkDestroyNotify notify,gpointer data)
  {
    gtk_object_weakunref(gtkobj(),notify,data);
  }

Generated by  Doxygen 1.6.0   Back to index