fix for wxMSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-08-01 22:17:11 +00:00
parent 23a54e14a7
commit 4ee14879f2

View File

@@ -105,7 +105,6 @@ public:
void OnChar( wxKeyEvent &event ); void OnChar( wxKeyEvent &event );
private: private:
wxCaret m_caret;
wxFont m_font; wxFont m_font;
// the margin around the text (looks nicer) // the margin around the text (looks nicer)
@@ -276,14 +275,15 @@ MyCanvas::MyCanvas( wxWindow *parent )
m_heightChar = dc.GetCharHeight(); m_heightChar = dc.GetCharHeight();
m_widthChar = dc.GetCharWidth(); 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_xCaret = m_yCaret =
m_xChars = m_yChars = 0; m_xChars = m_yChars = 0;
m_xMargin = m_yMargin = 5; m_xMargin = m_yMargin = 5;
m_caret.Move(m_xMargin, m_yMargin); caret->Move(m_xMargin, m_yMargin);
m_caret.Show(); caret->Show();
} }
MyCanvas::~MyCanvas() MyCanvas::~MyCanvas()
@@ -303,10 +303,15 @@ void MyCanvas::OnSize( wxSizeEvent &event )
free(m_text); free(m_text);
m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar)); m_text = (wxChar *)calloc(m_xChars * m_yChars, sizeof(wxChar));
wxFrame *frame = wxDynamicCast(GetParent(), wxFrame);
if ( frame && frame->GetStatusBar() )
{
wxString msg; wxString msg;
msg.Printf(_T("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); frame->SetStatusText(msg, 1);
}
event.Skip(); event.Skip();
} }
@@ -382,7 +387,7 @@ void MyCanvas::OnChar( wxKeyEvent &event )
wxLogStatus(_T("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, GetCaret()->Move(m_xMargin + m_xCaret * m_widthChar,
m_yMargin + m_yCaret * m_heightChar); m_yMargin + m_yCaret * m_heightChar);
Refresh(); Refresh();