Re: [gtkmm] Re: Need your advice for glademm code



Murray Cumming wrote:
On Wed, 2002-10-23 at 13:00, Christof Petig wrote:
[snip]

So far it works very well. But once you connect to a signal of a custom widget, glade-- can not guess the signature of the virtual function to create.


You mean that in the past you expected the user to write the signature
for you?

I provided a void Foo() signature, but the user was free to change it according to the signal characteristics. He could even mark it as const without any problems.

E.g. my tree widget provides a 'row_selected' signal which gives the data handle as an argument. Glade-- cannot know in advance about the signature to create.


Technically you can guess some of the signature based on introspection -
see gtkmm/tools/generate_extra_defs. Luckily, in 80% of cases a void
something() signature will probably be correct.

This is not an issue for gtkmm widgets' signals since their arguments are known. Glade provides the right signature in 98% of the cases. The 2% never proved a problem in the past since the user was free to edit the signature in his own file.


What does Glade do for the C equivalent?


Glade (and gtk) is not type safe. It simply assumes that you know which arguments to accept in a callback. You already know, don't you?

Solutions which come to my mind:
- let the user specify callback arguments for custom widgets in an XML file.
- let the user specify the arguments for the custom widget's signal. This would force me to modify glade (I hate to go back to C's restrictions). [perhaps an option for the future, I still have plans to modify glade for dynamic C++ options/arguments]

   Christof




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