Re: Nonstandard Check Button
- From: Paul Pogonyshev <pogonyshev gmx net>
- To: Carsten Burstedde <c burstedde de>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Nonstandard Check Button
- Date: Sun, 16 Jan 2005 17:53:17 +0200
Carsten Burstedde wrote:
I would like a check button where the checkbox does not automatically
toggle its state when clicked. I only need the clicked signal, and I
will update the active state (and hence the checkbox) asynchronously.
Is there some elegant way to do this?
Catch the "clicked" signal and use g_signal_stop_emission(). Should
work I guess.
With the following callback it doesn't help. Maybe I need a
GSignalEmissionHook? And how should I call g_signal_lookup etc.?
static void
check_clicked (GtkWidget *widget, gpointer data)
{
g_print ("Clicked\n");
g_signal_stop_emission_by_name (widget, "clicked");
}
g_signal_connect (G_OBJECT (check), "clicked", G_CALLBACK
(check_clicked), NULL);
In GTK+ sources (`gtkbutton.c') we can see that "clicked" signal is created
like this:
button_signals[CLICKED] =
g_signal_new ("clicked",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkButtonClass, clicked),
NULL, NULL,
_gtk_marshal_VOID__VOID,
G_TYPE_NONE, 0);
So, any callback will be called after the class handler of the signal. Then
you should subclass GtkCheckButton, override the `clicked' handler and not
call the handler of the parent class.
Paul
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]