Re: ImageButton



2009/2/2 Steffen Toksvig <s toksvig gmail com>:
> What is the best way to make an 'owner drawn' button that draws
> different images depending on  the state of the button.
> The button would draw only the relevant image, possibly scaled if the
> button has a different size compared to the image and a label. But it
> should not draw any of the normal button graphics.

Just make a regular button and turn off the relief decoration and the border:

        gtk_button_set_relief( GTK_BUTTON( but ), GTK_RELIEF_NONE );
        gtk_container_set_border_width( GTK_CONTAINER( but ), 0 );

No doubt you could do this with a style file too.

Put a GtkImage inside the button and change the graphic to whatever
you want, whenever you want.

You'll still get the mouseover and press effects, but they're rather
useful, I think.

John


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