// -*- c++ -*-
/*  Generated by gensig from main.gen_h. DO NOT MODIFY!!! */
#ifndef GTKMM_MAIN_HEADER
#define GTKMM_MAIN_HEADER
/* $Id: main.gen_h,v 1.29.2.1 1999/07/08 19:43:54 kenelson Exp $ */

/* main.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--sig.h>
#include <gtk--/widget.h>
#include <gtk/gtkmain.h>
#line 25 "main.gen_h"

// every application must have one of these objects.
// (actually can have more than one, but all Gtk_Main
// objects handle the same instance - at least for now)
//<br>
// Normal use of this class is in main() function to give argc and argv
// to the gtk initialization. Widgets can use Gtk_Main::instance()->quit()
// for example to exit from the application.
//<br>
// Minimal gtk-- application is something like this:<br>
// <pre>
// void main(int argc, char *argv[]) {
//   Gtk_Main m(&argc, &argv);
//   ... create some widgets ...
//   m.run();
// }
// </pre>
class Gtk_Main : public Gtk_Signal_Base {
protected:
  static Gtk_Main *ins;
public:
  // access to one global instance of Gtk_Main.
  static Gtk_Main *instance() { return ins; }
	
  Gtk_Main(int *argc, char ***argv, bool have_locale=false);
  Gtk_Main(int &argc, char **&argv, bool have_locale=false);
  ~Gtk_Main();
  virtual void run() { gtk_main(); }
  virtual void quit() { gtk_main_quit(); }
  virtual void iteration() { gtk_main_iteration(); }
  virtual gint events_pending() {return gtk_events_pending();}

  // Prevents events to everything else than given widget and its
  // childs. This way you can create modal dialogs(not recommended).
  static void grab_add(const Gtk_Widget &widget);
  // removes grab.
  static void grab_remove(const Gtk_Widget &widget);

  static Gtk_ObjectHandle<Gtk_Widget> grab_get_current();
  
  static guint key_snooper_install(GtkKeySnoopFunc snooper,
				   gpointer	    func_data);
  static void key_snooper_remove  (guint	    snooper_handler_id);

  static void gtk_true();
  static void gtk_false();

  // idle() method provides way to setup a callback that will be
  // called when gtk has nothing else to do, when the execution has
  // returned from all callbacks etc..<br>
  // Return value of the callback will determine if the callback is
  // removed. 0 means callback is removed, 1 means it'll be called again after
  // gtk next time has nothing to do.
  // Example:<br>
  // gint thisclass::mymethod() { return 1; }
  // <pre>connect_to_method(Gtk_Main::idle(), this, &thisclass::mymethod);</pre>
  // You can supply an integer priority to the idle() call; by default, it's 
  //  GTK_PRIORITY_DEFAULT, lower numbers are higher priority.
  static Signal0_r<gint> &idle(gint priority = GTK_PRIORITY_DEFAULT);
  // timeout() provides way to setup a callback that will be called when
  // certain time has elapsed. <br>
  // Return value of the callback will determine if the callback is
  // removed. 0 means callback is removed, 1 means it'll call it again after
  // the time has again elapsed.
  // Example:<br>
  // <pre>
  // gint thisclass::mymethod() { return 1; }
  // connect_to_method(Gtk_Main::timeout(100), this, &thisclass::mymethod);</pre> 
  static Signal0_r<gint> &timeout(guint32 interval);

  static Signal0 &input(gint source, GdkInputCondition condition);
private:
  
  static gint idle_callback(gpointer data);
  static gint timeout_callback(gpointer data);
  static void input_callback(gpointer data, gint source, GdkInputCondition condition);
  static void input_destroy(gpointer data);
  void init_gtk(int *argc, char ***argv, bool have_locale);
public:

/*
  virtual gint timeout_add(guint32 interval, GtkFunction function,
			   gpointer data);
  // obsolete, DO NOT USE!
  virtual void timeout_remove(gint tag);

  // obsolete, DO NOT USE! (use idle() instead)
  virtual gint idle_add(GtkFunction function, gpointer data);
  // obsolete, DO NOT USE!
  virtual void idle_remove(gint tag);
*/
protected:
  Gtk_Main();
};

#endif
