Skip to content

WxWidgets:FirstProgram

첫 번째 wxWidget 프로그램 샘플 프로그램은 아래와 같다.

#include <wx/wx.h>

class Simple: public wxFrame
{
public:
    Simple(const wxString& title) :
            wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
    {
        Centre();
    }
};

class MyApp: public wxApp
{
public:
    virtual bool OnInit()
    {
        Simple *simple = new Simple(wxT("Simple"));
        simple->Show(true);

        return true;
    }
};

IMPLEMENT_APP(MyApp)

참고로 main() 함수는 wxWidgets의 라이브러리 내부에 이미 포함되어 있다.

Favorite site