#include <iostream>

#include "A02_F01.h"

IMPLEMENT_APP(MyApp)

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
   EVT_BUTTON(wxID_OK, MyFrame::OnShow)
   EVT_BUTTON(wxID_EXIT, MyFrame::OnExit)
END_EVENT_TABLE()


bool MyApp::OnInit()
{
   MyFrame *frame = new MyFrame(wxT("Primer ejemplo"));
   
   frame->Show(true);
   
   return true;
}


MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title)
{
   btnShow = new wxButton(this, wxID_OK, 
			  wxString::FromUTF8("&Mostrar"), wxPoint(75,175), wxDefaultSize);
   btnExit = new wxButton(this, wxID_EXIT, 
			  wxString::FromUTF8("&Salir"), wxPoint(250,175), wxDefaultSize);
   label = new wxStaticText(this, wxID_ANY, 
			    wxString::FromUTF8(""), wxPoint(75,50), wxSize(200,75), 
			    wxALIGN_CENTER | wxST_NO_AUTORESIZE);
   label->SetFont(wxFont(26, wxFONTFAMILY_SWISS, wxITALIC, wxBOLD, false));
}

void MyFrame::OnShow(wxCommandEvent& event)
{
  wxString wola = wxString::FromUTF8("¡Hola Mundo!");
  label->SetLabel(wola);
}

void MyFrame::OnExit(wxCommandEvent& event)
{
   Close();
}