MyCanvas( wxWindow *parent );
~MyCanvas();
- char& CharAt(int x, int y) { return *(m_text + x + m_xChars * y); }
+ wxChar& CharAt(int x, int y) { return *(m_text + x + m_xChars * y); }
// caret movement
void Home() { m_xCaret = 0; }
int m_xChars, m_yChars;
// the text
- char *m_text;
+ wxChar *m_text;
DECLARE_DYNAMIC_CLASS(MyCanvas)
DECLARE_EVENT_TABLE()
wxDefaultPosition, wxDefaultSize,
wxSUNKEN_BORDER )
{
- m_text = (char *)NULL;
+ m_text = (wxChar *)NULL;
SetBackgroundColour(* wxWHITE);
m_yChars = 1;
free(m_text);
- m_text = (char *)calloc(m_xChars * m_yChars, sizeof(char));
+ m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar));
wxString msg;
- msg.Printf("Panel size is (%d, %d)", m_xChars, m_yChars);
+ msg.Printf(_T("Panel size is (%d, %d)"), m_xChars, m_yChars);
((wxFrame *)GetParent())->SetStatusText(msg, 1);
for ( int x = 0; x < m_xChars; x++ )
{
- char ch = CharAt(x, y);
+ wxChar ch = CharAt(x, y);
if ( !ch )
- ch = ' ';
+ ch = _T(' ');
line += ch;
}
break;
default:
- if ( isprint(event.KeyCode()) )
+ if ( wxIsprint(event.KeyCode()) )
{
- CharAt(m_xCaret, m_yCaret) = (char)event.KeyCode();
+ CharAt(m_xCaret, m_yCaret) = (wxChar)event.KeyCode();
NextChar();
}
else
}
}
- wxLogStatus("Caret is at (%d, %d)", m_xCaret, m_yCaret);
+ wxLogStatus(_T("Caret is at (%d, %d)"), m_xCaret, m_yCaret);
m_caret.Move(m_xMargin + m_xCaret * m_widthChar,
m_yMargin + m_yCaret * m_heightChar);