gtkglextmm: gtkmm/gl/widget.h Source File

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

# widget.h

Go to the documentation of this file.

    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_WIDGET_H
    00021 #define _GTKMM_GL_WIDGET_H
    00022
    00023 #include <gtkmm/widget.h>
    00024
    00025 #include <gdkmm/gl/tokens.h>
    00026 #include <gdkmm/gl/config.h>
    00027 #include <gdkmm/gl/context.h>
    00028 #include <gdkmm/gl/window.h>
    00029
    00030 namespace Gtk
    00031 {
    00032   namespace GL
    00033   {
    00034
    00047     bool widget_set_gl_capability(Gtk::Widget& widget,
    00048                                   const Glib::RefPtr<const Gdk::GL::Config>& glconfig,
    00049                                   const Glib::RefPtr<const Gdk::GL::Context>& share_list,
    00050                                   bool direct = true,
    00051                                   int render_type = Gdk::GL::RGBA_TYPE);
    00052
    00064     bool widget_set_gl_capability(Gtk::Widget& widget,
    00065                                   const Glib::RefPtr<const Gdk::GL::Config>& glconfig,
    00066                                   bool direct = true,
    00067                                   int render_type = Gdk::GL::RGBA_TYPE);
    00068
    00075     bool widget_is_gl_capable(const Gtk::Widget& widget);
    00076
    00082     Glib::RefPtr<Gdk::GL::Config> widget_get_gl_config(const Gtk::Widget& widget);
    00083
    00097     Glib::RefPtr<Gdk::GL::Context> widget_create_gl_context(const Gtk::Widget& widget,
    00098                                                             const Glib::RefPtr<const Gdk::GL::Context>& share_list,
    00099                                                             bool direct = true,
    00100                                                             int render_type = Gdk::GL::RGBA_TYPE);
    00101
    00114     Glib::RefPtr<Gdk::GL::Context> widget_create_gl_context(const Gtk::Widget& widget,
    00115                                                             bool direct = true,
    00116                                                             int render_type = Gdk::GL::RGBA_TYPE);
    00117
    00127     Glib::RefPtr<Gdk::GL::Context> widget_get_gl_context(const Gtk::Widget& widget);
    00128
    00134     Glib::RefPtr<Gdk::GL::Window> widget_get_gl_window(const Gtk::Widget& widget);
    00135
    00141     Glib::RefPtr<Gdk::GL::Drawable> widget_get_gl_drawable(const Gtk::Widget& widget);
    00142
    00148     template <class T_GtkWidget>
    00149     class Widget
    00150     {
    00151     public:
    00152       virtual ~Widget() = 0;
    00153
    00154     public:
    00155
    00167       bool set_gl_capability(const Glib::RefPtr<const Gdk::GL::Config>& glconfig,
    00168                              const Glib::RefPtr<const Gdk::GL::Context>& share_list,
    00169                              bool direct = true,
    00170                              int render_type = Gdk::GL::RGBA_TYPE)
    00171       { return widget_set_gl_capability(*static_cast<T_GtkWidget*>(this), glconfig, share_list, direct, render_type); }
    00172
    00183       bool set_gl_capability(const Glib::RefPtr<const Gdk::GL::Config>& glconfig,
    00184                              bool direct = true,
    00185                              int render_type = Gdk::GL::RGBA_TYPE)
    00186       { return widget_set_gl_capability(*static_cast<T_GtkWidget*>(this), glconfig, direct, render_type); }
    00187
    00193       bool is_gl_capable() const
    00194       { return widget_is_gl_capable(*static_cast<const T_GtkWidget*>(this)); }
    00195
    00200       Glib::RefPtr<Gdk::GL::Config> get_gl_config()
    00201       { return widget_get_gl_config(*static_cast<T_GtkWidget*>(this)); }
    00202
    00207       Glib::RefPtr<const Gdk::GL::Config> get_gl_config() const
    00208       { return widget_get_gl_config(*static_cast<const T_GtkWidget*>(this)); }
    00209
    00222       Glib::RefPtr<Gdk::GL::Context> create_gl_context(const Glib::RefPtr<const Gdk::GL::Context>& share_list,
    00223                                                        bool direct = true,
    00224                                                        int render_type = Gdk::GL::RGBA_TYPE)
    00225       { return widget_create_gl_context(*static_cast<T_GtkWidget*>(this), share_list, direct, render_type); }
    00226
    00238       Glib::RefPtr<Gdk::GL::Context> create_gl_context(bool direct = true,
    00239                                                        int render_type = Gdk::GL::RGBA_TYPE)
    00240       { return widget_create_gl_context(*static_cast<T_GtkWidget*>(this), direct, render_type); }
    00241
    00250       Glib::RefPtr<Gdk::GL::Context> get_gl_context()
    00251       { return widget_get_gl_context(*static_cast<T_GtkWidget*>(this)); }
    00252
    00257       Glib::RefPtr<Gdk::GL::Window> get_gl_window()
    00258       { return widget_get_gl_window(*static_cast<T_GtkWidget*>(this)); }
    00259
    00264       Glib::RefPtr<const Gdk::GL::Window> get_gl_window() const
    00265       { return widget_get_gl_window(*static_cast<const T_GtkWidget*>(this)); }
    00266
    00271       Glib::RefPtr<Gdk::GL::Drawable> get_gl_drawable()
    00272       { return widget_get_gl_drawable(*static_cast<T_GtkWidget*>(this)); }
    00273
    00278       Glib::RefPtr<const Gdk::GL::Drawable> get_gl_drawable() const
    00279       { return widget_get_gl_drawable(*static_cast<const T_GtkWidget*>(this)); }
    00280
    00281     };
    00282
    00283     template <class T_GtkWidget>
    00284     Widget<T_GtkWidget>::~Widget()
    00285     {}
    00286
    00299   } // namespace GL
    00300 } // namespace Gtk
    00301
    00302 #endif // _GTKMM_GL_WIDGET_H