#include "wx/wx.h"
#define IDB_CLOSE 5001
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
MyFrame(const wxString& title);
void btn_Close_Click(wxCommandEvent& event);
};
DECLARE_APP(MyApp)
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame(wxT("wxWidgets Test"));
frame->Show(true);
return true;
}
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
SetBackgroundColour(wxColor(255,255,255));
wxBoxSizer *box_main = new wxBoxSizer(wxVERTICAL);
wxButton *btn_Close = new wxButton(
this, IDB_CLOSE, wxT("닫기")
);
box_main->Add(btn_Close, 0, wxALL | wxALIGN_CENTER);
SetSizer(box_main);
this->SetSize(500, 300);
this->Center();
Connect(
IDB_CLOSE,
wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(MyFrame::btn_Close_Click)
);
}
void MyFrame::btn_Close_Click(wxCommandEvent& event)
{
Close(true);
}
|