乐者为王

Do one thing, and do it well.

Hello wxWidgets!

MainApp.h代码:

1
2
3
4
5
6
7
8
9
10
11
12
#ifndef __MAINAPP_H__
#define __MAINAPP_H__

#include <wx/wx.h>

class MainApp : public wxApp
{
public:
    virtual bool OnInit();
};

#endif

MainApp.cpp代码:

1
2
3
4
5
6
7
8
9
10
11
12
#include "MainApp.h"
#include "MainFrame.h"

IMPLEMENT_APP(MainApp)

bool MainApp::OnInit()
{
    MainFrame* frame = new MainFrame("Hello wxWidgets!");
    SetTopWindow(frame);
    frame->Show();
    return true;
}

MainFrame.h代码:

1
2
3
4
5
6
7
8
9
10
11
12
#ifndef __MAINFRAME_H__
#define __MAINFRAME_H__

#include <wx/frame.h>

class MainFrame : public wxFrame
{
public:
    MainFrame(const wxString& title);
};

#endif

MainFrame.cpp代码:

1
2
3
4
5
6
#include "MainFrame.h"

MainFrame::MainFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title)
{
    // TODO: add member initialization code here
}

Comments