태터데스크 관리자

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

태터데스크 메시지

저장하였습니다.

Search results for '지적유희/gtkmm'

gtkmm + Glade3 을 이용한 간단한 예제 프로그램.

2008/04/27 00:00
참고페이지 ->

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  같은 것들.
크리에이티브 커먼즈 라이선스
Creative Commons License

유리한 지적유희/gtkmm gtkmm

  1. Blog Icon
    루나

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

  2. 댓글에 성의좀..ㅠㅜ

  3. Blog Icon
    zin
  4. 우분투에서 해 보면 재밌겠당;;

    오사카 들렀다감~~

gtkmm 시작하기 - 개발환경 구축

2008/04/26 22:53



본인의 개발환경 -

Windows XP 32Bit.
MSVC8 (2005)


예전같았으면 mingw로 우기고 나갔겠지만

그냥 디버깅이 용이한 msvc로 간다.


GTK+ 설치 -

http://gladewin32.sourceforge.net/

GTK+ 와 glade3 등 통합 버전이다.

glade3는 gui 툴로서 사용자가 생성한 UI를 XML로 추출해준다.

UI는 코드로 작성하지 않고 glade를 이용할 계획이다.



gtkmm 설치 -

http://gtkmm.org/download.shtml


win32버전의 경우 2008년 4월 26일 현재
http://ftp.gnome.org/pub/gnome/binaries/win32/gtkmm/2.10/
http://ftp.gnome.org/pub/gnome/binaries/win32/gtkmm/2.10/gtkmm-win32-devel-2.10.11-1.exe
가 가장 최신이다.



MSVC8 설정 -

이것도 직접 설명하기보다는 링크를 보는게 좋을듯.

http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/sec-visual-studio-new-project.html#figure-msvc-new-project



샘플코드 -

#include <gtkmm.h>

int main(int argc, char *argv[])
{
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    Gtk::Main::run(window);    
    return 0;
}


혹여나 Compile할때 cairo.lib 를 못찾는 경우가있다.
정확히 말하자면 cairo.lib가 없다.


http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo-dev-1.6.4-1.zip





앞으로 참고할 페이지들..


http://gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/index.html

http://magazin.c-plusplus.de/artikel/GTKmm%20Tutorial%20Teil%201

http://www.pebble.org.uk/programming/libglademm_simple

크리에이티브 커먼즈 라이선스
Creative Commons License

유리한 지적유희/gtkmm gtkmm

gtkmm를 시작하며.

2008/04/26 21:03




참고 -

이 카테고리는
한글번역이나 강좌를 목적으로 시작하는것이 아니며,
개인적인 공부를 위해 쓰여질 것이다.

굳이 이유를 말하자면 본인도 이제 막 시작하는 단계이고
남을 가르칠 능력도, 번역할 만한 영어실력도 없다.

허나, 조금이나마 정보공유 혹은 차후를 위해 최대한 친절하게 포스팅 할 계획임을 밝혀둔다.






공식 사이트 - http://gtkmm.org

gtkmm is the official C++ interface for the popular GUI library GTK+. Highlights include typesafe callbacks, and a comprehensive set of widgets that are easily extensible via inheritance. You can create user interfaces either in code or with the Glade User Interface designer, using libglademm. There's extensive documentation, including API reference and a tutorial.

gtkmm is free software distributed under the GNU Library General Public License (LGPL).

gtkmm follows the official GNOME Platform Bindings release schedule. This guarantees API/ABI-stability and new releases on a predictable schedule, delivering C++ API for the underlying GTK+ and GNOME APIs as soon as possible.


다른거 업ㅂ고 GTK+를 C++로 바인딩한것이 GTK-- 이다.
간단히 gtkmm 으로 부른다.


GTK+에 대한 내용은 내가 직접 서술하는것보다는

http://www.gnome.or.kr/web/default/58

를 참고하길 바라며,

기본적인 GTK+ 튜토리얼은

http://wiki.kldp.org/wiki.php/LinuxdocSgml/GtkTutorial-TRANS
(한글, but 1.x)

를 참고하거나

http://library.gnome.org/devel/gtk-tutorial/stable/
(영문, 2.0)

를 참고하라.

아쉽게도 한글번역은 1.x버전이고,

영문은 2.0 을 기준으로 쓰여졌다.

(물론 본인도 말했다시피 시작하는 단계라 제대로 읽어보지는 않았다.)


크리에이티브 커먼즈 라이선스
Creative Commons License

유리한 지적유희/gtkmm gtkmm

  1. Blog Icon
    Only

    나좀가르쳐줏메♡