WxWidgets Hellow World

简介:
/*
 * hworld.cpp
 * Hello world sample by Robert Roebling
 
*/


#include 
" wx/wx.h "  

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

class  MyFrame:  public  wxFrame
{
public:

    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);

    void OnQuit(wxCommandEvent& event);
    void OnAbout(wxCommandEvent& event);

    DECLARE_EVENT_TABLE()
}
;

enum
{
    ID_Quit = 1,
    ID_About,
}
;

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
    EVT_MENU(ID_Quit, MyFrame::OnQuit)
    EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()

IMPLEMENT_APP(MyApp)

bool  MyApp::OnInit()
{
    MyFrame *frame = new MyFrame( _T("Hello World"), wxPoint(50,50), wxSize(450,340) );
    frame->Show(TRUE);
    SetTopWindow(frame);
    return TRUE;
}
 

MyFrame::MyFrame(
const  wxString &  title,  const  wxPoint &  pos,  const  wxSize &  size)
: wxFrame((wxFrame 
* )NULL,  - 1 , title, pos, size)
{
    wxMenu *menuFile = new wxMenu;

    menuFile->Append( ID_About, _T("&About") );
    menuFile->AppendSeparator();
    menuFile->Append( ID_Quit, _T("E&xit") );

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append( menuFile, _T("&File") );

    SetMenuBar( menuBar );

    CreateStatusBar();
    SetStatusText( _T("Welcome to wxWindows!") );
}


void  MyFrame::OnQuit(wxCommandEvent &  WXUNUSED( event ))
{
    Close(TRUE);
}


void  MyFrame::OnAbout(wxCommandEvent &  WXUNUSED( event ))
{
    wxMessageBox(_T("This is a wxWindows Hello world sample"),
        _T("About Hello World"), wxOK | wxICON_INFORMATION, this);
}

目录
相关文章
|
9月前
|
数据可视化
【Qt】—— Hello World程序的实现
【Qt】—— Hello World程序的实现
|
Rust JavaScript 前端开发
Rust 安装和 Hello World
Rust 是一门赋予每个人构建可靠且高效软件能力的语言。 本文介绍了 Rust 环境的安装,以及实现一个 Hello World。
249 0
|
9月前
|
算法 编译器 C语言
C++语言的“Hello World”
C++语言的“Hello World”
93 0
【QT学习】搭建环境+hello world
作者:gnuhpc 出处:http://www.cnblogs.com/gnuhpc/ 绝对是被迫学习QT,本来不想看这些东西来着,志不在此,不过实验室的项目用到,想到以后万一哪天想去写一个Linux下的小程序,弄个GUI看起来也蛮不错的。
1081 0
|
5月前
|
Rust Windows
rust hello world
rust hello world

热门文章

最新文章