Re: [gtkmm] gtkmm 2.4 questions



Hello!

I would be surprised if the recomputation you are doing requires a change in the underlying data or the fundamental state of the CellRenderer; therefore you should be able to do it inside a const method without a great deal of difficulty, perhaps with the help of a few mutable data members (perhaps for result caching where appropriate).

Yes, mainly the result is cached for the immediatly following render call. Ok, having the cache result mutable don't look so bad.

It seems a good rule of API design to write methods as const whenever you possibly can. This provides a clear and guarenteed interface to the user, helping them to write code that doesn't have unexpected side effects. That might be the Haskell programmer in me speaking.

Yes, I do so too for my own code.

Then my question, why is get_size_vfunc const? What's the difference compared to render_vfunc for example?

I can't answer that question, as I had no input on the design of the API there. I would have expected render_vfunc to be const, but it may operate in a way which surprises me and forces it to be non-const.

render_vfunc should be const too, then I aggree on the logic :-) Otherwise something is not consequent and logical.


Regards,
Frank



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