태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

참고페이지 ->

http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/chapter-libglademm.html


실행화면 ->

사용자 삽입 이미지









Glade3 실행 ->

사용자 삽입 이미지


생성된 Glade 파일 ->





사용된 예제 코드 ->

 1 #include "stdafx.h"
 2
 3 #include <gtkmm.h>
 4 #include <libglademm.h>
 5 #include <iostream>
 6 #include <windows.h>
 7 #include <direct.h>
 8
 9
10 Gtk::Dialog* pDialog = 0;
11 Glib::ustring g_ustrFilePath;
12
13 void on_button_clicked()
14 {
15     if(pDialog)
16         pDialog->hide(); //hide() will cause main::run() to end.      
17 }
18
19 int main (int argc, char *argv[])
20 {
21     Gtk::Main kit(argc, argv);
22
23     // 현재 실행파일의 경로를 구함.
24     {
25         char buf[256] = {0,};
26         strncpy(buf, argv[0], strlen(argv[0])-strlen(strrchr(argv[0],'\\'))+1);
27         g_ustrFilePath=buf;
28     }
29
30     //Load the Glade file and instiate its widgets:
31     Glib::RefPtr<Gnome::Glade::Xml> refXml;
32     try
33     {
34         refXml = Gnome::Glade::Xml::create(g_ustrFilePath+"test.glade");      
35     }
36     catch(const Gnome::Glade::XmlError& ex)
37     {
38         std::cerr << ex.what() << std::endl;
39         return 1;
40     }
41     //Get the Glade-instantiated Dialog:
42     refXml->get_widget("DialogBasic", pDialog);
43     if(pDialog)
44     {
45         //Get the Glade-instantiated Button, and connect a signal handler:
46         Gtk::Button* pButton = 0;
47         refXml->get_widget("Exit", pButton);
48         if(pButton)
49         {
50             pButton->signal_clicked().connect( sigc::ptr_fun(on_button_clicked) );          
51         }
52         kit.run(*pDialog);
53     }
54     return 0;
55 }
56
57



glade파일과 코드를 함께 보면 그다지 어렵지는 않다.

개념적인 부분은 이미 번역되어있는 GTK+ 문서를 활용하자.

http://wiki.kldp.org/wiki.php/LinuxdocSgml/GtkTutorial-TRANS  같은 것들.
이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
TAG

trackback :: http://www.yurihan.net/trackback/37

comment

  1. 루나 2008/04/27 00:49  address  modify  write

    댓글.......ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ

  2. zin 2008/05/08 23:37  address  modify  write

    성의

  3. 최준열 2008/05/16 18:33  address  modify  write

    우분투에서 해 보면 재밌겠당;;

    오사카 들렀다감~~