1 /*
2  * Copyright (C) 1997-1998 Janne L�f <jlof@mail.student.oulu.fi>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18 
19 
20 #ifndef __GTK_GL_AREA_H__
21 #define __GTK_GL_AREA_H__
22 
23 #include <gdk/gdk.h>
24 #include <gdkgl.h>
25 #include <gtk/gtkdrawingarea.h>
26 
27 
28 G_BEGIN_DECLS
29 
30 #define GTK_TYPE_GL_AREA            (gtk_gl_area_get_type())
31 #define GTK_GL_AREA(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_GL_AREA, GtkGLArea))
32 #define GTK_GL_AREA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, GTK_TYPE_GL_AREA, GtkGLAreaClass))
33 #define GTK_IS_GL_AREA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_GL_AREA))
34 #define GTK_IS_GL_AREA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GL_AREA))
35 #define GTK_GL_AREA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_GL_AREA, GtkGLArea))
36 
37 
38 typedef struct _GtkGLArea       GtkGLArea;
39 typedef struct _GtkGLAreaClass  GtkGLAreaClass;
40 
41 
42 struct _GtkGLArea
43 {
44   GtkDrawingArea  darea;
45   GdkGLContext *glcontext;
46 };
47 
48 struct _GtkGLAreaClass
49 {
50   GtkDrawingAreaClass parent_class;
51 };
52 
53 GType      gtk_gl_area_get_type   (void);
54 GtkWidget* gtk_gl_area_new        (int       *attrList);
55 GtkWidget* gtk_gl_area_share_new  (int       *attrList,
56                                    GtkGLArea *share);
57 GtkWidget* gtk_gl_area_new_vargs  (GtkGLArea *share,
58 				   ...);
59 
60 
61 gint       gtk_gl_area_make_current(GtkGLArea *glarea);
62 
63 void       gtk_gl_area_endgl      (GtkGLArea *glarea); /* deprecated */
64 
65 void       gtk_gl_area_swap_buffers(GtkGLArea *glarea);
66 
67 
68 #ifndef GTKGL_DISABLE_DEPRECATED
69 
70 #  define gtk_gl_area_begingl(glarea) \
71       gtk_gl_area_make_current(glarea)
72 #  define gtk_gl_area_endgl(glarea) \
73       glFlush()
74 #  define gtk_gl_area_swapbuffers(glarea) \
75       gtk_gl_area_swap_buffers(glarea)
76 #  define gtk_gl_area_size(glarea, width, height) \
77       gtk_widget_set_size_request(GTK_WIDGET(glarea), (width), (height))
78 
79 #endif
80 
81 G_END_DECLS
82 
83 #endif /* __GTK_GL_AREA_H__ */
84