/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all <standard< wxWindows headers
#ifndef WX_PRECOMP
- #include <wx/wx.h>
+ #include "wx/wx.h"
- #include <wx/log.h>
+ #include "wx/log.h"
#endif
#include "wx/caret.h"
// ressources
// ----------------------------------------------------------------------------
// the application icon
-#if defined(__WXGTK__) || defined(__WXMOTIF__)
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__)
#include "mondrian.xpm"
#endif
// would use GetUpdateRegion() and iterate over rectangles it contains
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
+ wxCaretSuspend cs(this);
wxPaintDC dc( this );
PrepareDC( dc );
dc.Clear();
void MyCanvas::OnChar( wxKeyEvent &event )
{
- bool refresh = FALSE;
-
switch ( event.KeyCode() )
{
case WXK_LEFT:
default:
if ( !event.AltDown() && wxIsprint(event.KeyCode()) )
{
- CharAt(m_xCaret, m_yCaret) = (wxChar)event.KeyCode();
- NextChar();
+ wxChar ch = (wxChar)event.KeyCode();
+ CharAt(m_xCaret, m_yCaret) = ch;
+
+ wxCaretSuspend cs(this);
+ wxClientDC dc(this);
+ dc.SetFont(m_font);
+ dc.SetBackgroundMode(wxSOLID); // overwrite old value
+ dc.DrawText(ch, m_xMargin + m_xCaret * m_widthChar,
+ m_yMargin + m_yCaret * m_heightChar );
- refresh = TRUE;
+ NextChar();
}
else
{
}
DoMoveCaret();
-
- if ( refresh )
- Refresh();
}