Page principale   Modules   Liste des namespaces   Hiérarchie des classes   Liste des composants   Liste des fichiers   Membres des namespaces   Composants   Déclarations   Pages associées   Exemples  

check_button.cpp

Exemple d'utilisation des check_button

#include <gtk++/gtkcheckbuttons.hpp>
#include <gtk++/gtkwindows.hpp>
#include <gtk++/gtkboxes.hpp>

#ifdef USE_NAMESPACE_STD
using namespace std;
#endif

void FonctionRappel (GtkCheckButton * Bouton, std::string const & Message)
{
  if (lgtkpp::gtk_check_button(Bouton).GetActive())
    std::cout << "Le "<<Message<<" vient d'etre coché" << std::endl;
  else
    std::cout << "Le "<<Message<<" vient d'etre decoché" << std::endl;   
}

int main (int argc, char * argv [])
{
  lgtkpp::gtk_window*       Fenetre;
  lgtkpp::gtk_check_button* Bouton;
  lgtkpp::gtk_box*          Boite;
  std::string LabelBouton1, LabelBouton2;

  ::gtk_init(&argc, &argv);
  Fenetre = new lgtkpp::gtk_window ();
  Fenetre->SetBorderWidth (20);
  
  Boite = new lgtkpp::gtk_box(lgtkpp::horizontal);
  *Fenetre += *Boite;
  
  // Le premier bouton enfoncé au depart
  Bouton = new lgtkpp::gtk_check_button("Bouton 1");
  Bouton->SetActive(true);
  LabelBouton1 ="bouton 1";
  Bouton->SignalConnect("toggled",(GtkSignalFunc)FonctionRappel,&LabelBouton1);
  *Boite += *Bouton;
  
  // Le second bouton relaché au depart
  Bouton = new lgtkpp::gtk_check_button("Bouton 2");
  LabelBouton2 ="bouton 2";
  Bouton->SignalConnect("toggled",(GtkSignalFunc)FonctionRappel,&LabelBouton2);
  *Boite += *Bouton;
  
  Fenetre->ShowAll();
  
  gtk_main();
  
  return 0;
  
}

Généré le Sun Oct 5 15:03:43 2003 pour lightgtk++ par doxygen1.3-rc3