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 | |
30 | G_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 | |
39 | typedef struct _GtkApplication GtkApplication; |
40 | typedef struct _GtkApplicationClass GtkApplicationClass; |
41 | |
42 | struct _GtkApplication |
43 | { |
44 | GApplication parent_instance; |
45 | }; |
46 | |
47 | /** |
48 | * GtkApplicationClass: |
49 | * @parent_class: The parent class. |
50 | * @window_added: Signal emitted when a `GtkWindow` is added to |
51 | * application through gtk_application_add_window(). |
52 | * @window_removed: Signal emitted when a `GtkWindow` is removed from |
53 | * application, either as a side-effect of being destroyed or |
54 | * explicitly through gtk_application_remove_window(). |
55 | */ |
56 | struct _GtkApplicationClass |
57 | { |
58 | GApplicationClass parent_class; |
59 | |
60 | /*< public >*/ |
61 | |
62 | void (*window_added) (GtkApplication *application, |
63 | GtkWindow *window); |
64 | void (*window_removed) (GtkApplication *application, |
65 | GtkWindow *window); |
66 | |
67 | /*< private >*/ |
68 | gpointer padding[8]; |
69 | }; |
70 | |
71 | GDK_AVAILABLE_IN_ALL |
72 | GType gtk_application_get_type (void) G_GNUC_CONST; |
73 | |
74 | GDK_AVAILABLE_IN_ALL |
75 | GtkApplication * gtk_application_new (const char *application_id, |
76 | GApplicationFlags flags); |
77 | |
78 | GDK_AVAILABLE_IN_ALL |
79 | void gtk_application_add_window (GtkApplication *application, |
80 | GtkWindow *window); |
81 | |
82 | GDK_AVAILABLE_IN_ALL |
83 | void gtk_application_remove_window (GtkApplication *application, |
84 | GtkWindow *window); |
85 | GDK_AVAILABLE_IN_ALL |
86 | GList * gtk_application_get_windows (GtkApplication *application); |
87 | |
88 | GDK_AVAILABLE_IN_ALL |
89 | GMenuModel * (GtkApplication *application); |
90 | GDK_AVAILABLE_IN_ALL |
91 | void (GtkApplication *application, |
92 | GMenuModel *); |
93 | |
94 | typedef enum |
95 | { |
96 | GTK_APPLICATION_INHIBIT_LOGOUT = (1 << 0), |
97 | GTK_APPLICATION_INHIBIT_SWITCH = (1 << 1), |
98 | GTK_APPLICATION_INHIBIT_SUSPEND = (1 << 2), |
99 | GTK_APPLICATION_INHIBIT_IDLE = (1 << 3) |
100 | } GtkApplicationInhibitFlags; |
101 | |
102 | GDK_AVAILABLE_IN_ALL |
103 | guint gtk_application_inhibit (GtkApplication *application, |
104 | GtkWindow *window, |
105 | GtkApplicationInhibitFlags flags, |
106 | const char *reason); |
107 | GDK_AVAILABLE_IN_ALL |
108 | void gtk_application_uninhibit (GtkApplication *application, |
109 | guint cookie); |
110 | |
111 | GDK_AVAILABLE_IN_ALL |
112 | GtkWindow * gtk_application_get_window_by_id (GtkApplication *application, |
113 | guint id); |
114 | |
115 | GDK_AVAILABLE_IN_ALL |
116 | GtkWindow * gtk_application_get_active_window (GtkApplication *application); |
117 | |
118 | GDK_AVAILABLE_IN_ALL |
119 | char ** gtk_application_list_action_descriptions (GtkApplication *application); |
120 | |
121 | GDK_AVAILABLE_IN_ALL |
122 | char ** gtk_application_get_accels_for_action (GtkApplication *application, |
123 | const char *detailed_action_name); |
124 | GDK_AVAILABLE_IN_ALL |
125 | char ** gtk_application_get_actions_for_accel (GtkApplication *application, |
126 | const char *accel); |
127 | |
128 | |
129 | GDK_AVAILABLE_IN_ALL |
130 | void gtk_application_set_accels_for_action (GtkApplication *application, |
131 | const char *detailed_action_name, |
132 | const char * const *accels); |
133 | |
134 | GDK_AVAILABLE_IN_ALL |
135 | GMenu * (GtkApplication *application, |
136 | const char *id); |
137 | |
138 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref) |
139 | |
140 | G_END_DECLS |
141 | |
142 | #endif /* __GTK_APPLICATION_H__ */ |
143 | |