1 | /* GDK - The GIMP Drawing Kit |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
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 License, 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 | |
18 | /* |
19 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
20 | * file for a list of people on the GTK+ Team. See the ChangeLog |
21 | * files for a list of changes. These files are distributed with |
22 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
23 | */ |
24 | |
25 | #ifndef __GDK_TYPES_H__ |
26 | #define __GDK_TYPES_H__ |
27 | |
28 | #if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION) |
29 | #error "Only <gdk/gdk.h> can be included directly." |
30 | #endif |
31 | |
32 | /* GDK uses "glib". (And so does GTK). |
33 | */ |
34 | #include <glib.h> |
35 | #include <glib-object.h> |
36 | #include <gio/gio.h> |
37 | #include <cairo.h> |
38 | #include <pango/pango.h> |
39 | |
40 | /* The system specific file gdkconfig.h contains such configuration |
41 | * settings that are needed not only when compiling GDK (or GTK) |
42 | * itself, but also occasionally when compiling programs that use GDK |
43 | * (or GTK). One such setting is what windowing API backend is in use. |
44 | */ |
45 | #include <gdk/gdkconfig.h> |
46 | |
47 | G_BEGIN_DECLS |
48 | |
49 | /** |
50 | * GDK_CURRENT_TIME: |
51 | * |
52 | * Represents the current time, and can be used anywhere a time is expected. |
53 | */ |
54 | #define GDK_CURRENT_TIME 0L |
55 | |
56 | #ifdef __GI_SCANNER__ |
57 | /* The introspection scanner is currently unable to lookup how |
58 | * cairo_rectangle_int_t is actually defined. This prevents |
59 | * introspection data for the GdkRectangle type to include fields |
60 | * descriptions. To workaround this issue, we define it with the same |
61 | * content as cairo_rectangle_int_t, but only under the introspection |
62 | * define. |
63 | */ |
64 | struct _GdkRectangle |
65 | { |
66 | int x, y; |
67 | int width, height; |
68 | }; |
69 | typedef struct _GdkRectangle GdkRectangle; |
70 | #else |
71 | typedef cairo_rectangle_int_t GdkRectangle; |
72 | #endif |
73 | |
74 | /* Forward declarations of commonly used types */ |
75 | typedef struct _GdkRGBA GdkRGBA; |
76 | typedef struct _GdkContentFormats GdkContentFormats; |
77 | typedef struct _GdkContentProvider GdkContentProvider; |
78 | typedef struct _GdkCursor GdkCursor; |
79 | typedef struct _GdkTexture GdkTexture; |
80 | typedef struct _GdkDevice GdkDevice; |
81 | typedef struct _GdkDrag GdkDrag; |
82 | typedef struct _GdkDrop GdkDrop; |
83 | |
84 | typedef struct _GdkClipboard GdkClipboard; |
85 | typedef struct _GdkDisplayManager GdkDisplayManager; |
86 | typedef struct _GdkDisplay GdkDisplay; |
87 | typedef struct _GdkSurface GdkSurface; |
88 | typedef struct _GdkAppLaunchContext GdkAppLaunchContext; |
89 | typedef struct _GdkSeat GdkSeat; |
90 | typedef struct _GdkSnapshot GdkSnapshot; |
91 | |
92 | typedef struct _GdkDrawContext GdkDrawContext; |
93 | typedef struct _GdkCairoContext GdkCairoContext; |
94 | typedef struct _GdkGLContext GdkGLContext; |
95 | typedef struct _GdkVulkanContext GdkVulkanContext; |
96 | |
97 | /* |
98 | * GDK_DECLARE_INTERNAL_TYPE: |
99 | * @ModuleObjName: The name of the new type, in camel case (like GtkWidget) |
100 | * @module_obj_name: The name of the new type in lowercase, with words |
101 | * separated by '_' (like 'gtk_widget') |
102 | * @MODULE: The name of the module, in all caps (like 'GTK') |
103 | * @OBJ_NAME: The bare name of the type, in all caps (like 'WIDGET') |
104 | * @ParentName: the name of the parent type, in camel case (like GtkWidget) |
105 | * |
106 | * A convenience macro for emitting the usual declarations in the |
107 | * header file for a type which is intended to be subclassed only |
108 | * by internal consumers. |
109 | * |
110 | * This macro differs from %G_DECLARE_DERIVABLE_TYPE and %G_DECLARE_FINAL_TYPE |
111 | * by declaring a type that is only derivable internally. Internal users can |
112 | * derive this type, assuming they have access to the instance and class |
113 | * structures; external users will not be able to subclass this type. |
114 | */ |
115 | #define GDK_DECLARE_INTERNAL_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \ |
116 | GType module_obj_name##_get_type (void); \ |
117 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ |
118 | typedef struct _##ModuleObjName ModuleObjName; \ |
119 | typedef struct _##ModuleObjName##Class ModuleObjName##Class; \ |
120 | \ |
121 | _GLIB_DEFINE_AUTOPTR_CHAINUP (ModuleObjName, ParentName) \ |
122 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (ModuleObjName##Class, g_type_class_unref) \ |
123 | \ |
124 | G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \ |
125 | return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \ |
126 | G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_CLASS (gpointer ptr) { \ |
127 | return G_TYPE_CHECK_CLASS_CAST (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ |
128 | G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) { \ |
129 | return G_TYPE_CHECK_INSTANCE_TYPE (ptr, module_obj_name##_get_type ()); } \ |
130 | G_GNUC_UNUSED static inline gboolean MODULE##_IS_##OBJ_NAME##_CLASS (gpointer ptr) { \ |
131 | return G_TYPE_CHECK_CLASS_TYPE (ptr, module_obj_name##_get_type ()); } \ |
132 | G_GNUC_UNUSED static inline ModuleObjName##Class * MODULE##_##OBJ_NAME##_GET_CLASS (gpointer ptr) { \ |
133 | return G_TYPE_INSTANCE_GET_CLASS (ptr, module_obj_name##_get_type (), ModuleObjName##Class); } \ |
134 | G_GNUC_END_IGNORE_DEPRECATIONS |
135 | |
136 | typedef struct _GdkKeymapKey GdkKeymapKey; |
137 | |
138 | /** |
139 | * GdkKeymapKey: |
140 | * @keycode: the hardware keycode. This is an identifying number for a |
141 | * physical key. |
142 | * @group: indicates movement in a horizontal direction. Usually groups are used |
143 | * for two different languages. In group 0, a key might have two English |
144 | * characters, and in group 1 it might have two Hebrew characters. The Hebrew |
145 | * characters will be printed on the key next to the English characters. |
146 | * @level: indicates which symbol on the key will be used, in a vertical direction. |
147 | * So on a standard US keyboard, the key with the number “1” on it also has the |
148 | * exclamation point ("!") character on it. The level indicates whether to use |
149 | * the “1” or the “!” symbol. The letter keys are considered to have a lowercase |
150 | * letter at level 0, and an uppercase letter at level 1, though only the |
151 | * uppercase letter is printed. |
152 | * |
153 | * A `GdkKeymapKey` is a hardware key that can be mapped to a keyval. |
154 | */ |
155 | struct _GdkKeymapKey |
156 | { |
157 | guint keycode; |
158 | int group; |
159 | int level; |
160 | }; |
161 | |
162 | G_END_DECLS |
163 | |
164 | #endif /* __GDK_TYPES_H__ */ |
165 | |