On Sat, 22 Jan 2005 21:46:20 +0100, Miguel Angel Polo
<[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi all
>
> I want to know the correct way to load a widget (derived from
> Gtk::GL::DrawingArea) from my .glade file
I have now managed to do it in what I believe is the most elegant way.
In glade I just add a custom widget, and point it to a custom creation
function, which I then have to define:
extern "C"
GtkWidget*
getGLArea( char *widget_name, gchar *string1, gchar *string2, gint
int1, gint int2 ) {
TRACE;
Glib::RefPtr<Gdk::GL::Config> glconfig =
Gdk::GL::Config::create(Gdk::GL::MODE_RGB |
Gdk::GL::MODE_DEPTH |
Gdk::GL::MODE_DOUBLE);
// SimpleGLScene is just a subclass of Gtk::GL::Drawingarea
SimpleGLScene *const widget = new SimpleGLScene( glconfig );
widget->set_size_request( int1, int2 );
widget->show();
return Gtk::manage(dynamic_cast<Gtk::Widget*>(widget))->gobj();
}
Take note of the extern "C" clause. Since it is a C function any
namespace it exists in is just syntatic sugar and must not be set in
glade.
I also explicitely have to call show() and set_size_request, setting
these in Glade does not seem to have any effect.
After loading the glade xml file I can get a pointer to the widget by calling:
refXml->get_widget( "OpenGLArea", GLarea );
--
Regards Johan Seland
PhD Student
Center for Mathematics with Applications
University of Oslo
_______________________________________________
gtkglext-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkglext-list