Re: Adding a child widget to a custom widget
- From: Tristan Van Berkom <tvb gnome org>
- To: Alexandre <alpebu yahoo com br>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Adding a child widget to a custom widget
- Date: Wed, 06 Sep 2006 09:40:32 -0400
Alexandre wrote:
Hi
I'm creating a widget, a plotting widget, and I have done a scale widget too. So, I want that the plotting
widget has a child, the scale widget, to be it's axis.
So, I fill the "allocation" structure of the scale widget to the position I want, and then I call
gtk_widget_set_parent (scale, plot). But It doesn't works, the expose function of the scale widget is never
called (neither the realize, configure.. and the others I think).
I don't know if it's the right procedure to add a child widget..
If someone could help me, I would be glad.
Hi Alexandre,
Parenting a widget is not a simple matter of setting the values
of a childs allocation struct, you should never man-handle widget structures
like this - your container widget must properly implement the GtkContainer
interface (which, for your added confusion - is actually implemented as
an abstract class and not an interface, but thats besides the point...).
Your best bet is to look at the gtk+ code for a container that works
similar to how your container will work and then borrow the groundworks,
for example - you must implement ->forall(), ->add(), ->remove() etc...
you must gtk_widget_size_allocate() some screen realestate for your children
when your container widget is resized etc.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]