Re: send a manual ceated signal to a window or widget

Den 2014-12-20 22:04, Murray Cumming skrev:
On Sat, 2014-12-20 at 11:51 +0100, Kjell Ahlstedt wrote:
As you've seen by now there are emit functions in glib. I don't know
why none of them have been wrapped in a C++ method in glibmm. If it
shall be added, I think the most natural location is in the
Glib::SignalProxy classes. Then you could emit a signal with a call
such as
  bool handled = widget->signal_button_press_event().emit(event);

If you like, you can file a bug in Bugzilla and suggest it should be
added. I don't know if there is a good reason for not doing it.

I've always thought that encourages messing about with the internals of
a widget. Widget's don't expect their own signals to be emitted at
arbitrary times. When there's a real need for application code to cause
a widget's signal to be emitted, there's usually a method that does
that. But that's still fairly rare because it's so specifically about
something internal to the widget - that fragile implementation-dependent
stuff doesn't really belong in a well-designed API.

Usually, if someone wants to emit a widget's signal, the conversation
should first be about what they want to actually achieve.

That's reasonable. In this case I've got the impression that Klaus is trying to implement a workaround for shortcomings in goocanvas. Goocanvas does not handle touch events properly, and Klaus wants to "convert" touch events to button press events. Klaus, correct me if I'm wrong. If I'm right, the shortcomings in goocanvas should be fixed. I don't know much about goocanvas and goocanvasmm. It may be hard to do.


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