1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| #include <wx/wxprec.h>
#include <wx/textctrl.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "base.h"
#include <string>
IMPLEMENT_APP(MainApp)
bool MainApp::OnInit()
{
MainFrame *win = new MainFrame("chat", wxPoint (100, 100),
wxSize(450, 340));
win->Show(TRUE);
SetTopWindow(win);
return TRUE;
}
BEGIN_EVENT_TABLE(MainFrame, wxFrame)
EVT_MENU(ID_MAINWIN_QUIT, MainFrame::OnQuit)
EVT_BUTTON(BOUTON_ENVOYER, MainFrame::Envoyer)
END_EVENT_TABLE()
MainFrame::MainFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
: wxFrame((wxFrame *) NULL, -1, title, pos, size)
{
wxTextCtrl *Text = new wxTextCtrl(this, -1, wxEmptyString, wxPoint(0,0), wxSize(450,250), wxTE_MULTILINE);
Text->SetEditable(false);
wxTextCtrl *Form = new wxTextCtrl(this, -1, wxEmptyString, wxPoint(0,250), wxSize(350,30), wxTE_MULTILINE);
Form->SetEditable(true);
wxButton *bouton = new wxButton(this, BOUTON_ENVOYER, "envoyer" , wxPoint(360,250));
}
void MainFrame::OnQuit(wxCommandEvent & WXUNUSED(event))
{
Close(TRUE);
}
void MainFrame::Envoyer(wxCommandEvent & WXUNUSED(event))
{
wxString valeur;
valeur=Form->GetValue();
Text->WriteText(valeur);
} |
Partager