[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: implementing a container??
- From: Owen Taylor <otaylor redhat com>
- To: Jim Crafton <jim crafton verizon net>
- Cc: GTK App Dev List <gtk-app-devel-list gnome org>
- Subject: Re: implementing a container??
- Date: 27 Apr 2003 19:08:12 -0400
On Sat, 2003-04-26 at 20:21, Jim Crafton wrote:
> I am using gtk in my framework for it's linux port.
> In the framework that I have written I already have code that does
> repositioning of child controls based on alignment and or anchors.
> So my question is, what is the best approach for using GtkWidgets and
> positioning them with absolute coordinates (with the alignment/layout
> being taken care of by my framework)? I have experimented with the fixed
> container, and this seems very similar to what I want, but I am a bit
> confused as to how best to use it.
> For example
> if i want to move a child control (that has been added to the fixed
> container) what is the "correct" way to do it?
> I can use the gtk_fixed_move for x and y coordinates and then use
> gtk_widget_set_size_request() to set the width and height.
I believe that is is the normal way to do it.
> But is there a better way? Should I make a special container class to
> handle this(I notice that this appears to have been what wxWindows did
> for their port)?
If you want to do anything at all complex, generally implementing
a new container is right; if you use a GtkFixed, it's going to be
inefficient, and it's pretty much impossible to get positioning
that depends on the size of the children widgets right.
Implementing a container isn't that hard ... the only virtual methods
you need to implement are, I think, size_request(), size_allocate(),
forall(), and remove().
(child_type() and add() are theoretically needed as well, but as your
widget is just being used in your framework, I doubt you'll need them.)
Regards,
Owen
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]