RE: Colors for buttons



some few corrections
/////////////
GtkWidget *w;
GdkColor couleur={0,65535,0,0}; //RGB values for red
//then we get pointer of our button
//here replace 'window' with a pointer to parent window of ur buttons ;
window should be GtkWidget *
w=(GtkWidget*)gtk_object_get_data(GTK_OBJECT(window,"my_button");
//we get its style
GtkStyle *style=gtk_style_copy(w->style);
//here we set button color for all states possible
//bg stands for bgcolor (cf GtkStyle reference)

style->bg[0] =  couleur;  //NORMAL
      style->bg[1] =  couleur;   //ACTIVE
      style->bg[3] =  couleur;	//PRELIGHT
      style->bg[2] =  couleur;	//SELECTED
      style->bg[4] =  couleur;	//INSENSITIVE*
//finally we change style
gtk_widget_set_style (w, style);
we re done
:D

-----Message d'origine-----
De : Feeser, Stefan [mailto:Stefan Feeser dit de]
Envoyé : lundi 16 septembre 2002 16:32
À : 'gtk-list gnome org'
Objet : Colors for buttons


Hi all,

I am a beginner in gtk-programming. At our linux user group we would like
test which
library/language is the best to learn "widget programming". So we would like
program
a small game. It is called "Senso", a game pad with four great buttons in
four colors.
These buttons you can push after a color was shown...

Now I wrote a code which show me/us these buttons, but whithout color. How
can I
colorize these buttons and is it possible to switch these to a other color
("flash-effect").

Thx

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


*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
SG Asset Management et ses filiales declinent toute responsabilite au titre
de ce message s'il a ete altere, deforme ou falsifie.

Découvrez l'offre et les services de SG Asset Management sur le site
www.sgam.fr 

				********

This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SG Asset Management nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified. 

*************************************************************************



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


*************************************************************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont
confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
SG Asset Management et ses filiales declinent toute responsabilite au titre
de ce message s'il a ete altere, deforme ou falsifie.

Découvrez l'offre et les services de SG Asset Management sur le site
www.sgam.fr 

				********

This message and any attachments (the "message") are confidential and
intended solely for the addressees.
Any unauthorised use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SG Asset Management nor any of its subsidiaries or affiliates shall
be liable for the message if altered, changed or falsified. 

*************************************************************************






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