class MyMessage:public wxFrame
{
public:
MyMessage(const wxString& title);
protected:
void ShowInfo(wxCommandEvent& event);
void ShowError(wxCommandEvent& event);
void ShowQuestion(wxCommandEvent& event);
void ShowAlert(wxCommandEvent& event);
};
MyMessage::MyMessage(const wxString& title)
:wxFrame(NULL,-1,title)
{
wxPanel* panel = new wxPanel(this,-1);
wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL);
wxGridSizer* gs = new wxGridSizer(2,2,2,2);
wxButton* btnInfo = new wxButton(panel,-1,"Info");
wxButton* btnError = new wxButton(panel,-1,"Error");
wxButton* btnQuestion = new wxButton(panel,-1,"Question");
wxButton* btnAlert = new wxButton(panel,-1,"Exclamation");
Bind(wxEVT_COMMAND_BUTTON_CLICKED,MyMessage::ShowInfo,this,btnInfo->GetId());
Bind(wxEVT_COMMAND_BUTTON_CLICKED,MyMessage::ShowError,this,btnError->GetId());
Bind(wxEVT_COMMAND_BUTTON_CLICKED,MyMessage::ShowQuestion,this,btnQuestion->GetId());
Bind(wxEVT_COMMAND_BUTTON_CLICKED,MyMessage::ShowAlert,this,btnAlert->GetId());
gs->Add(btnInfo,1,wxEXPAND);
gs->Add(btnError,1);
gs->Add(btnQuestion,1);
gs->Add(btnAlert,1);
hbox->Add(gs,0,wxALL,15);
panel->SetSizer(hbox);
Center();
}
void MyMessage::ShowInfo(wxCommandEvent& event)
{
wxMessageDialog* dial = new wxMessageDialog(NULL,"DownLoad completed","Info",wxOK);
dial->ShowModal();
}
void MyMessage::ShowError(wxCommandEvent& event)
{
wxMessageDialog* dial = new wxMessageDialog(NULL,"Error","error",wxOK|wxICON_ERROR);
dial->ShowModal();
}
void MyMessage::ShowQuestion(wxCommandEvent& event)
{
wxMessageDialog* dial = new wxMessageDialog(NULL,"Are you sure?","Quesstion",
wxYES_NO|wxNO_DEFAULT|wxICON_QUESTION);
dial->ShowModal();
}
void MyMessage::ShowAlert(wxCommandEvent& event)
{
wxMessageDialog* dial = new wxMessageDialog(NULL,wxT("警告"),"Exclamation",
wxOK|wxICON_EXCLAMATION);
dial->ShowModal();
}