cpp/MainWindow.cpp
author viric <viriketo@gmail.com>
Sun, 13 Feb 2011 22:51:39 +0100
changeset 6 66becdcbe5d9
parent 5 f2a2f64eb682
permissions -rw-r--r--
Ara em va allò dels events
#include <wx/wx.h>
#include <wx/image.h>
#include <iostream>
#include "MainWindow.hpp"
#include "TextBox.hpp"

BEGIN_EVENT_TABLE (MainWindow, wxFrame)
    EVT_COMMAND (wxID_ANY, EV_SKIP_QUESTION, MainWindow::OnSkipQuestion )
    EVT_COMMAND (wxID_ANY, EV_SAVE_SENTENCE, MainWindow::OnSaveSentence )
END_EVENT_TABLE ()

DEFINE_EVENT_TYPE(EV_SKIP_QUESTION)
DEFINE_EVENT_TYPE(EV_SAVE_SENTENCE)


MainWindow::MainWindow()
    :wxFrame(0, wxID_ANY, _("Lingvigilo"), wxDefaultPosition, wxDefaultSize,
            wxSTAY_ON_TOP)
{
    wxBoxSizer *s = new wxBoxSizer(wxVERTICAL);
    wxStaticText *label = new wxStaticText(this, wxID_ANY,
            _("Introdueix la frase:"));
    wxTextBox *text = new wxTextBox(this, wxID_ANY);
    s->Add(label);
    s->Add(text);

    text->SetFocus();

    SetSizerAndFit(s);
}

void
MainWindow::OnSkipQuestion(wxCommandEvent &e)
{
    std::cerr << "Skip Question" << std::endl;
}

void
MainWindow::OnSaveSentence(wxCommandEvent &e)
{
    std::cerr << "Save Sentence" << std::endl;
}