Re: Children of a vBox



On 4/22/06, millerf free fr <millerf free fr> wrote:
> Hello,
>
> I' a newbie in c++ and gtkmm programmation,
> so I'm having some understanding issues; as for example, I trying to get the
> references of the children of one of my vBox...
> So I'm using the get_children() method.
> She is returning a Glib::ListHandle component.
> But I don't know how to manage those king of Objects...
> There is "something", I think it's called operator:
> template<class U> operator std::list () const

Yes, these functions are there to make it easy to do automatic casting
(or whatever the proper term for that is).  So you should
theoretically be able to just do:
std::list<Gtk::Widget*> widget_list = vbox.get_children();

or for that matter:
std::vector<Gtk::Widget*> widget_vector = vbox.get_children();

and it should just work.  The goal of the ListHandle type is to allow
you to use any of the standard C++ containers (list, vector, deque)
and not tie you to one particular implementation.  It's only an
'intermediate' type to assist in transitioning to a standard container
type.  But I agree that it's not particularly clear when you first run
across it.

Hope that helps,
Jonner



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