[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-app-devel
Subject:    Re: GtkStateType and  sensitive = (sensitive != FALSE);
From:       Havoc Pennington <rhp () zirx ! pair ! com>
Date:       1999-07-08 4:27:36
[Download RAW message or body]


On Wed, 7 Jul 1999, Batperson wrote:
> for the 'state-changed' signal for a widget, i want to attach a handler
> that will get some attached widget from the first widget and set the
> second widget to the same state as the first (sensitive/insensitive only).
> this signal uses GtkStateType which contains GTK_STATE_INSENSITIVE but no
> GTK_STATE_SENSITIVE. my assumption is that GTK_STATE_NORMAL is the
> sensitive equivalent or maybe even GTK_STATE_ACTIVE is. so, what state do
> i need to look for for the sensitive case?
>

All the not-insensitive cases are sensitive. "active" is while the button 
is being held down. "prelight" is when the mouse is over the button but
the button isn't pressed. "selected" is e.g. for widgets in a GtkList,
when they're selected. active/prelight apply to non-buttons in analagous
ways.
 
> secondly, there are two things that i need to be clear on:
> 1) gtk_signal_connect'ed functions are run along with the default ones.

Hmm, read my sample chapter on this:
http://pobox.com/~hp/gnome-app-devel.html

I guess the answer is 'yes' but there are lots of details you need to
know.

> 2) a signal like 'destroy' or 'state-changed' that happens on a container
> widget, like a box, is passed on to all of the container's children.
> 

Nope, it isn't. gtk_widget_set_sensitive() does recurse the children,
desensitiziing each one; but this is a property of that function, not
signals in general. The signal is emitted because the state of each child
changes.

> and finally:
> 
> what exactly does the following line from gtk_widget_set_sensitive() do?
> 
>   sensitive = (sensitive != FALSE);
> 

It ensures that the sensitive variable is TRUE or FALSE and not just a
random non-zero value, so that you can safely check boolean values for
equality. A bit of paranoia since some C programmers don't understand
types and pass "47" instead of "TRUE."

Havoc



-- 
         To unsubscribe: mail gtk-app-devel-list-request@redhat.com with 
                       "unsubscribe" as the Subject.

	Mailing list concerns should be mailed to <listmaster@redhat.com>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic