// -*- c++ -*-
/*  Generated by gensig from menufactory.gen_h. DO NOT MODIFY!!! */
#ifndef GTKMM_MENUFACTORY_HEADER
#define GTKMM_MENUFACTORY_HEADER
/* $Id: menufactory.gen_h,v 1.32.2.1 1999/05/01 18:02:24 terop Exp $ */

/* menufactory.h
 * 
 * Copyright (C) 1998-1999 
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtk--/object.h>
#include <gtk--/menubar.h>
#line 25 "menufactory.gen_h"
#include <gtk--/accelgroup.h>
#line 29 "menufactory.gen_h"
#include <gtk/gtkmenufactory.h>

class Gtk_MenuFactory;

// MenuFactoryConnector code (c) 1998 by Chris Cannam

class MenuFactoryConnectorBase
{
protected:
  friend class Gtk_MenuFactory;
  virtual void connectTo(Gtk_MenuItem *) const = 0;
  MenuFactoryConnectorBase() {};
};


template <class T, class DT>
class MenuFactoryConnector : public MenuFactoryConnectorBase
{
public:
  MenuFactoryConnector(T *target_widget,
		       void (T::*target_method)(DT),
		       const DT &target_method_arg) :
    m_widget(target_widget),
    m_method(target_method),
    m_method_no_arg(0),
    m_method_arg(target_method_arg) {}

  MenuFactoryConnector(T *target_widget,
		       void (T::*target_method)()) :
    m_widget(target_widget),
    m_method(0),
    m_method_no_arg(target_method),
    m_method_arg(0) {}

protected:
  friend class Gtk_MenuFactory;
  virtual void connectTo(Gtk_MenuItem *m) const {

    if(m_method) {
      Connection_impl* s=new Slot0cb<T,DT>(m_widget,m_method,m_method_arg);
      m->activate.sender->insert_connection(s);
      gint conn=m->activate.sender->signal_connect(m->activate.signal_name, GtkSignalFunc(Slot0cb<T,DT>::callback),s);
      s->setgtkconnection(m->activate.sender->gtkobj(),conn);
    } else {
      Connection_impl* s=new Slot0<T>(m_widget,m_method_no_arg);
      m->activate.sender->insert_connection(s);
      gint conn=m->activate.sender->signal_connect(m->activate.signal_name, GtkSignalFunc(Slot0<T>::callback),s);
      s->setgtkconnection(m->activate.sender->gtkobj(),conn);
    }
    /*
      connect_to_method((Signal_proxy0<void,Gtk_MenuItem,GtkObject>&)m->activate, (T*)m_widget, (void(T::*)(DT))m_method, (DT)m_method_arg);
    */
  }

private:
  T *m_widget;
  void (T::*m_method)(DT);
  void (T::*m_method_no_arg)();
  DT m_method_arg;
};


#line 91 "menufactory.gen_h"


class Gtk_MenuFactory {
  Gtk_MenuBar *menubar;
#line 96 "menufactory.gen_h"
  Gtk_AccelGroup *accel_group;
#line 100 "menufactory.gen_h"
public:
  Gtk_MenuFactory(GtkMenuFactoryType type);
  Gtk_MenuFactory(GtkMenuFactory *castitem);
  virtual ~Gtk_MenuFactory();
  static bool isGtkMenuFactory(Gtk_Object *checkcast);
  void add_entries(GtkMenuEntry *entries, int nentries); /* DON'T USE */

  // We check if the compiler supports template match with
  // memberfunction pointer... gcc2.7.2 does not compile this code...

#ifdef GTKMM_CXX_HAVE_MEMBER_TEMPLATES
  template <class T>
  Gtk_MenuItem* add_entry(char *path,
			  char *accelerator,
			  T *target_widget,
			  void (T::*target_method)(char*),
			  char *target_method_arg);
#endif
  Gtk_MenuItem *add_entry(char *path, char *accelerator,
			  const MenuFactoryConnectorBase &connector);

  Gtk_MenuItem* add_entry(char *path, char *accelerator,
			  void (*target_func)());

  void add_subfactory    (Gtk_MenuFactory *subfactory,
			  const string &path);

  void remove_paths      (gchar**paths,
			  int npaths);

  void remove_entries    (GtkMenuEntry *entries,
			  int nentries); //: DON'T USE

  void remove_subfactory (Gtk_MenuFactory *subfactory,
			  const string &path);

  //: THIS METHOD RETURNS AN ALLOCATED OBJECT
  Gtk_MenuPath *factory_find(const string &path);


  Gtk_MenuBar* get_menubar_widget();
#line 144 "menufactory.gen_h"

protected:
  GtkMenuFactory *gtkmenufactory;
};

#ifdef GTKMM_CXX_HAVE_MEMBER_TEMPLATES
template <class T>
Gtk_MenuItem* Gtk_MenuFactory::add_entry(char *path,
					 char *accelerator,
					 T *target_widget,
					 void (T::*target_method)(char*),
					 char *target_method_arg)
{
  static GtkMenuEntry entry = { 0, 0, 0, 0, 0 };
  Gtk_MenuItem *entry_widget;
  
  entry.path = path;
  entry.accelerator = accelerator;
  
  add_entries(&entry, 1);
  
  entry_widget = new Gtk_MenuItem((GtkMenuItem*)entry.widget);
  
  connect_to_method(entry_widget->activate,
		    target_widget, target_method, target_method_arg);
  
  return entry_widget;
  
}
#endif


#endif
