# Gtk::Application Class Reference

TODO. More...

Inheritance 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 ()
| Gets a list of the Gtk::Windows associated with application.
std::vector< const Window* > | get_windows () const
| Gets a list of the Gtk::Windows associated with application.
void | add_window (Window& window)
| Adds a window to the Gtk::Application.
void | remove_window (Window& window)
| Remove a window from application.
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 | ( |  | ) |

Gets a list of the Gtk::Windows associated with application.

The list is sorted by most recently focused window, such that the first element is the currently focused window. (Useful for choosing a parent for a transient window.)

The list that is returned should not be modified in any way. It will only remain valid until the next focus change or window creation or deletion.

Since gtkmm 3.0:

Returns:
  A List of Gtk::Window.

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

Gets a list of the Gtk::Windows associated with application.

The list is sorted by most recently focused window, such that the first element is the currently focused window. (Useful for choosing a parent for a transient window.)

The list that is returned should not be modified in any way. It will only remain valid until the next focus change or window creation or deletion.

Since gtkmm 3.0:

Returns:
  A List of Gtk::Window.

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

Remove a window from application.

If window belongs to application then this call is equivalent to setting the Gtk::Window:application property of window to `0`.

The application may stop running as a result of a call to this function.

Since gtkmm 3.0:

Parameters:

  window | A Gtk::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