Re: Insensitive pixmaps



On Mon, Sep 21, 1998 at 03:20:45AM +0200, Tim Janik wrote:
> On Sun, 20 Sep 1998, Lionel ULMER wrote:
> 
> > >   Can't you just use gtk_pixmap_set() to switch the GtkPixmap between the
> > > two images you want for sensitive and insensitive? 
> > 
> > Well, it is what I am doing... But it is really a "hack" (each time I
> > do a gtk_widget_set_sensitive, I need to call a special function that
> > changes the pixmap).
> > 
> > And changing the Pixmap code would mean that all the code using
> > GtkPixmaps (as toolbar for example) would not have to be changed to
> > have the "new" sensitive code.
> 
> if a widget changes it's state (i.e. sentsitivity) the GtkWidget::state_changed
> signal is emitted, so you only need to:
> 
> gtk_signal_connect (GTK_OBJECT (pixmap),
>                     "state_changed",
>                     GTK_SIGNAL_FUNC (pixmap_state_changed),
>                     NULL);
> static void
> pixmap_state_changed (GtkWidget      *widget,
>                       GtkStateType    previous_state,
>                       gpointer        user_data)
> {
>   GtkPixmap *pixmap;
>   
>   pixmap = GTK_PIXMAP (widget);
> 
>   switch (GTK_WIDGET_STATE (pixmap))
>   {
>   case GTK_STATE_NORMAL:
>     gtk_pixmap_set (pixmap, normal_pixmap, normal_mask);
>     break;
>   case GTK_STATE_INSENSITIVE:
>     gtk_pixmap_set (pixmap, insensitive_pixmap, insensitive_mask);
>     break;
>   case GTK_STATE_ACTIVE:
>   case GTK_STATE_PRELIGHT:
>   case GTK_STATE_SELECTED:
>     /* we want to ignore these? */
>     break;
>   }
> }
>                       

On the other hand, it would be much more convienent if you could 
just do:

gtk_pixmap_set_insensitive (pixmap, i_pixmap, i_mask);

after the widget is created, which I think was the original point
of the suggestion.

--
Shawn T. Amundson               
amundson@gimp.org               http://www.gimp.org/~amundson

"The assumption that the universe looks the same in every
 direction is clearly not true in reality." - Stephen Hawking



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