00001 // -*- C++ -*- 00002 /* gtkglextmm - C++ Wrapper for GtkGLExt 00003 * Copyright (C) 2002-2003 Naofumi Yasufuku 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00018 */ 00019 00020 #ifndef _GTKMM_GL_DRAWINGAREA_H 00021 #define _GTKMM_GL_DRAWINGAREA_H 00022 00023 #include <gtkmm/drawingarea.h> 00024 00025 #include <gtkmm/gl/widget.h> 00026 00027 namespace Gtk 00028 { 00029 namespace GL 00030 { 00031 00032 /** OpenGL-capable DrawingArea widget. 00033 * 00034 * 00035 */ 00036 00037 class DrawingArea : public Gtk::DrawingArea, 00038 public Gtk::GL::Widget 00039 { 00040 private: 00041 // noncopyable 00042 DrawingArea(const DrawingArea&); 00043 DrawingArea& operator=(const DrawingArea&); 00044 00045 public: 00046 virtual ~DrawingArea(); 00047 00048 public: 00049 00050 /** Create an DrawingArea widget which supports OpenGL rendering. 00051 * This constructor does *NOT* call set_gl_capability() method, 00052 * so that you should call it yourself to make instantiated DrawingArea 00053 * OpenGL-capable. 00054 * 00055 */ 00056 DrawingArea() 00057 : Gtk::GL::Widget(static_cast<Gtk::Widget&>(*this)) 00058 {} 00059 00060 /** Create an OpenGL-capable DrawingArea widget. 00061 * 00062 * @param glconfig a Gdk::GL::Config. 00063 * @param share_list the Gdk::GL::Context which to share display lists. 00064 * @param direct whether rendering is to be done with a direct 00065 * connection to the graphics system. 00066 * @param render_type Gdk::GL::RGBA_TYPE or Gdk::GL::COLOR_INDEX_TYPE 00067 * (currently not used). 00068 */ 00069 DrawingArea(const Glib::RefPtr<const Gdk::GL::Config>& glconfig, 00070 const Glib::RefPtr<const Gdk::GL::Context>& share_list, 00071 bool direct = true, 00072 int render_type = Gdk::GL::RGBA_TYPE) 00073 : Gtk::GL::Widget(static_cast<Gtk::Widget&>(*this)) 00074 { set_gl_capability(glconfig, share_list, direct, render_type); } 00075 00076 /** Create an OpenGL-capable DrawingArea widget. 00077 * 00078 * @param glconfig a Gdk::GL::Config. 00079 * @param direct whether rendering is to be done with a direct 00080 * connection to the graphics system. 00081 * @param render_type Gdk::GL::RGBA_TYPE or Gdk::GL::COLOR_INDEX_TYPE 00082 * (currently not used). 00083 */ 00084 DrawingArea(const Glib::RefPtr<const Gdk::GL::Config>& glconfig, 00085 bool direct = true, 00086 int render_type = Gdk::GL::RGBA_TYPE) 00087 : Gtk::GL::Widget(static_cast<Gtk::Widget&>(*this)) 00088 { set_gl_capability(glconfig, direct, render_type); } 00089 00090 }; 00091 00092 /** @example simple-darea.cc 00093 * 00094 * Simple Gtk::GL::DrawingArea example. 00095 * 00096 */ 00097 00098 /** @example share-lists.cc 00099 * 00100 * Simple display list sharing example. 00101 * 00102 */ 00103 00104 /** @example logo.h 00105 * 00106 * GtkGLExt logo demo. 00107 * 00108 */ 00109 00110 /** @example logo.cc 00111 * 00112 * GtkGLExt logo demo. 00113 * 00114 */ 00115 00116 /** @example gears.cc 00117 * 00118 * 3-D gear wheels demo. 00119 * 00120 */ 00121 00122 } // namespace GL 00123 } // namespace Gtk 00124 00125 #endif // _GTKMM_GL_DRAWINGAREA_H