Created
January 12, 2014 02:44
-
-
Save zedtux/8380072 to your computer and use it in GitHub Desktop.
Créer simplement une interface GTK en C++ - Mise a jour du hello.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include “hello.h” | |
Hello::Hello(BaseObjectType* cobject, const Glib::RefPtr& refGlade) | |
: Gtk::Window(cobject), | |
m_refXmlGlade(refGlade), | |
m_buttonQuit(0) | |
{ | |
//~ On pointe, dans le fichier glade, sur le bouton “button1″ | |
m_refXmlGlade->get_widget(“button1″, m_buttonQuit); | |
if ( m_buttonQuit ) | |
{ | |
//~ Ici on créer le lien vers notre methode on_button_quit() de notre objet Hello. | |
m_buttonQuit->signal_clicked().connect( sigc::mem_fun(*this, &Hello::on_button_quit) ); | |
} else { | |
std::cerr << "Unable to hook the Quit button !" << std::endl; | |
} | |
} | |
Hello::~Hello() | |
{ | |
} | |
//~ Et voici la méthode on_button_quit() qui sera appelé par le signal clicked() tu bouton. | |
void Hello::on_button_quit() | |
{ | |
//~ Et donc, on appelle la méthode hide() de Gtk::Window par héritage | |
hide(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment