Re: Deriving from Gtk::ListStore



> On Thursday 25 November 2004 23:04, Murray Cumming wrote:
>
>> These vague assertions are useless to us. You need to ask specific
>> questions and/or mention specific lack of documentation in bugzilla:
>> http://www.gtkmm.org/bugs.shtml
>
> Okay. First time posting here :)
>
>> I think you might be exagerating. Do you have a specific example and a
>> way to improve it?
>
> Yes, document what their purpose is.
>
> [from the Gtk::TreeSelection reference]
>
> typedef sigc::slot< void,
> const TreeModel::Path&,
> const TreeModel::iterator& >  SlotForeachPathAndIter

>   For example, void on_foreach(const Gtk::TreeModel::Path& path, const
> Gtk::TreeModel::iterator& iter);.

I always thought that sigc::slot was a very basic thing that people should
know about, but I guess it's not so easy since we changed the slot creator
function from SigC::slot() to sigc::mem_fun() in gtkmm 2.4.

And I hoped that the "For example, " parts would make it more obvious.

But I am happy to add more text there and in the book's "basics" section..
Please put a suggestion in bugzilla.

> This description is not really helpful. It doesn't explain what the type
> is
> used for and especially how it is used.
>
>> All classes that derive from Glib::Object must have protected
>> constructors but must have public create() methods that use those
>> constructors. That is true for your own classes as well as the gtkmm
>> classes.
>
> Ah, so I merely have to provide a create function which returns a RefPtr
> to a
> newly allocated MyModel? But how is the memory managed? Does the base
> class
> ctor make sure my object is created in this managed storage pool?

It's a RefPtr:

http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1RefPtr.html#_details

http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/apa.html

So your object is refcounted, and your constructor will be called when
there are no more RefPtrs to your object. It does not need to be put into
any pool - you just need to put it in the RefPtr. Again, I welcome any
suggestions for improvement to that documentation, in bugzilla.

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]