Re: Making Signal For A Widget.



Ok, I thought you wanted to create your signals without creating a class for them
or some wacky think like that.

Now that we're past all that confusion; lets go back to the source (I think
that all your questions have been answered in some roundabout ways by now).

> I would like to make a signal for a particular widget that will be emmited when you press the
> first mouse button.
> I don't want to use the
> g_signal_connect(G_OBJECT(widget),"button_press_event",G_CALLBACK(callback),NULL); > for the widget Because i want the callback to called only when i press the First mouse button.

> So I would like to make something like "clicked" signal for the gtk_button.
> IN gtkbutton.c is called
> g_signal_new("clicked",....);
> but i don't undarstand how this signal is emmited only when the button pressed. > So can anyone tell me how you pass the events to g_signal_new that will emmit the new signal.

Ahhh, you need knowlage about signals (I guess we could have figured that out
in the beginning).

I've refered people to this page before and I'll do it again because it lead me to a much
greater understanding of GSignals, GClosures, GValues, GTypes, marshallers,
accumulators and all of that madness that (IMO) make gtk libraries so damn cool ;-)

     http://www.gnome.org/~james/language-bindings/
(written to help people write language bindings but very helpfull on theese topics)

Basicly:

=== (Very rough description) ====
-a GValue is a catch all opaque type
-a GClosure is an object that holds all infermation needed to emit signals
by calling a seties of handlers
-a marshaller is a function that knows how to call the handler (useing GValues)
-an accumulator is a function that "accumulates" return values (as GValues)
(i.e. an accumulator exists to check if signal emmision should stop in
integer return value signals)

you might want to look at :
"gobject/gmarshal.list"
"gobject/gmarshal.c"
and `genmarshal' is a program that generates a "gmarshal.c" based on
a gmarshal.list.

This stuff should at least get you through making your first "educated"
call the the function "g_signal_new()"
after that, useing examples smattered through the source; implementing a slew
of signals should be a sinch ;-)

Cheers,
                                                           -Tristan






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