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

main.cc

// -*- c++ -*-
//  Generated by gtkmmproc from ./../main.gen_h -- DO NOT MODIFY!
#include <gtk--/main.h>
#include <gtk--/private/main_p.h>
#include <gtk--/widget.h>
extern void gtkmm_wrap_init();

namespace Gtk
{

void Main::run_impl() { gtk_main(); }
void Main::quit_impl() { gtk_main_quit(); }
void Main::iteration_impl(bool blocking) { gtk_main_iteration_do(blocking); }
gint Main::events_pending_impl() {return gtk_events_pending();}


// initialize static objects
Main*         Main::instance_=0;
IdleSig       Main::idle;
QuitSig       Main::quit;
TimeoutSig    Main::timeout;
InputSig      Main::input;
KeySnooperSig Main::key_snooper;


Main::Main(int &argc, char **&argv, bool have_locale)
{
  init(&argc,&argv,have_locale);
}

Main::Main(int *argc, char ***argv, bool have_locale)
{
   init(argc,argv,have_locale);
}

void Main::init(int *argc, char ***argv,
                bool have_locale)
{
  if (instance_) {
    g_warning("Main::Main called twice!\n");
  } else {
    instance_=this;

    if (have_locale == true)
      gtk_set_locale();
    gtk_init(argc, argv);

    init_gtkmm_internals();
  }
}

void
Main::init_gtkmm_internals()
{
  gtkmm_wrap_init();
  if (!quark_)
    quark_ = g_quark_from_static_string ("gtkmm");
}


Main::Main()
{
  // Only used by subclasses
  init_gtkmm_internals();
}

Main::~Main() {
  instance_=0;
  //gtk_exit(0);
}

// static_init_for_gtkmm::static_init_for_gtkmm() {}

void
Main::grab_add(Widget &widget)
{
  gtk_grab_add(widget.gtkobj());
}

void
Main::grab_remove(Widget &widget)
{
  gtk_grab_remove(widget.gtkobj());
}

Widget*
Main::grab_get_current()
{
  return wrap(gtk_grab_get_current());
}

void
Main::gtk_true()
{
  gtk_true();
}

void
Main::gtk_false()
{
  gtk_false();
}

//***********************************************************************
using SigC::SlotData;
using SigC::SlotNode;

// structs to clean up gtk resources after connection is broken
struct IdleNode : public SlotNode
{
  guint connid;
  IdleNode(guint cid):connid(cid) {}
  virtual ~IdleNode();
};

struct TimeoutNode : public SlotNode
{
  guint connid;
  TimeoutNode(guint cid):connid(cid) {}
  virtual ~TimeoutNode();
};

struct KeySnooperNode : public SlotNode
{
  guint connid;
  KeySnooperNode(guint cid):connid(cid) {}
  virtual ~KeySnooperNode();
};

struct InputNode : public SlotNode
{
  guint connid;
  InputNode(guint cid):connid(cid) {}
  virtual ~InputNode();
};

struct QuitNode : public SlotNode
{
  guint connid;
  QuitNode(guint cid):connid(cid) {}
  virtual ~QuitNode();
};


//***********************************************************************

IdleNode::~IdleNode()
{
  gtk_idle_remove(connid);
}

TimeoutNode::~TimeoutNode()
{
  gtk_timeout_remove(connid);
}

KeySnooperNode::~KeySnooperNode()
{
  gtk_key_snooper_remove(connid);
}

InputNode::~InputNode()
{
  gtk_input_remove(connid);
}

QuitNode::~QuitNode()
{
  gtk_quit_remove(connid);
}

//***********************************************************************


gint IdleSig::gtk_callback(gpointer d)
{
  Callback* data=(Callback*)d;
  return data->call();
}

Connection IdleSig::connect(const SlotType &s,gint priority)
{
  // connect to gtk object
  SigC::SlotData* sd=(SigC::SlotData*)(s.obj());
  guint connid=gtk_idle_add_priority(priority,&gtk_callback,
                                   (gpointer)&(sd->data_));
  sd->connect();

  // register disconnection data
  sd->list_.insert_direct(sd->list_.begin(),
                          new IdleNode(connid));
  return sd;
}

gint TimeoutSig::gtk_callback(gpointer d)
{
  Callback* data=(Callback*)d;
  return data->call();
}

Connection TimeoutSig::connect(const SlotType &s,guint32 interval)
{
  // connect to gtk object
  SlotData* sd=(SlotData*)(s.obj());
  guint connid=gtk_timeout_add(interval,&gtk_callback,
                             (gpointer)&(sd->data_));
  sd->connect();

  // register disconnection data
  sd->list_.insert_direct(sd->list_.begin(),
                          new TimeoutNode(connid));
  return sd;
};

gint KeySnooperSig::gtk_callback(GtkWidget* w,GdkEventKey* k,gpointer d)
{
  Callback* data=(Callback*)d;
  return data->call(wrap(w),k);
}

Connection KeySnooperSig::connect(const SlotType &s)
{
  // connect to gtk object
  SlotData* sd=(SlotData*)(s.obj());
  guint connid=gtk_key_snooper_install(&gtk_callback,
                                     (gpointer)&(sd->data_));
  sd->connect();

  // register disconnection data
  sd->list_.insert_direct(sd->list_.begin(),
                          new KeySnooperNode(connid));
  return sd;
};

void InputSig::gtk_callback(gpointer d,
                           gint              source,
                           GdkInputCondition condition)
{
  Callback* data=(Callback*)d;
  data->call(source,condition);
}

Connection InputSig::connect(const SlotType &s,
                              gint source,
                              GdkInputCondition condition)
{
  // connect to gtk object
  SlotData* sd=(SlotData*)(s.obj());
  guint connid=gtk_input_add_full(source,condition,&gtk_callback,0,
                                     (gpointer)&(sd->data_),0);
  sd->connect();

  // register disconnection data
  sd->list_.insert_direct(sd->list_.begin(),
                          new InputNode(connid));
  return sd;
};

gint QuitSig::gtk_callback(gpointer d)
{
  Callback* data=(Callback*)d;
  return data->call();
}

void QuitSig::callback(void* data)
{
  Main::instance()->quit_impl();
}

Connection QuitSig::connect(const InSlotType &s,guint main_level)
{
  // connect to gtk object
  SlotData* sd=(SlotData*)(s.obj());
  guint connid=gtk_quit_add(main_level,&gtk_callback,(gpointer)&(sd->data_));
  sd->connect();

  // register disconnection data
  sd->list_.insert_direct(sd->list_.begin(),
                          new QuitNode(connid));
  return sd;
};

SigC::Slot0<void> QuitSig::slot()
{
  SlotData* tmp=manage(new SlotData());
  Data& data=reinterpret_cast<Data&>(tmp->data_);

#ifdef SIGC_CXX_PARTIAL_SPEC
  data.callback=&callback;
#else
  data.callback=reinterpret_cast<SigC::Trait<void>::type (*) (void *)>
     (&callback);
#endif

  return tmp;
}

}

Generated by  Doxygen 1.6.0   Back to index