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
viriketo@2
     1
#include <wx/wx.h>
viriketo@2
     2
#include <wx/image.h>
viriketo@5
     3
#include <iostream>
viriketo@2
     4
#include "MainWindow.hpp"
viriketo@4
     5
#include "TextBox.hpp"
viriketo@2
     6
viriketo@5
     7
BEGIN_EVENT_TABLE (MainWindow, wxFrame)
viriketo@6
     8
    EVT_COMMAND (wxID_ANY, EV_SKIP_QUESTION, MainWindow::OnSkipQuestion )
viriketo@6
     9
    EVT_COMMAND (wxID_ANY, EV_SAVE_SENTENCE, MainWindow::OnSaveSentence )
viriketo@5
    10
END_EVENT_TABLE ()
viriketo@5
    11
viriketo@6
    12
DEFINE_EVENT_TYPE(EV_SKIP_QUESTION)
viriketo@6
    13
DEFINE_EVENT_TYPE(EV_SAVE_SENTENCE)
viriketo@6
    14
viriketo@6
    15
viriketo@2
    16
MainWindow::MainWindow()
viriketo@5
    17
    :wxFrame(0, wxID_ANY, _("Lingvigilo"), wxDefaultPosition, wxDefaultSize,
viriketo@5
    18
            wxSTAY_ON_TOP)
viriketo@2
    19
{
viriketo@2
    20
    wxBoxSizer *s = new wxBoxSizer(wxVERTICAL);
viriketo@2
    21
    wxStaticText *label = new wxStaticText(this, wxID_ANY,
viriketo@2
    22
            _("Introdueix la frase:"));
viriketo@4
    23
    wxTextBox *text = new wxTextBox(this, wxID_ANY);
viriketo@2
    24
    s->Add(label);
viriketo@2
    25
    s->Add(text);
viriketo@2
    26
viriketo@2
    27
    text->SetFocus();
viriketo@2
    28
viriketo@2
    29
    SetSizerAndFit(s);
viriketo@2
    30
}
viriketo@5
    31
viriketo@5
    32
void
viriketo@5
    33
MainWindow::OnSkipQuestion(wxCommandEvent &e)
viriketo@5
    34
{
viriketo@5
    35
    std::cerr << "Skip Question" << std::endl;
viriketo@5
    36
}
viriketo@5
    37
viriketo@5
    38
void
viriketo@5
    39
MainWindow::OnSaveSentence(wxCommandEvent &e)
viriketo@5
    40
{
viriketo@5
    41
    std::cerr << "Save Sentence" << std::endl;
viriketo@5
    42
}