Re: More info about signals



Philippe FREMY wrote:
> 1. All the arguments that are received by the function the signal is
> connected to are set when connecting the signal, right ? I'm asking this
> because I am more familiar with Qt where you define the info that your
> signal is carrying when emitting the signal.

Hi Philippe, it's just like Qt (as I understand it).

- when a signal is created (ie. the class init function for widgets of 
type "bar" tells gtk that instances of "bar" will be emmitting a signal 
"foo") the widget specifies the number and type of each signal argument. 
The marshallers do the argument processing for you. All signals have a 
final "client" argument which is always a "void*" and which widget "bar" 
has no control over.

- when a client connects to a signal, it gives a value for the client 
pointer, plus a function to connect to

- when a signal is emmitted (eg. an instance of widget "bar" decides 
that event "foo" has occurred), "bar" gives values to gtk_signal_emit() 
for each of the arguments ... except the client pointer

- when a signal is recieved, the client function sees the arguments 
given by the widget, plus the client value that it specified when it 
connected.

> 2. Is it possible to pass more info in the signals than just a pointer ?
All
> the signals I have seen are either signals linked to events or signal
> without much info embedded in them. What if I want to pass three int and a
> custom struct in  my signal ? Is it what the marshaller are for ?

A signal can have any numbner of args of any type, but only one client 
value.

John



========================================================== 
Coming soon:
Fabric of Vision 
Dress and Drapery in Painting 

19 June - 8 September 2002 

For information and tickets: 
http://www.nationalgallery.org.uk/exhibitions/fabric/



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