Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Examples

# drawable.h

Go to the documentation of this file.

    00001 // -*- c++ -*-
    00002 // Generated by gtkmmproc -- DO NOT MODIFY!
    00003 #ifndef _GDKMM_GL_DRAWABLE_H
    00004 #define _GDKMM_GL_DRAWABLE_H
    00005
    00006 #include <glibmm.h>
    00007
    00008 // -*- C++ -*-
    00009 /* gdkglextmm - C++ Wrapper for GdkGLExt
    00010  * Copyright (C) 2002-2003  Naofumi Yasufuku
    00011  *
    00012  * This library is free software; you can redistribute it and/or
    00013  * modify it under the terms of the GNU Lesser General Public
    00014  * License as published by the Free Software Foundation; either
    00015  * version 2.1 of the License, or (at your option) any later version.
    00016  *
    00017  * This library is distributed in the hope that it will be useful,
    00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00020  * Lesser General Public License for more details.
    00021  *
    00022  * You should have received a copy of the GNU Lesser General Public
    00023  * License along with this library; if not, write to the Free Software
    00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
    00025  */
    00026
    00027 #include <glibmm/interface.h>
    00028
    00029 #include <gdkmm/gl/defs.h>
    00030 #include <gdkmm/gl/config.h>
    00031 #include <gdkmm/gl/context.h>
    00032
    00033 #include <GL/gl.h>
    00034
    00035
    00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00037 typedef struct _GdkGLDrawable GdkGLDrawable;
    00038 typedef struct _GdkGLDrawableClass GdkGLDrawableClass;
    00039 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00040
    00041
    00042 namespace Gdk
    00043 {
    00044
    00045 namespace GL
    00046 { class Drawable_Class; } // namespace GL
    00047
    00048 } // namespace Gdk
    00049 namespace Gdk
    00050 {
    00051 namespace GL
    00052 {
    00053
    00054 class Context;
    00055
    00065 class Drawable : public Glib::Interface
    00066 {
    00067
    00068 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00069
    00070 public:
    00071   typedef Drawable CppObjectType;
    00072   typedef Drawable_Class CppClassType;
    00073   typedef GdkGLDrawable BaseObjectType;
    00074   typedef GdkGLDrawableClass BaseClassType;
    00075
    00076 private:
    00077   friend class Drawable_Class;
    00078   static CppClassType drawable_class_;
    00079
    00080   // noncopyable
    00081   Drawable(const Drawable&);
    00082   Drawable& operator=(const Drawable&);
    00083
    00084 protected:
    00085   Drawable(); // you must derive from this class
    00086   explicit Drawable(GdkGLDrawable* castitem);
    00087
    00088 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    00089
    00090 public:
    00091   virtual ~Drawable();
    00092
    00093   static void add_interface(GType gtype_implementer);
    00094
    00095 #ifndef DOXYGEN_SHOULD_SKIP_THIS
    00096   static GType get_type()      G_GNUC_CONST;
    00097   static GType get_base_type() G_GNUC_CONST;
    00098 #endif
    00099
    00101   GdkGLDrawable*       gobj()       { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
    00102
    00104   const GdkGLDrawable* gobj() const { return reinterpret_cast<GdkGLDrawable*>(gobject_); }
    00105
    00106 private:
    00107
    00108
    00109 public:
    00110
    00111
    00116   bool make_current(const Glib::RefPtr<Context>& glcontext);
    00117
    00118
    00123   bool is_double_buffered() const;
    00124
    00125
    00128   void swap_buffers();
    00129
    00130
    00133   void wait_gl();
    00134
    00135
    00138   void wait_gdk();
    00139
    00140
    00145   bool gl_begin(const Glib::RefPtr<Context>& glcontext);
    00146
    00147
    00150   void gl_end();
    00151
    00152
    00156   Glib::RefPtr<Config> get_gl_config();
    00157
    00161   Glib::RefPtr<const Config> get_gl_config() const;
    00162
    00163
    00169   void get_size(int& width, int& height);
    00170
    00171
    00175   static Glib::RefPtr<Drawable> get_current();
    00176
    00177 public:
    00178
    00179
    00186   static void draw_cube(bool solid, double size);
    00187
    00188
    00199   static void draw_sphere(bool solid, double radius, int slices, int stacks);
    00200
    00201
    00212   static void draw_cone(bool solid, double base, double height, int slices, int stacks);
    00213
    00214
    00223   static void draw_torus(bool solid, double inner_radius, double outer_radius, int nsides, int rings);
    00224
    00225
    00230   static void draw_tetrahedron(bool solid);
    00231
    00232
    00237   static void draw_octahedron(bool solid);
    00238
    00239
    00244   static void draw_dodecahedron(bool solid);
    00245
    00246
    00252   static void draw_icosahedron(bool solid);
    00253
    00254
    00261   static void draw_teapot(bool solid, double scale);
    00262
    00263
    00264 public:
    00265
    00266 public:
    00267   //C++ methods used to invoke GTK+ virtual functions:
    00268
    00269 protected:
    00270   //GTK+ Virtual Functions (override these to change behaviour):
    00271
    00272   //Default Signal Handlers::
    00273
    00274
    00275 };
    00276
    00289 } // namespace GL
    00290 } // namespace Gdk
    00291
    00292
    00293 namespace Glib
    00294 {
    00300   Glib::RefPtr<Gdk::GL::Drawable> wrap(GdkGLDrawable* object, bool take_copy = false);
    00301
    00302 } // namespace Glib
    00303
    00304 #endif /* _GDKMM_GL_DRAWABLE_H */
    00305