# Gtk::Application Class Reference

TODO. More...

Inheritance diagram for Gtk::Application:
[legend]
Collaboration diagram for Gtk::Application:
[legend]

List of all members.

## Public Member Functions

virtual | ~Application ()
GtkApplication* | gobj ()
| Provides access to the underlying C GObject.
const GtkApplication* | gobj () const
| Provides access to the underlying C GObject.
GtkApplication* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
std::vector< Window* > | get_windows ()
| Retrieves the list of windows previously registered with gtk_application_create_window() or add_window().
std::vector< const Window* > | get_windows () const
| Retrieves the list of windows previously registered with gtk_application_create_window() or add_window().
void | add_window (Window& window)
| Adds a window to the Gtk::Application.
void | remove_window (Window& window)
int | run (int argc, char** argv)
| Starts the application.
int | run (Window& window, int argc, char** argv)
| Starts the application.
int | run (Window& window)
| Starts the application.
int | run ()
| Starts the application.

## Static Public Member Functions

static Glib::RefPtr< Application > | create (const Glib::ustring& application_id, Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE)
static Glib::RefPtr< Application > | create (int argc, char** argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE)

## Protected Member Functions

| Application (const Glib::ustring& application_id, Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE)
| Creates a new Application instance.
| Application (int argc, char** argv, const Glib::ustring& application_id, Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE)
| Creates a new Application instance.

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gtk::Application > | wrap (GtkApplication* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

TODO.

## Constructor & Destructor Documentation

virtual Gtk::Application::~Application | ( | ) | `[virtual]`

Reimplemented from Gio::Application.

Gtk::Application::Application | ( | const Glib::ustring & | application_id,
|  | Gio::ApplicationFlags | flags = `Gio::APPLICATION_FLAGS_NONE`
| ) |  | `[explicit, protected]`

Creates a new Application instance.

This constructor calls g_type_init() for you. You should call run() with your main() function's argc and argv parameters to initialize gtkmm too.

Parameters:

  application_id | A valid application id
  flags | The application flags

Reimplemented from Gio::Application.

Gtk::Application::Application | ( | int | argc,
|  | char ** | argv,
|  | const Glib::ustring & | application_id,
|  | Gio::ApplicationFlags | flags = `Gio::APPLICATION_FLAGS_NONE`
| ) |  | `[explicit, protected]`

Creates a new Application instance.

This constructor initializes gtkmm for you, so you should call run() without specifying the the argc and argv parameters again.

Parameters:

  argc | The parameter received by your main() function.
  argv | The parameter received by your main() function.
  application_id | A valid application id
  flags | The application flags

## Member Function Documentation

void Gtk::Application::add_window | ( | Window& | window ) |

Adds a window to the Gtk::Application.

If all the windows managed by Gtk::Application are closed, the Gtk::Application will call quit(), and quit the application.

If your application uses only a single toplevel window, you can use get_window(). If you are using a sub-class of Gtk::Application you should call create_window() to let the Gtk::Application instance create a Gtk::Window and add it to the list of toplevels of the application. You should call this function only to add Gtk::Windows that you created directly using new Gtk::Window.

Since gtkmm 3.0:

Parameters:

  window | A toplevel window to add to the application.

static Glib::RefPtr<Application> Gtk::Application::create | ( | const Glib::ustring & | application_id,
|  | Gio::ApplicationFlags | flags = `Gio::APPLICATION_FLAGS_NONE`
| ) |  | `[static]`

Reimplemented from Gio::Application.

static Glib::RefPtr<Application> Gtk::Application::create | ( | int | argc,
|  | char ** | argv,
|  | const Glib::ustring & | application_id,
|  | Gio::ApplicationFlags | flags = `Gio::APPLICATION_FLAGS_NONE`
| ) |  | `[static]`

std::vector<Window*> Gtk::Application::get_windows | ( | ) |

Retrieves the list of windows previously registered with gtk_application_create_window() or add_window().

Since gtkmm 3.0:

Returns:
  A pointer to the list of Gtk::Windows registered by this application, or `0`. The returned SList is owned by the Gtk::Application and it should not be modified or freed directly.

std::vector<const Window*> Gtk::Application::get_windows | ( | ) | const

Retrieves the list of windows previously registered with gtk_application_create_window() or add_window().

Since gtkmm 3.0:

Returns:
  A pointer to the list of Gtk::Windows registered by this application, or `0`. The returned SList is owned by the Gtk::Application and it should not be modified or freed directly.

const GtkApplication* Gtk::Application::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::Application.

GtkApplication* Gtk::Application::gobj | ( | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::Application.

GtkApplication* Gtk::Application::gobj_copy | ( | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gio::Application.

void Gtk::Application::remove_window | ( | Window& | window ) |

int Gtk::Application::run | ( | Window& | window ) |

Starts the application.

The default implementation of this virtual function will simply run a main loop.

It is an error to call this function if application is a proxy for a remote application.

Parameters:

  window | The window to show. This method will return when the window is hidden.

Since gtkmm 3.0:

int Gtk::Application::run | ( | ) |

Starts the application.

The default implementation of this virtual function will simply run a main loop.

It is an error to call this function if application is a proxy for a remote application.

Since gtkmm 3.0:

int Gtk::Application::run | ( | Window& | window,
|  | int | argc,
|  | char ** | argv
| ) |  |

Starts the application.

The default implementation of this virtual function will simply run a main loop.

It is an error to call this function if application is a proxy for a remote application.

Parameters:

  window | The window to show. This method will return when the window is hidden.

Since gtkmm 3.0:

int Gtk::Application::run | ( | int | argc,
|  | char ** | argv
| ) |  |

Starts the application.

The default implementation of this virtual function will simply run a main loop.

It is an error to call this function if application is a proxy for a remote application.

Since gtkmm 3.0:

Reimplemented from Gio::Application.

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::Application > wrap | ( | GtkApplication * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/application.h