gtkmm  3.97.1
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Gtk::Main Class Reference

Main application class. More...

#include <gtkmm/main.h>

Inherits trackable.

Public Member Functions

 Main (bool set_locale=true)
 Initialization without command-line arguments. More...
 
virtual ~Main ()
 

Static Public Member Functions

static Gtk::Maininstance ()
 Access to the one global instance of Gtk::Main. More...
 
static void init_gtkmm_internals ()
 Initialize the table of wrap_new functions. More...
 

Protected Member Functions

void init (bool set_locale)
 

Detailed Description

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:

int main(int argc, char *argv[])
{
Gtk::Main kit();
... create some widgets and windows...
kit.run(window);
}
Deprecated:
Use Gtk::Application instead.

Constructor & Destructor Documentation

◆ Main()

Gtk::Main::Main ( bool  set_locale = true)
explicit

Initialization without command-line arguments.

Parameters
set_localePassing 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.

◆ ~Main()

virtual Gtk::Main::~Main ( )
virtual

Member Function Documentation

◆ init()

void Gtk::Main::init ( bool  set_locale)
protected

◆ init_gtkmm_internals()

static void Gtk::Main::init_gtkmm_internals ( )
static

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.

◆ instance()

static Gtk::Main* Gtk::Main::instance ( )
static

Access to the one global instance of Gtk::Main.

Deprecated:
Use Gtk::Application instead.
Gtk::Main
Main application class.
Definition: main.h:60