#include "wx/wx.h"
#endif
+#ifndef __WXMSW__
+ #include "../sample.xpm"
+#endif
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
m_inputWin(NULL),
m_skip(true)
{
+ SetIcon(wxICON(sample));
+
// IDs for menu items
enum
{
" RawKeyCode RawKeyFlags");
- m_logText = new wxTextCtrl(this, wxID_ANY, "",
+ m_logText = new wxTextCtrl(this, wxID_ANY, "",
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL);
// set monospace font to have output in nice columns
- wxFont font(10, wxFONTFAMILY_TELETYPE,
+ wxFont font(10, wxFONTFAMILY_TELETYPE,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
headerText->SetFont(font);
m_logText->SetFont(font);
Connect(SkipID, wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler(MyFrame::OnSkip));
- // connect event handlers for the blue input window
+ // connect event handlers for the blue input window
m_inputWin->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(MyFrame::OnKeyDown),
NULL, this);
m_inputWin->Connect(wxEVT_KEY_UP, wxKeyEventHandler(MyFrame::OnKeyUp),
NULL, this);
m_inputWin->Connect(wxEVT_CHAR, wxKeyEventHandler(MyFrame::OnChar),
NULL, this);
- m_inputWin->Connect(wxEVT_PAINT,
+ m_inputWin->Connect(wxEVT_PAINT,
wxPaintEventHandler(MyFrame::OnPaintInputWin),
NULL, this);
font.SetPointSize(font.GetPointSize() + 2);
dc.SetFont(font);
- dc.DrawLabel("Press keys here",
+ dc.DrawLabel("Press keys here",
m_inputWin->GetClientRect(), wxALIGN_CENTER);
}
switch ( keycode )
{
#define WXK_(x) \
- case WXK_##x: return #x;
+ case WXK_##x: return #x;
WXK_(BACK)
WXK_(TAB)
WXK_(NUMPAD_DECIMAL)
WXK_(NUMPAD_DIVIDE)
#undef WXK_
- default:
- return NULL;
+ default:
+ return NULL;
}
}
void MyFrame::LogEvent(const wxString& name, wxKeyEvent& event)
{
wxString msg;
- // event key_name KeyCode modifiers Unicode raw_code raw_flags
+ // event key_name KeyCode modifiers Unicode raw_code raw_flags
msg.Printf("%7s %15s %5d %c%c%c%c"
#if wxUSE_UNICODE
"%5d (U+%04x)"
event.ControlDown() ? 'C' : '-',
event.AltDown() ? 'A' : '-',
event.ShiftDown() ? 'S' : '-',
- event.MetaDown() ? 'M' : '-',
+ event.MetaDown() ? 'M' : '-'
#if wxUSE_UNICODE
- event.GetUnicodeKey(),
- event.GetUnicodeKey(),
+ , event.GetUnicodeKey()
+ , event.GetUnicodeKey()
#endif
#ifdef wxHAS_RAW_KEY_CODES
- (unsigned long) event.GetRawKeyCode(),
- (unsigned long) event.GetRawKeyFlags()
+ , (unsigned long) event.GetRawKeyCode()
+ , (unsigned long) event.GetRawKeyFlags()
#endif
);