Re: Sample simple container.



On 3/30/07, Murray Cumming <murrayc murrayc com> wrote:
On Fri, 2007-03-30 at 16:45 -0300, Alexandre Moreira wrote:
> I would like to have a way to create composite widgets without
> exposing the base Container  methods (Let's say I used a box... it
> would have the box's methods and all the GtkContainer methods... and I
> wouldn't like client code to call gtk_container_add on a widget that
> is not supposed to "mean" a container)
>
> So, I would like to create an as-simple-as-it-gets container that
> descended only from GtkWidget  so that it wouldn't really have methods
> to act like a container (Its only child widget would be set as a
> constructor parameter and overrided by its descendants).

I can offer a simpe custom container in gtkmm:
http://svn.gnome.org/viewcvs/gtkmm/trunk/examples/book/custom/custom_container/

It derives from Gtk::Container, but I'd expect any container to do that.

Thanks Murray, I'll give this one a better look.

It just stroke me that I don't need a "container" in the GtkContainer
sense of the word, only a widget that is capable of delegating every
event handler it has to a single child. Like size allocate, expose,
etc...

Can anyone help me with the methods I'd have to override to pass
events on to this child widget ?

Regards,
Alexandre Moreira.




> That way I could compose a widget using a table, a box or whatever
> layout containers and pack it inside a class, derived from that one I
> described above, that would only export the methods needed to the
> users (the GtkWidget methods and the specific Widget methods).
>
> Is there a better way to achieve this ? The only thing I could thought
> of was this "Basic Dumb Container" but I know it looks really bad. Is
> there a way to make a composite widget without exporting all those
> nasty GtkContainer and other containers methods ?

--
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]