[Xfc-dev] xfc Widget class

Jeff Franks jcfranks at tpg.com.au
Tue Apr 5 08:24:41 CEST 2005


Xavier Otazu wrote:

>	Hi:
>
>	This weekend I was trying to include the C code generated by
>glade into xfc code in order to visually design GUI with glade.
>
>	I found the Widget(Widget* p, bool) protected
>explicit constructor.
>
>	My question is: why is this constructor protected? This way I
>cannot define something like
>
>Widget *my_glade_widget=glade_func_that_creates_and_returns_widget(); 
>Xfc::Gtk::Widget my_xfc_widget(my_glade_widget);
>
>  
>
You can wrap any C object/widget with this function call:

GtkWidget *my_glade_widget=glade_func_that_creates_and_returns_widget(); 
Xfc::Gtk::Widget* my_xfc_widget = G::Object::wrap<Xfc::Gtk::Widget>(my_glade_widget);


G::Object::wrap<> calls the protected constructor for you. If you look 
at the XFC source code this is how XFC wraps C objects and widgets.

Jeff.



More information about the Xfc-dev mailing list