Re: Pixmaps in gtk




jchrr@HRZ.Uni-Bielefeld.DE writes:
>But I think you want to do more: For example a check-button: paint a 
>mechanical switch in a paint-program, maybe with an led showing the state
>(on/off), in the on and off position, but keep the background transparent.
>Now, if the widget has to be drawn, it paints one of the two pixmaps.
>
>This can't currently be done with gtk...

I beg to differ.  Buttons can hold any widget, including GtkPixmaps.
While handling the button-press event, swap in a different GtkPixmap.
You can make the user_data be a pointer to an array of GtkPixmaps,
and drop the correct one in at each button press.

It wouldn't be hard, I think, to subclass the gtk button to get a
multi-pixmap button that would do this itself.

Now, completed GtkStyles might make it a little bit easier to get
the effect you mention, but they aren't required.

michaelkjohnson

"Magazines all too frequently lead to books and should be regarded by the
 prudent as the heavy petting of literature."            -- Fran Lebowitz



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