gtkmm: Gtk::Main Class Reference

gtkmm 3.97.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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>`

Inheritance diagram for Gtk::Main:
[legend]

## Public Member Functions
| Main (bool set_locale=true)
| Initialization without command-line arguments. More...
virtual | ~Main ()
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static Gtk::Main* | instance ()
| 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)

## Additional Inherited Members
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## 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

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

Initialization without command-line arguments.

Parameters

  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.

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

Deprecated:
  Use Gtk::Application instead.

## Member Function Documentation

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

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.

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

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

Deprecated:
  Use Gtk::Application instead.