// Generated by gmmproc 2.51.2 -- DO NOT MODIFY!
#ifndef _GTKMM_MAIN_H
#define _GTKMM_MAIN_H


#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>

/*
 * Copyright (C) 1998-2003 The gtkmm 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */


#include <gtk/gtk.h>

#include <sigc++/sigc++.h>
#include <gdkmm/types.h>
#include <glibmm/optioncontext.h>


namespace Gtk
{

class Window;

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

/** Main application class.
 * Every application must have one of these objects.
 * It may not be global and must be the first gtkmm object created.
 * It is a singleton so declaring more than one will simply access the first
 * created.
 *
 * You would normally use this class in your main() function to initialize gtkmm
 * and optionally to give argc and argv to the GTK+ initialization.
 * After calling Gtk::Main::run(), you may use Gtk::Main::quit() to exit from
 * the application, or just pass your main window to run(), to make run()
 * return when that window closes.
 *
 * A minimal gtkmm application would be something like this:
 * @code
 * int main(int argc, char *argv[])
 * {
 *   Gtk::Main kit();
 *   ... create some widgets and windows...
 *   kit.run(window);
 * }
 * @endcode
 *
 * @deprecated Use Gtk::Application instead.
 */
class Main : public sigc::trackable
{
public:

#ifndef GTKMM_DISABLE_DEPRECATED

  /** Initialization without command-line arguments.
   *
   * @param set_locale Passing false prevents GTK+ from automatically calling
   * setlocale(LC_ALL, ""). You would want to pass false if you wanted to set
   * the locale for your program to something other than the user's locale, or
   * if you wanted to set different values for different locale categories.
   *
   * @deprecated Use Gtk::Application instead.
   */
  explicit Main(bool set_locale = true);

  /**
   * @deprecated Use Gtk::Application instead.
   */
  virtual ~Main();

  /** Access to the one global instance of Gtk::Main.
   *
   * @deprecated Use Gtk::Application instead.
   */
  static Gtk::Main* instance();

  /** Start the event loop.
   * This begins the event loop which handles events.  No
   * events propagate until this has been called.  It may be
   * called recursively to popup dialogs
   *
   * @deprecated Use Gtk::Application instead.
   */
  static void run();

  /** Returns from the main loop when the window is closed.
   * When using this override, you should not use Gtk::Main::quit() to close
   * the application, but just call hide() on your Window class.
   *
   * @param window The window to show. This method will return when the window is hidden.
   *
   * @deprecated Use Gtk::Application instead.
   */
  static void run(Window& window);

  /** Makes the innermost invocation of the main loop return when it regains control.
   *
   * @deprecated Use Gtk::Application instead.
   */
  static void quit();

  /**
   * @deprecated Use Gtk::Application instead.
   */
  static guint level();

#endif // GTKMM_DISABLE_DEPRECATED


  //TODO: Move these general methods out of Main when we really remove Main,
  //one day when Gtk::Application can really do everything, which should probably
  //include handling OptionContext properly. murrayc.

  /** Runs a single iteration of the main loop.
   * If no events are waiting to be processed GTK+ will block until the next event is noticed.
   * If you don't want to block then pass false for @a blocking or check if any events are pending with
   * pending() first.
   *
   * @param blocking Whether the caller must wait until the next event is noticed, or return immediately if there are no events.
   * @result true if quit() has been called for the innermost main loop.
   */
  static bool iteration(bool blocking = true);

  /** Checks if any events are pending. This can be used to update the GUI and invoke timeouts etc. while doing some time intensive computation.
   *
   * Example: Updating the GUI during a long computation.
   * @code
   * // computation going on
   * while( Gtk::Main::events_pending() )
   *   Gtk::Main::iteration();
   *
   * // computation continued
   * @endcode
   *
   * @result true if any events are pending, false otherwise.
   */
  static bool events_pending();

  /** Initialize the table of wrap_new functions.
   * This doesn't need an instance of Gtk::Main.
   * This would usually only be used by the init() methods of libraries that depend on gtkmm.
   */
  static void init_gtkmm_internals();

protected:

#ifndef GTKMM_DISABLE_DEPRECATED

  void init(bool set_locale);

  virtual void run_impl();
  virtual void quit_impl();
  virtual guint level_impl();
  virtual bool iteration_impl(bool blocking);
  virtual bool events_pending_impl();

  // Signal handlers:
  virtual void on_window_hide();

private:
  static Main* instance_;
#endif // GTKMM_DISABLE_DEPRECATED

};

} // namespace Gtk


#endif /* _GTKMM_MAIN_H */

