TR: how to set a button's background?



unsubscribe

-----Message d'origine-----
De?: Jean-Christophe Berthon [mailto:jean-christophe berthon cgey com]
Envoye?: lundi 21 janvier 2002 12:01
A?: 6@<y Kason Huang; Gtk List
Objet?: Re: how to set a button's background?


how to set a button's background?Hello,

I'm using this method to paint the background of a CList cell in a different
color, maybe you can apply that to your case :

 GdkColor   xColor;
 GdkColormap     *pxColorMap;

 /* Get the colormap from the GtkCList object */
 pxColorMap = gtk_widget_get_colormap(GTK_WIDGET(lstGtkCList_E));

 /* Create a new color : Red-Orange-ish */
 xColor.red  = 61696;
 xColor.green = 52736;
 xColor.blue  = 45312;

 /* Alloc the new color to the colormap */
 gdk_colormap_alloc_color(pxColorMap, &xColor, FALSE, TRUE);

 /* Set back the colormap to my GtkCList object */
 gtk_widget_set_colormap(GTK_WIDGET(lstGtkCList_E), pxColorMap);

 /* Get a copy of a default style and customize it */
 pxUndetStyle = gtk_style_copy(gtk_widget_get_default_style());
 pxUndetStyle->base[GTK_STATE_NORMAL] = xColor;
 pxUndetStyle->base[GTK_STATE_ACTIVE] = xColor;
 pxUndetStyle->base[GTK_STATE_PRELIGHT] = xColor;
 pxUndetStyle->base[GTK_STATE_SELECTED] = xColor;
 pxUndetStyle->base[GTK_STATE_INSENSITIVE] = xColor;

 gtk_style_ref(pxUndetStyle);

 /* Apply this style to the cell */
 gtk_clist_set_cell_style(lstGtkCList_E, i, j, pxUndetStyle);

 /* But you can use for your case :
gtk_widget_set_style(GTK_WIDGET(Your_GtkButton_Object), pxCustom_Style); */



Best regards,
---
Jean-Christophe Berthon

Cap Gemini -- Ernst & Young
France
Skill IS -- Image Quality
Email: Jean-Christophe Berthon cgey com
Tel: (+33) 561 31 6671


----- Original Message -----
From: ¶À¼y Kason Huang
To: gtk-list gnome org
Sent: Monday, January 21, 2002 6:44 AM
Subject: how to set a button's background?


hello,hi:
        could anyone tell me how to set a button's background?
when the button get focus(with updown key in the keyboard),how to let the
button's background being red or other color?
_______________________________________________ gtk-list mailing list
gtk-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-list

_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list

This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status.  Please notify us immediately by reply e-mail and then delete this message from your system.  Please do not copy it or use it for any purposes, or disclose its contents to any other person:  to do so could be a breach of confidence.  Thank you for your co-operation.  Please contact our
IT Helpdesk on +44 (0) 20 7936 4000 Ext.2000 or email ITHelp freshfields com if you need assistance.









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