void OnChar( wxKeyEvent &event );
private:
- wxCaret m_caret;
wxFont m_font;
// the margin around the text (looks nicer)
m_heightChar = dc.GetCharHeight();
m_widthChar = dc.GetCharWidth();
- m_caret.Create( this, m_widthChar, m_heightChar );
+ wxCaret *caret = new wxCaret(this, m_widthChar, m_heightChar);
+ SetCaret(caret);
m_xCaret = m_yCaret =
m_xChars = m_yChars = 0;
m_xMargin = m_yMargin = 5;
- m_caret.Move(m_xMargin, m_yMargin);
- m_caret.Show();
+ caret->Move(m_xMargin, m_yMargin);
+ caret->Show();
}
MyCanvas::~MyCanvas()
free(m_text);
m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar));
- wxString msg;
- msg.Printf(_T("Panel size is (%d, %d)"), m_xChars, m_yChars);
+ wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
+
+ if ( frame && frame->GetStatusBar() )
+ {
+ wxString msg;
+ msg.Printf(_T("Panel size is (%d, %d)"), m_xChars, m_yChars);
- ((wxFrame *)GetParent())->SetStatusText(msg, 1);
+ frame->SetStatusText(msg, 1);
+ }
event.Skip();
}
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);
+ GetCaret()->Move(m_xMargin + m_xCaret * m_widthChar,
+ m_yMargin + m_yCaret * m_heightChar);
Refresh();
}