1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the licence, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author: Ryan Lortie <desrt@desrt.ca>
18 */
19
20#ifndef __GTK_APPLICATION_H__
21#define __GTK_APPLICATION_H__
22
23#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
24#error "Only <gtk/gtk.h> can be included directly."
25#endif
26
27#include <gtk/gtkwidget.h>
28#include <gio/gio.h>
29
30G_BEGIN_DECLS
31
32#define GTK_TYPE_APPLICATION (gtk_application_get_type ())
33#define GTK_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APPLICATION, GtkApplication))
34#define GTK_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APPLICATION, GtkApplicationClass))
35#define GTK_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APPLICATION))
36#define GTK_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APPLICATION))
37#define GTK_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APPLICATION, GtkApplicationClass))
38
39typedef struct _GtkApplication GtkApplication;
40typedef struct _GtkApplicationClass GtkApplicationClass;
41typedef struct _GtkApplicationPrivate GtkApplicationPrivate;
42
43struct _GtkApplication
44{
45 GApplication parent;
46
47 /*< private >*/
48 GtkApplicationPrivate *priv;
49};
50
51/**
52 * GtkApplicationClass:
53 * @parent_class: The parent class.
54 * @window_added: Signal emitted when a #GtkWindow is added to
55 * application through gtk_application_add_window().
56 * @window_removed: Signal emitted when a #GtkWindow is removed from
57 * application, either as a side-effect of being destroyed or
58 * explicitly through gtk_application_remove_window().
59 */
60struct _GtkApplicationClass
61{
62 GApplicationClass parent_class;
63
64 /*< public >*/
65
66 void (*window_added) (GtkApplication *application,
67 GtkWindow *window);
68 void (*window_removed) (GtkApplication *application,
69 GtkWindow *window);
70
71 /*< private >*/
72 gpointer padding[12];
73};
74
75GDK_AVAILABLE_IN_ALL
76GType gtk_application_get_type (void) G_GNUC_CONST;
77
78GDK_AVAILABLE_IN_ALL
79GtkApplication * gtk_application_new (const gchar *application_id,
80 GApplicationFlags flags);
81
82GDK_AVAILABLE_IN_ALL
83void gtk_application_add_window (GtkApplication *application,
84 GtkWindow *window);
85
86GDK_AVAILABLE_IN_ALL
87void gtk_application_remove_window (GtkApplication *application,
88 GtkWindow *window);
89GDK_AVAILABLE_IN_ALL
90GList * gtk_application_get_windows (GtkApplication *application);
91
92GDK_AVAILABLE_IN_3_4
93GMenuModel * gtk_application_get_app_menu (GtkApplication *application);
94GDK_AVAILABLE_IN_3_4
95void gtk_application_set_app_menu (GtkApplication *application,
96 GMenuModel *app_menu);
97
98GDK_AVAILABLE_IN_3_4
99GMenuModel * gtk_application_get_menubar (GtkApplication *application);
100GDK_AVAILABLE_IN_3_4
101void gtk_application_set_menubar (GtkApplication *application,
102 GMenuModel *menubar);
103
104GDK_DEPRECATED_IN_3_14_FOR(gtk_application_set_accels_for_action)
105void gtk_application_add_accelerator (GtkApplication *application,
106 const gchar *accelerator,
107 const gchar *action_name,
108 GVariant *parameter);
109
110GDK_DEPRECATED_IN_3_14_FOR(gtk_application_set_accels_for_action)
111void gtk_application_remove_accelerator (GtkApplication *application,
112 const gchar *action_name,
113 GVariant *parameter);
114
115typedef enum
116{
117 GTK_APPLICATION_INHIBIT_LOGOUT = (1 << 0),
118 GTK_APPLICATION_INHIBIT_SWITCH = (1 << 1),
119 GTK_APPLICATION_INHIBIT_SUSPEND = (1 << 2),
120 GTK_APPLICATION_INHIBIT_IDLE = (1 << 3)
121} GtkApplicationInhibitFlags;
122
123GDK_AVAILABLE_IN_3_4
124guint gtk_application_inhibit (GtkApplication *application,
125 GtkWindow *window,
126 GtkApplicationInhibitFlags flags,
127 const gchar *reason);
128GDK_AVAILABLE_IN_3_4
129void gtk_application_uninhibit (GtkApplication *application,
130 guint cookie);
131GDK_AVAILABLE_IN_3_4
132gboolean gtk_application_is_inhibited (GtkApplication *application,
133 GtkApplicationInhibitFlags flags);
134
135GDK_AVAILABLE_IN_3_6
136GtkWindow * gtk_application_get_window_by_id (GtkApplication *application,
137 guint id);
138
139GDK_AVAILABLE_IN_3_6
140GtkWindow * gtk_application_get_active_window (GtkApplication *application);
141
142GDK_AVAILABLE_IN_3_12
143gchar ** gtk_application_list_action_descriptions (GtkApplication *application);
144
145GDK_AVAILABLE_IN_3_12
146gchar ** gtk_application_get_accels_for_action (GtkApplication *application,
147 const gchar *detailed_action_name);
148GDK_AVAILABLE_IN_3_14
149gchar ** gtk_application_get_actions_for_accel (GtkApplication *application,
150 const gchar *accel);
151
152
153GDK_AVAILABLE_IN_3_12
154void gtk_application_set_accels_for_action (GtkApplication *application,
155 const gchar *detailed_action_name,
156 const gchar * const *accels);
157
158GDK_AVAILABLE_IN_3_14
159gboolean gtk_application_prefers_app_menu (GtkApplication *application);
160
161GDK_AVAILABLE_IN_3_14
162GMenu * gtk_application_get_menu_by_id (GtkApplication *application,
163 const gchar *id);
164
165G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
166
167G_END_DECLS
168
169#endif /* __GTK_APPLICATION_H__ */
170

source code of include/gtk-3.0/gtk/gtkapplication.h