gtkglarea.h 5.36 KB
Newer Older
Alexander Larsson's avatar
Alexander Larsson committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/* GTK - The GIMP Toolkit
 *
 * gtkglarea.h: A GL drawing area
 *
 * Copyright © 2014  Emmanuele Bassi
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GTK_GL_AREA_H__
#define __GTK_GL_AREA_H__

#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

#include <gtk/gtkwidget.h>

G_BEGIN_DECLS

#define GTK_TYPE_GL_AREA                (gtk_gl_area_get_type ())
#define GTK_GL_AREA(obj)                (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GL_AREA, GtkGLArea))
#define GTK_IS_GL_AREA(obj)             (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GL_AREA))
#define GTK_GL_AREA_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_GL_AREA, GtkGLAreaClass))
#define GTK_IS_GL_AREA_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GL_AREA))
#define GTK_GL_AREA_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GL_AREA, GtkGLAreaClass))

typedef struct _GtkGLArea               GtkGLArea;
typedef struct _GtkGLAreaClass          GtkGLAreaClass;

/**
 * GtkGLArea:
 *
 * A #GtkWidget used for drawing with OpenGL.
 *
 * Since: 3.16
 */
struct _GtkGLArea
{
  /*< private >*/
  GtkWidget parent_instance;
};

/**
 * GtkGLAreaClass:
 * @render: class closure for the #GtkGLArea::render signal
58 59
 * @resize: class closeure for the #GtkGLArea::resize signal
 * @create_context: class closure for the #GtkGLArea::create-context signal
Alexander Larsson's avatar
Alexander Larsson committed
60 61 62 63 64 65 66 67 68 69 70 71 72
 *
 * The `GtkGLAreaClass` structure contains only private data.
 *
 * Since: 3.16
 */
struct _GtkGLAreaClass
{
  /*< private >*/
  GtkWidgetClass parent_class;

  /*< public >*/
  gboolean       (* render)         (GtkGLArea        *area,
                                     GdkGLContext     *context);
73
  void           (* resize)         (GtkGLArea        *area,
74 75
                                     int               width,
                                     int               height);
76
  GdkGLContext * (* create_context) (GtkGLArea        *area);
Alexander Larsson's avatar
Alexander Larsson committed
77 78 79 80 81 82 83 84 85

  /*< private >*/
  gpointer _padding[6];
};

GDK_AVAILABLE_IN_3_16
GType gtk_gl_area_get_type (void) G_GNUC_CONST;

GDK_AVAILABLE_IN_3_16
86
GtkWidget *     gtk_gl_area_new                         (void);
Alexander Larsson's avatar
Alexander Larsson committed
87

88 89 90 91 92
GDK_AVAILABLE_IN_3_22
void            gtk_gl_area_set_use_es                  (GtkGLArea    *area,
                                                         gboolean      use_es);
GDK_AVAILABLE_IN_3_22
gboolean        gtk_gl_area_get_use_es                  (GtkGLArea    *area);
93 94
GDK_AVAILABLE_IN_3_16
void            gtk_gl_area_set_required_version        (GtkGLArea    *area,
95 96
                                                         gint          major,
                                                         gint          minor);
97 98
GDK_AVAILABLE_IN_3_16
void            gtk_gl_area_get_required_version        (GtkGLArea    *area,
99 100
                                                         gint         *major,
                                                         gint         *minor);
101
GDK_AVAILABLE_IN_3_16
102
gboolean        gtk_gl_area_get_has_alpha               (GtkGLArea    *area);
Alexander Larsson's avatar
Alexander Larsson committed
103
GDK_AVAILABLE_IN_3_16
104 105
void            gtk_gl_area_set_has_alpha               (GtkGLArea    *area,
                                                         gboolean      has_alpha);
Alexander Larsson's avatar
Alexander Larsson committed
106
GDK_AVAILABLE_IN_3_16
107
gboolean        gtk_gl_area_get_has_depth_buffer        (GtkGLArea    *area);
Alexander Larsson's avatar
Alexander Larsson committed
108
GDK_AVAILABLE_IN_3_16
109 110
void            gtk_gl_area_set_has_depth_buffer        (GtkGLArea    *area,
                                                         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 115
void            gtk_gl_area_set_has_stencil_buffer      (GtkGLArea    *area,
                                                         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 120
void            gtk_gl_area_set_auto_render             (GtkGLArea    *area,
                                                         gboolean      auto_render);
121
GDK_AVAILABLE_IN_3_16
122
void           gtk_gl_area_queue_render                 (GtkGLArea    *area);
123 124


Alexander Larsson's avatar
Alexander Larsson committed
125
GDK_AVAILABLE_IN_3_16
126
GdkGLContext *  gtk_gl_area_get_context                 (GtkGLArea    *area);
Alexander Larsson's avatar
Alexander Larsson committed
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 135
void            gtk_gl_area_set_error                   (GtkGLArea    *area,
                                                         const GError *error);
136
GDK_AVAILABLE_IN_3_16
137
GError *        gtk_gl_area_get_error                   (GtkGLArea    *area);
Alexander Larsson's avatar
Alexander Larsson committed
138 139 140 141

G_END_DECLS

#endif /* __GTK_GL_AREA_H__ */