SV: [gtk-list] Re: How do I get the color.... Thanks ...



Thanks!!

Now I only have one problem left....   On this button im using a frame with the picture inside ....  The label of the frame comes vith a light gray background that is verry nice when the button i active ...  But is verry wrong when the button i inactive ..  How do i get this labelbackroud transparent

//Klas
-----Ursprungligt meddelande-----
Från: Tom Bech <tomb@ii.uib.no>
Till: gtk-list@redhat.com <gtk-list@redhat.com>
Datum: den 20 maj 1998 23:44
Ämne: [gtk-list] Re: How do I get the color....


>Klas Bengtsson wrote:
>> 
>> I am using images on buttons instead of text...  My problem i that my picture (.xpm file)
>> has a white background ang  gtk buttons are gray...  I tried to set style-> whith in the
>> *gtk_colour field of pixmap...  Pleaze .....Help ...
>> 
>
>(This should probably go into the FAQ soon)
>
>You need to set the background color of your .xpm file to transparent. You can do this by
>loading the .xpm file into a text editor and make sure it looks something like this:
>(Red rectangle on transparent color)
>
>/* XPM */
>static char *test[] = {
>/* width height num_colors chars_per_pixel */
>"    8    8       2            1",
>/* colors */
>". c None",
>"# c #ff0000",
>/* pixels */
>"........",
>"........",
>"..####..",
>"..####..",
>"..####..",
>"..####..",
>"........",
>"........"
>};
>
>So, find your background color string and set its corresponding color to "None".
>
>Now, in the code (look at testgtk.c for example) you do:
>
>..
>
>GtkWidget *button;
>GdkPixmap *pixmap;
>GdkBitmap *bitmap;
>GtkStyle *style;
>gchar *xpm_filename;
>
>..
>
>style = gtk_widget_style (button);
>pixmap = gdk_pixmap_create_from_xpm (
>  button->window,
>  &pixmap_mask,
>  style->bg[GTK_STATE_NORMAL]
>  xpm_filename);
>
>..
>
>
>Hope this helps.
>
>Tom
>
>--
>
>tomb@gimp.org
>
>-- 
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>



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