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

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.

Murray Cumming
murrayc murrayc com

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