gtkmm
3.13.7
|
The Gtk::Application class handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model. More...
#include <gtkmm/application.h>
Public Member Functions | |
virtual | ~Application () |
GtkApplication* | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkApplication* | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkApplication* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
std::vector< Window* > | get_windows () |
Gets a list of the Gtk::Windows associated with application. More... | |
std::vector< const Window* > | get_windows () const |
Gets a list of the Gtk::Windows associated with application. More... | |
void | add_window (Window& window) |
Adds a window to the Gtk::Application. More... | |
void | remove_window (Window& window) |
Remove a window from application. More... | |
int | run (int argc, char** argv) |
Starts the application. More... | |
int | run (Window& window, int argc, char** argv) |
Starts the application. More... | |
int | run (Window& window) |
Starts the application. More... | |
int | run () |
Starts the application. More... | |
Glib::RefPtr< Gio::MenuModel > | get_app_menu () |
Returns the menu model that has been set with set_app_menu(). More... | |
Glib::RefPtr< const Gio::MenuModel > | get_app_menu () const |
Returns the menu model that has been set with set_app_menu(). More... | |
void | set_app_menu (const Glib::RefPtr< Gio::MenuModel >& app_menu) |
Sets or unsets the application menu for application. More... | |
Glib::RefPtr< Gio::MenuModel > | get_menubar () |
Returns the menu model that has been set with set_menubar(). More... | |
Glib::RefPtr< const Gio::MenuModel > | get_menubar () const |
Returns the menu model that has been set with set_menubar(). More... | |
void | set_menubar (const Glib::RefPtr< Gio::MenuModel >& menubar) |
Sets or unsets the menubar for windows of application. More... | |
void | add_accelerator (const Glib::ustring& accelerator, const Glib::ustring& action_name, GVariant* parameter) |
Installs an accelerator that will cause the named action to be activated when the key combination specificed by accelerator is pressed. More... | |
void | add_accelerator (const Glib::ustring& accelerator, const Glib::ustring& action_name) |
A add_accelerator() convenience overload. More... | |
void | remove_accelerator (const Glib::ustring& action_name, GVariant* parameter) |
Removes an accelerator that has been previously added with add_accelerator(). More... | |
void | remove_accelerator (const Glib::ustring& action_name) |
A remove_accelerator() convenience overload. More... | |
guint | inhibit (Window& window, ApplicationInhibitFlags flags, const Glib::ustring& reason) |
Inform the session manager that certain types of actions should be inhibited. More... | |
void | uninhibit (guint cookie) |
Removes an inhibitor that has been established with inhibit(). More... | |
bool | is_inhibited (ApplicationInhibitFlags flags) const |
Determines if any of the actions specified in flags are currently inhibited (possibly by another application). More... | |
Window* | get_window_by_id (guint id) |
Returns the Gtk::ApplicationWindow with the given ID. More... | |
const Window* | get_window_by_id (guint id) const |
Returns the Gtk::ApplicationWindow with the given ID. More... | |
Window* | get_active_window () |
Gets the “active” window for the application. More... | |
const Window* | get_active_window () const |
Gets the “active” window for the application. More... | |
std::vector< Glib::ustring > | list_action_descriptions () const |
Lists the detailed action names which have associated accelerators. More... | |
std::vector< Glib::ustring > | get_accels_for_action (const Glib::ustring& detailed_action_name) const |
Gets the accelerators that are currently associated with the given action. More... | |
void | set_accels_for_action (const Glib::ustring& detailed_action_name, const std::vector< Glib::ustring >& accels) |
Sets zero or more keyboard accelerators that will trigger the given action. More... | |
void | set_accel_for_action (const Glib::ustring& detailed_action_name, const Glib::ustring& accel) |
Sets a keyboard accelerator that will trigger the given action. More... | |
void | unset_accels_for_action (const Glib::ustring& detailed_action_name) |
Unsets a keyboard accelerator that will trigger the given action. More... | |
Glib::PropertyProxy < Glib::RefPtr< Gio::MenuModel > > | property_app_menu () |
The GMenuModel for the application menu. More... | |
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Gio::MenuModel > > | property_app_menu () const |
The GMenuModel for the application menu. More... | |
Glib::PropertyProxy < Glib::RefPtr< Gio::MenuModel > > | property_menubar () |
The GMenuModel for the menubar. More... | |
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Gio::MenuModel > > | property_menubar () const |
The GMenuModel for the menubar. More... | |
Glib::PropertyProxy< bool > | property_register_session () |
Register with the session manager. More... | |
Glib::PropertyProxy_ReadOnly < bool > | property_register_session () const |
Register with the session manager. More... | |
Glib::PropertyProxy_ReadOnly < Window* > | property_active_window () const |
The window which most recently had focus. More... | |
Glib::SignalProxy1< void, Window* > | signal_window_added () |
Glib::SignalProxy1< void, Window* > | signal_window_removed () |
![]() | |
GApplication * | gobj () |
const GApplication * | gobj () const |
GApplication * | gobj_copy () |
Glib::ustring | get_id () const |
void | set_id (const Glib::ustring &application_id) |
Glib::RefPtr< DBus::Connection > | get_dbus_connection () |
Glib::RefPtr< const DBus::Connection > | get_dbus_connection () const |
Glib::ustring | get_dbus_object_path () const |
guint | get_inactivity_timeout () const |
void | set_inactivity_timeout (guint inactivity_timeout) |
ApplicationFlags | get_flags () const |
void | set_flags (ApplicationFlags flags) |
void | set_action_group (const Glib::RefPtr< ActionGroup > &action_group) |
void | add_main_option_entry (OptionType arg_type, const Glib::ustring &long_name, gchar short_name= '\0', const Glib::ustring &description=Glib::ustring(), const Glib::ustring &arg_description=Glib::ustring(), int flags=0) |
void | add_main_option_entry (const Glib::OptionGroup::SlotOptionArgString &slot, const Glib::ustring &long_name, gchar short_name= '\0', const Glib::ustring &description=Glib::ustring(), const Glib::ustring &arg_description=Glib::ustring(), int flags=0) |
void | add_main_option_entry_filename (const Glib::OptionGroup::SlotOptionArgFilename &slot, const Glib::ustring &long_name, gchar short_name= '\0', const Glib::ustring &description=Glib::ustring(), const Glib::ustring &arg_description=Glib::ustring(), int flags=0) |
bool | is_registered () const |
bool | is_remote () const |
bool | register_application (const Glib::RefPtr< Gio::Cancellable > &cancellable) |
bool | register_application () |
void | hold () |
void | release () |
void | activate () |
void | open (const type_vec_files &files, const Glib::ustring &hint=Glib::ustring()) |
void | open (const Glib::RefPtr< Gio::File > &file, const Glib::ustring &hint=Glib::ustring()) |
int | run (int argc, char **argv) |
void | quit () |
void | mark_busy () |
void | unmark_busy () |
void | send_notification (const Glib::ustring &id, const Glib::RefPtr< Notification > ¬ification) |
void | send_notification (const Glib::RefPtr< Notification > ¬ification) |
void | withdraw_notification (const Glib::ustring &id) |
Glib::PropertyProxy_WriteOnly < Glib::RefPtr< ActionGroup > > | property_action_group () |
Glib::PropertyProxy < Glib::ustring > | property_application_id () |
Glib::PropertyProxy_ReadOnly < Glib::ustring > | property_application_id () const |
Glib::PropertyProxy < ApplicationFlags > | property_flags () |
Glib::PropertyProxy_ReadOnly < ApplicationFlags > | property_flags () const |
Glib::PropertyProxy< guint > | property_inactivity_timeout () |
Glib::PropertyProxy_ReadOnly < guint > | property_inactivity_timeout () const |
Glib::PropertyProxy_ReadOnly < bool > | property_is_registered () const |
Glib::PropertyProxy_ReadOnly < bool > | property_is_remote () const |
Glib::SignalProxy0< void > | signal_startup () |
Glib::SignalProxy0< void > | signal_activate () |
Glib::SignalProxy2< void, const type_vec_files &, const Glib::ustring & > | signal_open () |
Glib::SignalProxy1< int, const Glib::RefPtr < ApplicationCommandLine > & > | signal_command_line () |
Glib::SignalProxy1< int, const Glib::RefPtr < Glib::VariantDict > & > | signal_handle_local_options () |
Glib::RefPtr< Gio::Application > | wrap (GApplication *object, bool take_copy=false) |
![]() | |
virtual | ~ActionGroup () |
GActionGroup * | gobj () |
const GActionGroup * | gobj () const |
bool | has_action (const Glib::ustring &action_name) const |
std::vector< Glib::ustring > | list_actions () const |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantType ¶meter_type, Glib::VariantBase &state_hint, Glib::VariantType &state_type, Glib::VariantBase &state) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantType ¶meter_type, Glib::VariantBase &state_hint, Glib::VariantType &state_type) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantType ¶meter_type, Glib::VariantBase &state_hint, Glib::VariantBase &state) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantType ¶meter_type, Glib::VariantBase &state_hint) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantBase &state_hint, Glib::VariantType &state_type, Glib::VariantBase &state) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantBase &state_hint, Glib::VariantType &state_type) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantBase &state_hint, Glib::VariantBase &state) |
bool | query_action (const Glib::ustring &action_name, bool &enabled, Glib::VariantBase &state_hint) |
bool | get_action_enabled (const Glib::ustring &action_name) const |
Glib::VariantType | get_action_parameter_type (const Glib::ustring &action_name) const |
Glib::VariantType | get_action_state_type (const Glib::ustring &action_name) const |
Glib::VariantContainerBase | get_action_state_hint (const Glib::ustring &action_name) const |
void | get_action_state_hint (const Glib::ustring &action_name, T_Value &value) const |
Glib::VariantContainerBase | get_action_state_hint_variant (const Glib::ustring &action_name) const |
Glib::VariantBase | get_action_state (const Glib::ustring &action_name) const |
void | get_action_state (const Glib::ustring &action_name, T_Value &value) const |
Glib::VariantBase | get_action_state_variant (const Glib::ustring &action_name) const |
void | change_action_state (const Glib::ustring &action_name, const Glib::VariantBase &value) |
void | activate_action (const Glib::ustring &action_name, const Glib::VariantBase ¶meter) |
void | activate_action (const Glib::ustring &action_name) |
void | action_added (const Glib::ustring &action_name) |
void | action_removed (const Glib::ustring &action_name) |
void | action_enabled_changed (const Glib::ustring &action_name, bool enabled) |
void | action_state_changed (const Glib::ustring &action_name, const Glib::VariantBase &state) |
Glib::SignalProxy1< void, const Glib::ustring & > | signal_action_added () |
Glib::SignalProxy2< void, const Glib::ustring &, bool > | signal_action_enabled_changed () |
Glib::SignalProxy1< void, const Glib::ustring & > | signal_action_removed () |
Glib::SignalProxy2< void, const Glib::ustring &, const Glib::VariantBase & > | signal_action_state_changed () |
virtual bool | has_action_vfunc (const Glib::ustring &name) const |
virtual std::vector < Glib::ustring > | list_actions_vfunc () const |
virtual bool | get_action_enabled_vfunc (const Glib::ustring &name) const |
virtual Glib::VariantType | get_action_parameter_type_vfunc (const Glib::ustring &name) const |
virtual Glib::VariantType | get_action_state_type_vfunc (const Glib::ustring &name) const |
virtual Glib::VariantBase | get_action_state_hint_vfunc (const Glib::ustring &name) const |
virtual Glib::VariantBase | get_action_state_vfunc (const Glib::ustring &name) const |
virtual void | change_action_state_vfunc (const Glib::ustring &name, const Glib::VariantBase &value) |
virtual void | activate_action_vfunc (const Glib::ustring &name, const Glib::VariantBase ¶meter) |
Glib::RefPtr< Gio::ActionGroup > | wrap (GActionGroup *object, bool take_copy=false) |
![]() | |
virtual | ~ActionMap () |
GActionMap * | gobj () |
const GActionMap * | gobj () const |
Glib::RefPtr< Action > | lookup_action (const Glib::ustring &action_name) |
Glib::RefPtr< const Action > | lookup_action (const Glib::ustring &action_name) const |
Glib::RefPtr< SimpleAction > | add_action (const Glib::ustring &name) |
Glib::RefPtr< SimpleAction > | add_action_with_parameter (const Glib::ustring &name, const ActivateWithParameterSlot &slot) |
Glib::RefPtr< SimpleAction > | add_action (const Glib::ustring &name, const ActivateSlot &slot) |
Glib::RefPtr< SimpleAction > | add_action_bool (const Glib::ustring &name, bool state=false) |
Glib::RefPtr< SimpleAction > | add_action_bool (const Glib::ustring &name, const ActivateSlot &slot, bool state=false) |
Glib::RefPtr< SimpleAction > | add_action_radio_string (const Glib::ustring &name, const Glib::ustring &state) |
Glib::RefPtr< SimpleAction > | add_action_radio_string (const Glib::ustring &name, const ActivateWithStringParameterSlot &slot, const Glib::ustring &state) |
Glib::RefPtr< SimpleAction > | add_action_radio_integer (const Glib::ustring &name, gint32 state) |
Glib::RefPtr< SimpleAction > | add_action_radio_integer (const Glib::ustring &name, const ActivateWithIntParameterSlot &slot, gint32 state) |
void | add_action (const Glib::RefPtr< Action > &action) |
void | remove_action (const Glib::ustring &action_name) |
virtual Glib::RefPtr< Action > | lookup_action_vfunc (const Glib::ustring &name) const |
virtual void | add_action_vfunc (Glib::RefPtr< Action > action) const |
virtual void | remove_action_vfunc (const Glib::ustring &name) |
Glib::RefPtr< Gio::ActionMap > | wrap (GActionMap *object, bool take_copy=false) |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< Application > | create (const Glib::ustring& application_id=Glib::ustring(), Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE) |
Creates a new Application instance. More... | |
static Glib::RefPtr< Application > | create (int& argc, char**& argv, const Glib::ustring& application_id=Glib::ustring(), Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE) |
Creates a new Application instance. More... | |
![]() | |
static GType | get_type () |
static Glib::RefPtr< Application > | create (const Glib::ustring &application_id=Glib::ustring(), ApplicationFlags flags=APPLICATION_FLAGS_NONE) |
static bool | id_is_valid (const Glib::ustring &application_id) |
static void | set_default (const Glib::RefPtr< Application > &application) |
static void | unset_default () |
static Glib::RefPtr< Application > | get_default () |
![]() | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
![]() | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Protected Member Functions | |
Application (const Glib::ustring& application_id=Glib::ustring(), Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE) | |
Creates a new Application instance. More... | |
Application (int& argc, char**& argv, const Glib::ustring& application_id=Glib::ustring(), Gio::ApplicationFlags flags=Gio::APPLICATION_FLAGS_NONE) | |
Creates a new Application instance. More... | |
virtual void | on_window_added (Window* window) |
This is a default handler for the signal signal_window_added(). More... | |
virtual void | on_window_removed (Window* window) |
This is a default handler for the signal signal_window_removed(). More... | |
![]() | |
Application (const Glib::ustring &application_id=Glib::ustring(), ApplicationFlags flags=APPLICATION_FLAGS_NONE) | |
virtual void | on_open (const type_vec_files &files, const Glib::ustring &hint) |
virtual bool | local_command_line_vfunc (char **&arguments, int &exit_status) |
virtual void | before_emit_vfunc (const Glib::VariantBase &platform_data) |
virtual void | after_emit_vfunc (const Glib::VariantBase &platform_data) |
virtual void | quit_mainloop_vfunc () |
virtual void | run_mainloop_vfunc () |
virtual void | on_startup () |
virtual void | on_activate () |
virtual int | on_command_line (const Glib::RefPtr< ApplicationCommandLine > &command_line) |
![]() | |
ActionGroup () | |
virtual void | on_action_added (const Glib::ustring &action_name) |
virtual void | on_action_enabled_changed (const Glib::ustring &action_name, bool enabled) |
virtual void | on_action_removed (const Glib::ustring &action_name) |
virtual void | on_action_state_changed (const Glib::ustring &action_name, const Glib::VariantBase &value) |
![]() | |
ActionMap () | |
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. More... | |
Additional Inherited Members | |
![]() | |
enum | OptionType |
typedef std::vector < Glib::RefPtr< File > > | type_vec_files |
![]() | |
typedef sigc::slot< void, const Glib::VariantBase & > | ActivateWithParameterSlot |
typedef sigc::slot< void > | ActivateSlot |
typedef sigc::slot< void, const Glib::ustring & > | ActivateWithStringParameterSlot |
typedef sigc::slot< void, int > | ActivateWithIntParameterSlot |
The Gtk::Application class handles many important aspects of a GTK+ application in a convenient fashion, without enforcing a one-size-fits-all application model.
Currently, Gtk::Application handles GTK+ and gtkmm initialization, application uniqueness, session management, provides some basic scriptability and desktop shell integration by exporting actions and menus, and manages a list of toplevel windows whose life-cycle is automatically tied to the life-cycle of your application.
While Gtk::Application works fine with plain Gtk::Windows, it is recommended to use it together with Gtk::ApplicationWindow.
When GDK threads are enabled, Gtk::Application will acquire the GDK lock when invoking actions that arrive from other processes. The GDK lock is not touched for local action invocations. In order to have actions invoked in a predictable context it is therefore recommended that the GDK lock be held while invoking actions locally with Gio::ActionGroup::activate_action(). The same applies to actions associated with Gtk::ApplicationWindow and to the Gio::Application::activate() and Gio::Application::open() methods.
To set an application menu for a Gtk::Application, use set_app_menu(). The Gio::MenuModel that this method expects is usually constructed using Gtk::Builder. To specify a menubar that will be shown by Gtk::ApplicationWindows, use set_menubar(). Use the base Gio::ActionMap interface to add actions, to respond to the user selecting these menu items.
GTK+ displays these menus as expected, depending on the platform the application is running on.
Gtk::Application optionally registers with a session manager of the users session (if you set the register-session property) and offers various functionality related to the session life-cycle.
An application can block various ways to end the session with the inhibit() method. Typical use cases for this kind of inhibiting are long-running, uninterruptible operations, such as burning a CD or performing a disk backup. The session manager may not honor the inhibitor, but it can be expected to inform the user about the negative consequences of ending the session while inhibitors are present.
|
virtual |
Reimplemented from Gio::Application.
|
explicitprotected |
Creates a new Application instance.
This initializes gtkmm (and the GObject type system) for you.
If non-empty, the application ID must be valid. See g_application_id_is_valid().
If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with gtkmm 3.6 or later.
application_id | A valid application ID. |
flags | The application flags. |
|
explicitprotected |
Creates a new Application instance.
This initializes gtkmm (and the GObject type system) for you, parsing the standard GTK+ command line arguments.
You could instead use the constuctor that takes no command line arguements and later supply the command line arguments to run().
Note that all GTK+ functionality that is available via command line arguments can instead be achieved by setting suitable environment variables such as G_DEBUG.
If non-empty, the application ID must be valid. See g_application_id_is_valid().
If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with gtkmm 3.6 or later.
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. |
void Gtk::Application::add_accelerator | ( | const Glib::ustring & | accelerator, |
const Glib::ustring & | action_name, | ||
GVariant * | parameter | ||
) |
Installs an accelerator that will cause the named action to be activated when the key combination specificed by accelerator is pressed.
accelerator must be a string that can be parsed by gtk_accelerator_parse(), e.g. "<Primary>q" or “<Control><Alt>p”.
action_name must be the name of an action as it would be used in the app menu, i.e. actions that have been added to the application are referred to with an “app.” prefix, and window-specific actions with a “win.” prefix.
GtkApplication also extracts accelerators out of “accel” attributes in the MenuModels passed to set_app_menu() and set_menubar(), which is usually more convenient than calling this function for each accelerator.
Deprecated: 3.14: Use set_accels_for_action() instead
accelerator | Accelerator string. |
action_name | The name of the action to activate. |
parameter | Parameter to pass when activating the action, or 0 if the action does not accept an activation parameter. |
void Gtk::Application::add_accelerator | ( | const Glib::ustring & | accelerator, |
const Glib::ustring & | action_name | ||
) |
A add_accelerator() convenience overload.
void Gtk::Application::add_window | ( | Window& | window | ) |
Adds a window to the Gtk::Application.
If all the windows managed by Gtk::Application are closed (hidden) or removed from the application then the call to run() will return.
This call is equivalent to calling Gtk::Window::set_application().
Normally, the connection between the application and the window will remain until the window is closed (hidden) or destroyed, but you can explicitly remove it with remove_window().
window | A toplevel window to add to the application. |
|
static |
Creates a new Application instance.
This initializes gtkmm (and the GObject type system) for you.
If non-empty, the application ID must be valid. See g_application_id_is_valid().
If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with gtkmm 3.6 or later.
application_id | A valid application ID. |
flags | The application flags. |
|
static |
Creates a new Application instance.
This initializes gtkmm (and the GObject type system) for you, parsing the standard GTK+ command line arguments.
You could instead use the constuctor that takes no command line arguements and later supply the command line arguments to run().
Note that all GTK+ functionality that is available via command line arguments can instead be achieved by setting suitable environment variables such as G_DEBUG.
If non-empty, the application ID must be valid. See g_application_id_is_valid().
If no application ID is given then some features (most notably application uniqueness) will be disabled. A null application ID is only allowed with gtkmm 3.6 or later.
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. |
std::vector<Glib::ustring> Gtk::Application::get_accels_for_action | ( | const Glib::ustring & | detailed_action_name | ) | const |
Gets the accelerators that are currently associated with the given action.
detailed_action_name | A detailed action name, specifying an action and target to obtain accelerators for. |
0
-terminated array. Free with Glib::strfreev() when no longer needed. Window* Gtk::Application::get_active_window | ( | ) |
Gets the “active” window for the application.
The active window is the one that was most recently focused (within the application). This window may not have the focus at the moment if another application has it – this is just the most recently-focused window within this application.
const Window* Gtk::Application::get_active_window | ( | ) | const |
Gets the “active” window for the application.
The active window is the one that was most recently focused (within the application). This window may not have the focus at the moment if another application has it – this is just the most recently-focused window within this application.
Glib::RefPtr<Gio::MenuModel> Gtk::Application::get_app_menu | ( | ) |
Returns the menu model that has been set with set_app_menu().
Glib::RefPtr<const Gio::MenuModel> Gtk::Application::get_app_menu | ( | ) | const |
Returns the menu model that has been set with set_app_menu().
Glib::RefPtr<Gio::MenuModel> Gtk::Application::get_menubar | ( | ) |
Returns the menu model that has been set with set_menubar().
Glib::RefPtr<const Gio::MenuModel> Gtk::Application::get_menubar | ( | ) | const |
Returns the menu model that has been set with set_menubar().
|
static |
Get the GType for this class, for use with the underlying GObject type system.
Window* Gtk::Application::get_window_by_id | ( | guint | id | ) |
Returns the Gtk::ApplicationWindow with the given ID.
id | An identifier number. |
0
if there is no window with this ID. const Window* Gtk::Application::get_window_by_id | ( | guint | id | ) | const |
Returns the Gtk::ApplicationWindow with the given ID.
id | An identifier number. |
0
if there is no window with this ID. 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.
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.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
guint Gtk::Application::inhibit | ( | Window& | window, |
ApplicationInhibitFlags | flags, | ||
const Glib::ustring & | reason | ||
) |
Inform the session manager that certain types of actions should be inhibited.
This is not guaranteed to work on all platforms and for all types of actions.
Applications should invoke this method when they begin an operation that should not be interrupted, such as creating a CD or DVD. The types of actions that may be blocked are specified by the flags parameter. When the application completes the operation it should call uninhibit() to remove the inhibitor. Note that an application can have multiple inhibitors, and all of the must be individually removed. Inhibitors are also cleared when the application exits.
Applications should not expect that they will always be able to block the action. In most cases, users will be given the option to force the action to take place.
Reasons should be short and to the point.
If window is given, the session manager may point the user to this window to find out more about why the action is inhibited.
window | A Gtk::Window, or 0 . |
flags | What types of actions should be inhibited. |
reason | A short, human-readable string that explains why these operations are inhibited. |
bool Gtk::Application::is_inhibited | ( | ApplicationInhibitFlags | flags | ) | const |
Determines if any of the actions specified in flags are currently inhibited (possibly by another application).
flags | What types of actions should be queried. |
true
if any of the actions specified in flags are inhibited. std::vector<Glib::ustring> Gtk::Application::list_action_descriptions | ( | ) | const |
Lists the detailed action names which have associated accelerators.
0
-terminated array of strings, free with Glib::strfreev() when done.
|
protectedvirtual |
This is a default handler for the signal signal_window_added().
|
protectedvirtual |
This is a default handler for the signal signal_window_removed().
Glib::PropertyProxy_ReadOnly< Window* > Gtk::Application::property_active_window | ( | ) | const |
The window which most recently had focus.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< Glib::RefPtr<Gio::MenuModel> > Gtk::Application::property_app_menu | ( | ) |
The GMenuModel for the application menu.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::MenuModel> > Gtk::Application::property_app_menu | ( | ) | const |
The GMenuModel for the application menu.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< Glib::RefPtr<Gio::MenuModel> > Gtk::Application::property_menubar | ( | ) |
The GMenuModel for the menubar.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::MenuModel> > Gtk::Application::property_menubar | ( | ) | const |
The GMenuModel for the menubar.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy< bool > Gtk::Application::property_register_session | ( | ) |
Register with the session manager.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< bool > Gtk::Application::property_register_session | ( | ) | const |
Register with the session manager.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
void Gtk::Application::remove_accelerator | ( | const Glib::ustring & | action_name, |
GVariant * | parameter | ||
) |
Removes an accelerator that has been previously added with add_accelerator().
Deprecated: 3.14: Use set_accels_for_action() instead
action_name | The name of the action to activate. |
parameter | Parameter to pass when activating the action, or 0 if the action does not accept an activation parameter. |
void Gtk::Application::remove_accelerator | ( | const Glib::ustring & | action_name | ) |
A remove_accelerator() convenience overload.
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::property_application() property of window to 0
.
The application may stop running as a result of a call to this function.
window | A Gtk::Window. |
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.
argc | The argc from main() (or 0 if argv is 0 ). |
argv | The argv from main(), or 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.
window | The window to show. This method will return when the window is hidden. |
argc | The argc from main() (or 0 if argv is 0 ). |
argv | The argv from main(), or 0 . |
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.
window | The window to show. This method will return when the window is hidden. |
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.
void Gtk::Application::set_accel_for_action | ( | const Glib::ustring & | detailed_action_name, |
const Glib::ustring & | accel | ||
) |
Sets a keyboard accelerator that will trigger the given action.
It will be the primary accelerator, which may be displayed in the UI.
See unset_accels_for_action().
detailed_action_name | A detailed action name, specifying an action and target to associate accelerators with. |
accels | An accelerator in the format understood by gtk_accelerator_parse(). |
void Gtk::Application::set_accels_for_action | ( | const Glib::ustring & | detailed_action_name, |
const std::vector< Glib::ustring > & | accels | ||
) |
Sets zero or more keyboard accelerators that will trigger the given action.
The first item in accels will be the primary accelerator, which may be displayed in the UI.
To remove all accelerators for an action, use an empty, zero-terminated array for accels.
detailed_action_name | A detailed action name, specifying an action and target to associate accelerators with. |
accels | A list of accelerators in the format understood by gtk_accelerator_parse(). |
void Gtk::Application::set_app_menu | ( | const Glib::RefPtr< Gio::MenuModel > & | app_menu | ) |
Sets or unsets the application menu for application.
This can only be done in the primary instance of the application, after it has been registered. Application::signal_startup() is a good place to call this.
The application menu is a single menu containing items that typically impact the application as a whole, rather than acting on a specific window or document. For example, you would expect to see “Preferences” or “Quit” in an application menu, but not “Save” or “Print”.
If supported, the application menu will be rendered by the desktop environment.
Use the base ActionMap interface to add actions, to respond to the user selecting these menu items.
app_menu | A MenuModel, or 0 . |
void Gtk::Application::set_menubar | ( | const Glib::RefPtr< Gio::MenuModel > & | menubar | ) |
Sets or unsets the menubar for windows of application.
This is a menubar in the traditional sense.
This can only be done in the primary instance of the application, after it has been registered. Application::signal_startup() is a good place to call this.
Depending on the desktop environment, this may appear at the top of each window, or at the top of the screen. In some environments, if both the application menu and the menubar are set, the application menu will be presented as if it were the first item of the menubar. Other environments treat the two as completely separate – for example, the application menu may be rendered by the desktop shell while the menubar (if set) remains in each individual window.
Use the base ActionMap interface to add actions, to respond to the user selecting these menu items.
menubar | A MenuModel, or 0 . |
Glib::SignalProxy1< void,Window* > Gtk::Application::signal_window_added | ( | ) |
void on_my_window_added(Window* window)
Emitted when a Gtk::Window is added to application through Gtk::Application::add_window().
window | The newly-added Gtk::Window. |
Glib::SignalProxy1< void,Window* > Gtk::Application::signal_window_removed | ( | ) |
void on_my_window_removed(Window* window)
Emitted when a Gtk::Window is removed from application, either as a side-effect of being destroyed or explicitly through Gtk::Application::remove_window().
window | The Gtk::Window that is being removed. |
void Gtk::Application::uninhibit | ( | guint | cookie | ) |
void Gtk::Application::unset_accels_for_action | ( | const Glib::ustring & | detailed_action_name | ) |
Unsets a keyboard accelerator that will trigger the given action.
See set_accels_for_action() and set_accel_for_action().
detailed_action_name | A detailed action name, specifying an action and target to associate accelerators with. |
|
related |
A Glib::wrap() method for this object.
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. |