Re: [gtkmm] Iterating through widgets; Passing data to callbackhandlers
- From: Murray Cumming <murrayc murrayc com>
- To: Samuel <spam debain org>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Iterating through widgets; Passing data to callbackhandlers
- Date: Wed, 31 Mar 2004 22:16:36 +0200
On Wed, 2004-03-31 at 21:51, Samuel wrote:
> Hello,
>
> I have created a preferences window using libglademm and named all
> widgets in Glade.
>
> Now firstly, I would like to connect all the widget signals at once
> using a loop. Is there a way to iterate through all widgets of a window
> with an unlimited depth?
Yes, use Container::children().
> Secondly, I am trying to connect all the widget callbacks to *one*
> function, which is bringing up another issue:
>
> Inside the callback handler, I need to get the name (as defined in
> Glade) and type of the widget that emitted the signal. In C this is
> possible by passing user data along with every signal (and a pointer to
> the widget is being passed, also).
> I was not able to figure out how to get the widget that originally
> emitted the signal.
A dynamic_cast<> can tell you what the type is. We do this quite a lot
in the Configuration/Preferences stuff for Bakery, and in the libglademm
VariablesMap thing - you probably want to look at them. Maybe we've
already done what you want.
--
Murray Cumming
www.murrayc.com
murrayc murrayc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]