]> Pileus Git - ~andy/gtk/blob - gtk/gtkapplication.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkapplication.h
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 typedef struct _GtkApplicationPrivate GtkApplicationPrivate;
42
43 struct _GtkApplication
44 {
45   GApplication parent;
46
47   /*< private >*/
48   GtkApplicationPrivate *priv;
49 };
50
51 struct _GtkApplicationClass
52 {
53   GApplicationClass parent_class;
54
55   void (*window_added)   (GtkApplication *application,
56                           GtkWindow      *window);
57   void (*window_removed) (GtkApplication *application,
58                           GtkWindow      *window);
59
60   /*< private >*/
61   gpointer padding[12];
62 };
63
64 GType            gtk_application_get_type      (void) G_GNUC_CONST;
65
66 GtkApplication * gtk_application_new           (const gchar       *application_id,
67                                                 GApplicationFlags  flags);
68
69 void             gtk_application_add_window    (GtkApplication    *application,
70                                                 GtkWindow         *window);
71
72 void             gtk_application_remove_window (GtkApplication    *application,
73                                                 GtkWindow         *window);
74 GList *          gtk_application_get_windows   (GtkApplication    *application);
75
76 GDK_AVAILABLE_IN_3_4
77 GMenuModel *     gtk_application_get_app_menu  (GtkApplication    *application);
78 GDK_AVAILABLE_IN_3_4
79 void             gtk_application_set_app_menu  (GtkApplication    *application,
80                                                 GMenuModel        *app_menu);
81
82 GDK_AVAILABLE_IN_3_4
83 GMenuModel *     gtk_application_get_menubar   (GtkApplication    *application);
84 GDK_AVAILABLE_IN_3_4
85 void             gtk_application_set_menubar   (GtkApplication    *application,
86                                                 GMenuModel        *menubar);
87
88 GDK_AVAILABLE_IN_3_4
89 void             gtk_application_add_accelerator    (GtkApplication  *application,
90                                                      const gchar     *accelerator,
91                                                      const gchar     *action_name,
92                                                      GVariant        *parameter);
93 GDK_AVAILABLE_IN_3_4
94 void             gtk_application_remove_accelerator (GtkApplication *application,
95                                                      const gchar    *action_name,
96                                                      GVariant       *parameter);
97
98 typedef enum
99 {
100   GTK_APPLICATION_INHIBIT_LOGOUT  = (1 << 0),
101   GTK_APPLICATION_INHIBIT_SWITCH  = (1 << 1),
102   GTK_APPLICATION_INHIBIT_SUSPEND = (1 << 2),
103   GTK_APPLICATION_INHIBIT_IDLE    = (1 << 3)
104 } GtkApplicationInhibitFlags;
105
106 GDK_AVAILABLE_IN_3_4
107 guint            gtk_application_inhibit            (GtkApplication             *application,
108                                                      GtkWindow                  *window,
109                                                      GtkApplicationInhibitFlags  flags,
110                                                      const gchar                *reason);
111 GDK_AVAILABLE_IN_3_4
112 void             gtk_application_uninhibit          (GtkApplication             *application,
113                                                      guint                       cookie);
114 GDK_AVAILABLE_IN_3_4
115 gboolean         gtk_application_is_inhibited       (GtkApplication             *application,
116                                                      GtkApplicationInhibitFlags  flags);
117
118 GDK_AVAILABLE_IN_3_6
119 GtkWindow *      gtk_application_get_window_by_id   (GtkApplication             *application,
120                                                      guint                       id);
121
122 GDK_AVAILABLE_IN_3_6
123 GtkWindow *      gtk_application_get_active_window  (GtkApplication             *application);
124
125 G_END_DECLS
126
127 #endif /* __GTK_APPLICATION_H__ */
128