cpp/MainWindow.cpp
author viric <viriketo@gmail.com>
Sun, 13 Feb 2011 08:43:06 +0100
changeset 5 f2a2f64eb682
parent 4 a3d29fb016c3
child 6 66becdcbe5d9
permissions -rw-r--r--
Events don't work as I expect. tab makes save sentence, while enter should be
doing that.
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@5
     8
    EVT_COMMAND (wxID_ANY, ID_SKIP_QUESTION, MainWindow::OnSkipQuestion )
viriketo@5
     9
    EVT_COMMAND (wxID_ANY, ID_SAVE_SENTENCE, MainWindow::OnSaveSentence )
viriketo@5
    10
END_EVENT_TABLE ()
viriketo@5
    11
viriketo@2
    12
MainWindow::MainWindow()
viriketo@5
    13
    :wxFrame(0, wxID_ANY, _("Lingvigilo"), wxDefaultPosition, wxDefaultSize,
viriketo@5
    14
            wxSTAY_ON_TOP)
viriketo@2
    15
{
viriketo@2
    16
    wxBoxSizer *s = new wxBoxSizer(wxVERTICAL);
viriketo@2
    17
    wxStaticText *label = new wxStaticText(this, wxID_ANY,
viriketo@2
    18
            _("Introdueix la frase:"));
viriketo@4
    19
    wxTextBox *text = new wxTextBox(this, wxID_ANY);
viriketo@2
    20
    s->Add(label);
viriketo@2
    21
    s->Add(text);
viriketo@2
    22
viriketo@2
    23
    text->SetFocus();
viriketo@2
    24
viriketo@2
    25
    SetSizerAndFit(s);
viriketo@2
    26
}
viriketo@5
    27
viriketo@5
    28
void
viriketo@5
    29
MainWindow::OnSkipQuestion(wxCommandEvent &e)
viriketo@5
    30
{
viriketo@5
    31
    std::cerr << "Skip Question" << std::endl;
viriketo@5
    32
}
viriketo@5
    33
viriketo@5
    34
void
viriketo@5
    35
MainWindow::OnSaveSentence(wxCommandEvent &e)
viriketo@5
    36
{
viriketo@5
    37
    std::cerr << "Save Sentence" << std::endl;
viriketo@5
    38
}