1 | /* GTK - The GIMP Toolkit |
2 | * |
3 | * gtkglarea.h: A GL drawing area |
4 | * |
5 | * Copyright © 2014 Emmanuele Bassi |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Lesser General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Lesser General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Lesser General Public |
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
19 | */ |
20 | |
21 | #ifndef __GTK_GL_AREA_H__ |
22 | #define __GTK_GL_AREA_H__ |
23 | |
24 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
25 | #error "Only <gtk/gtk.h> can be included directly." |
26 | #endif |
27 | |
28 | #include <gtk/gtkwidget.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | #define GTK_TYPE_GL_AREA (gtk_gl_area_get_type ()) |
33 | #define GTK_GL_AREA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GL_AREA, GtkGLArea)) |
34 | #define GTK_IS_GL_AREA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GL_AREA)) |
35 | #define GTK_GL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GL_AREA, GtkGLAreaClass)) |
36 | #define GTK_IS_GL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GL_AREA)) |
37 | #define GTK_GL_AREA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GL_AREA, GtkGLAreaClass)) |
38 | |
39 | typedef struct _GtkGLArea GtkGLArea; |
40 | typedef struct _GtkGLAreaClass GtkGLAreaClass; |
41 | |
42 | /** |
43 | * GtkGLArea: |
44 | * |
45 | * A #GtkWidget used for drawing with OpenGL. |
46 | * |
47 | * Since: 3.16 |
48 | */ |
49 | struct _GtkGLArea |
50 | { |
51 | /*< private >*/ |
52 | GtkWidget parent_instance; |
53 | }; |
54 | |
55 | /** |
56 | * GtkGLAreaClass: |
57 | * @render: class closure for the #GtkGLArea::render signal |
58 | * @resize: class closeure for the #GtkGLArea::resize signal |
59 | * @create_context: class closure for the #GtkGLArea::create-context signal |
60 | * |
61 | * The `GtkGLAreaClass` structure contains only private data. |
62 | * |
63 | * Since: 3.16 |
64 | */ |
65 | struct _GtkGLAreaClass |
66 | { |
67 | /*< private >*/ |
68 | GtkWidgetClass parent_class; |
69 | |
70 | /*< public >*/ |
71 | gboolean (* render) (GtkGLArea *area, |
72 | GdkGLContext *context); |
73 | void (* resize) (GtkGLArea *area, |
74 | int width, |
75 | int height); |
76 | GdkGLContext * (* create_context) (GtkGLArea *area); |
77 | |
78 | /*< private >*/ |
79 | gpointer _padding[6]; |
80 | }; |
81 | |
82 | GDK_AVAILABLE_IN_3_16 |
83 | GType gtk_gl_area_get_type (void) G_GNUC_CONST; |
84 | |
85 | GDK_AVAILABLE_IN_3_16 |
86 | GtkWidget * gtk_gl_area_new (void); |
87 | |
88 | GDK_AVAILABLE_IN_3_22 |
89 | void gtk_gl_area_set_use_es (GtkGLArea *area, |
90 | gboolean use_es); |
91 | GDK_AVAILABLE_IN_3_22 |
92 | gboolean gtk_gl_area_get_use_es (GtkGLArea *area); |
93 | GDK_AVAILABLE_IN_3_16 |
94 | void gtk_gl_area_set_required_version (GtkGLArea *area, |
95 | gint major, |
96 | gint minor); |
97 | GDK_AVAILABLE_IN_3_16 |
98 | void gtk_gl_area_get_required_version (GtkGLArea *area, |
99 | gint *major, |
100 | gint *minor); |
101 | GDK_AVAILABLE_IN_3_16 |
102 | gboolean gtk_gl_area_get_has_alpha (GtkGLArea *area); |
103 | GDK_AVAILABLE_IN_3_16 |
104 | void gtk_gl_area_set_has_alpha (GtkGLArea *area, |
105 | gboolean has_alpha); |
106 | GDK_AVAILABLE_IN_3_16 |
107 | gboolean gtk_gl_area_get_has_depth_buffer (GtkGLArea *area); |
108 | GDK_AVAILABLE_IN_3_16 |
109 | void gtk_gl_area_set_has_depth_buffer (GtkGLArea *area, |
110 | gboolean has_depth_buffer); |
111 | GDK_AVAILABLE_IN_3_16 |
112 | gboolean gtk_gl_area_get_has_stencil_buffer (GtkGLArea *area); |
113 | GDK_AVAILABLE_IN_3_16 |
114 | void gtk_gl_area_set_has_stencil_buffer (GtkGLArea *area, |
115 | gboolean has_stencil_buffer); |
116 | GDK_AVAILABLE_IN_3_16 |
117 | gboolean gtk_gl_area_get_auto_render (GtkGLArea *area); |
118 | GDK_AVAILABLE_IN_3_16 |
119 | void gtk_gl_area_set_auto_render (GtkGLArea *area, |
120 | gboolean auto_render); |
121 | GDK_AVAILABLE_IN_3_16 |
122 | void gtk_gl_area_queue_render (GtkGLArea *area); |
123 | |
124 | |
125 | GDK_AVAILABLE_IN_3_16 |
126 | GdkGLContext * gtk_gl_area_get_context (GtkGLArea *area); |
127 | |
128 | GDK_AVAILABLE_IN_3_16 |
129 | void gtk_gl_area_make_current (GtkGLArea *area); |
130 | GDK_AVAILABLE_IN_3_16 |
131 | void gtk_gl_area_attach_buffers (GtkGLArea *area); |
132 | |
133 | GDK_AVAILABLE_IN_3_16 |
134 | void gtk_gl_area_set_error (GtkGLArea *area, |
135 | const GError *error); |
136 | GDK_AVAILABLE_IN_3_16 |
137 | GError * gtk_gl_area_get_error (GtkGLArea *area); |
138 | |
139 | G_END_DECLS |
140 | |
141 | #endif /* __GTK_GL_AREA_H__ */ |
142 | |