Debian Codegraph @

gtk/src/glarea.hg

raw
1 /* Copyright (C) 2015 The gtkmm Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #include <gtkmm/widget.h>
18 _DEFS(gtkmm,gtk)
19 _PINCLUDE(gtkmm/private/widget_p.h)
20
21 #include <gdkmm/glcontext.h>
22
23 namespace Gtk
24 {
25
26 /** A widget used for drawing with OpenGL.
27 * @newin{3,18}
28 * @ingroup Widgets
29 */
30 class GTKMM_API GLArea : public Widget
31 {
32 _CLASS_GTKOBJECT(GLArea,GtkGLArea,GTK_GL_AREA,Gtk::Widget,GtkWidget,,,GTKMM_API)
33 public:
34
35 _CTOR_DEFAULT
36
37 _WRAP_METHOD(Glib::RefPtr<Gdk::GLContext> get_context(), gtk_gl_area_get_context, refreturn, newin "3,18")
38 _WRAP_METHOD(Glib::RefPtr<const Gdk::GLContext> get_context() const, gtk_gl_area_get_context, refreturn, constversion, newin "3,18")
39 _WRAP_METHOD(void make_current(), gtk_gl_area_make_current, newin "3,18")
40 _WRAP_METHOD(void queue_render(), gtk_gl_area_queue_render, newin "3,18")
41 _WRAP_METHOD(void attach_buffers(), gtk_gl_area_attach_buffers, newin "3,18")
42 /** Check if any error is currently set on this <i>area</i>.
43 *
44 * The error may be obtained by using throw_if_error() and
45 * set using set_error().
46 *
47 * @newin{3,18}
48 *
49 * @return true if an error is currently set.
50 */
51 bool has_error() const;
52
53 _IGNORE(gtk_gl_area_get_error)
54 /** Will throw the correct Glib::Error subclass if
55 * any is currently set on this <i>area</i>.
56 *
57 * @newin{3,18}
58 *
59 * @throw Throws any currently set error (e.g. Gdk::GLError).
60 */
61 void throw_if_error() const;
62
63 #m4 _CONVERSION(`const Glib::Error&', `const GError*', __FR2P)
64 /** Sets an error on the <i>area</i> which will be shown
65 * instead of GL rendering.
66 *
67 * This is useful in the signal_create_context() handler
68 * if GL context creation fails.
69 *
70 * @newin{3,18}
71 *
72 * @param error The error to set on the <i>area</i>.
73 */
74 _WRAP_METHOD(void set_error(const Glib::Error& error), gtk_gl_area_set_error)
75 /** Clears any previous set error on this <i>area</i> made with set_error().
76 *
77 * @newin{3,18}
78 */
79 void unset_error();
80 _WRAP_METHOD(bool get_has_alpha() const, gtk_gl_area_get_has_alpha, newin "3,18")
81 _WRAP_METHOD(void set_has_alpha(bool has_alpha = true), gtk_gl_area_set_has_alpha, newin "3,18")
82 _WRAP_METHOD(bool get_has_depth_buffer() const, gtk_gl_area_get_has_depth_buffer, newin "3,18")
83 _WRAP_METHOD(void set_has_depth_buffer(bool has_depth_buffer = true), gtk_gl_area_set_has_depth_buffer, newin "3,18")
84 _WRAP_METHOD(bool get_has_stencil_buffer() const, gtk_gl_area_get_has_stencil_buffer, newin "3,18")
85 _WRAP_METHOD(void set_has_stencil_buffer(bool has_stencil_buffer = true), gtk_gl_area_set_has_stencil_buffer, newin "3,18")
86 _WRAP_METHOD(bool get_auto_render() const, gtk_gl_area_get_auto_render, newin "3,18")
87 _WRAP_METHOD(void set_auto_render(bool auto_render = true), gtk_gl_area_set_auto_render, newin "3,18")
88 _WRAP_METHOD(void get_required_version(int& major, int& minor) const, gtk_gl_area_get_required_version, newin "3,18")
89 _WRAP_METHOD(void set_required_version(int major, int minor), gtk_gl_area_set_required_version, newin "3,18")
90 _WRAP_METHOD(bool get_use_es() const, gtk_gl_area_get_use_es)
91 _WRAP_METHOD(void set_use_es(bool use_es = true), gtk_gl_area_set_use_es)
92
93 _WRAP_PROPERTY("auto-render", bool, newin "3,18")
94 _WRAP_PROPERTY("context", Glib::RefPtr<Gdk::GLContext>, newin "3,18")
95 _WRAP_PROPERTY("has-alpha", bool, newin "3,18")
96 _WRAP_PROPERTY("has-depth-buffer", bool, newin "3,18")
97 _WRAP_PROPERTY("has-stencil-buffer", bool, newin "3,18")
98 _WRAP_PROPERTY("use-es", bool)
99
100 #m4 _CONVERSION(`Glib::RefPtr<Gdk::GLContext>', `GdkGLContext*', Glib::unwrap_copy($3))
101 _WRAP_SIGNAL(Glib::RefPtr<Gdk::GLContext> create_context(), "create_context", newin "3,18")
102 #m4 _CONVERSION(`GdkGLContext*', `const Glib::RefPtr<Gdk::GLContext>&', Glib::wrap($3, true))
103 _WRAP_SIGNAL(bool render(const Glib::RefPtr<Gdk::GLContext>& context), "render", newin "3,18")
104 _WRAP_SIGNAL(void resize(int width, int height), "resize", newin "3,18")
105
106 };
107
108 } //namespace Gtk