gtkmm + Glade3 을 이용한 간단한 예제 프로그램.
http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/chapter-libglademm.html
실행화면 ->
Glade3 실행 ->
생성된 Glade 파일 ->
사용된 예제 코드 ->
#include "stdafx.h" #include <gtkmm.h> #include <libglademm.h> #include <iostream> #include <windows.h> #include <direct.h>
Gtk::Dialog* pDialog = 0; Glib::ustring g_ustrFilePath;
void on_button_clicked() { if(pDialog) pDialog->hide(); //hide() will cause main::run() to end. }
int main (int argc, char *argv[]) { Gtk::Main kit(argc, argv);
// 현재 실행파일의 경로를 구함. { char buf[256] = {0,}; strncpy(buf, argv[0], strlen(argv[0])-strlen(strrchr(argv[0],'\\'))+1); g_ustrFilePath=buf; }
//Load the Glade file and instiate its widgets: Glib::RefPtr<Gnome::Glade::Xml> refXml; try { refXml = Gnome::Glade::Xml::create(g_ustrFilePath+"test.glade"); } catch(const Gnome::Glade::XmlError& ex) { std::cerr << ex.what() << std::endl; return 1; }
//Get the Glade-instantiated Dialog: refXml->get_widget("DialogBasic", pDialog); if(pDialog) { //Get the Glade-instantiated Button, and connect a signal handler: Gtk::Button* pButton = 0; refXml->get_widget("Exit", pButton); if(pButton) { pButton->signal_clicked().connect( sigc::ptr_fun(on_button_clicked) ); } kit.run(*pDialog); } return 0; }
glade파일과 코드를 함께 보면 그다지 어렵지는 않다.
개념적인 부분은 이미 번역되어있는 GTK+ 문서를 활용하자.
http://wiki.kldp.org/wiki.php/LinuxdocSgml/GtkTutorial-TRANS 같은 것들.


test.glade
댓글.......ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
댓글에 성의좀..ㅠㅜ
성의
우분투에서 해 보면 재밌겠당;;
오사카 들렀다감~~