wxCaret now uses backing store instead of forcing window refresh each time the

caret is hidden; the non blinking carets work too


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-09-22 22:44:34 +00:00
parent 64d452a82d
commit f4b8bf2fd1
4 changed files with 89 additions and 38 deletions

View File

@@ -358,6 +358,7 @@ void MyCanvas::OnSize( wxSizeEvent &event )
// 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();
@@ -382,8 +383,6 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
void MyCanvas::OnChar( wxKeyEvent &event )
{
bool refresh = FALSE;
switch ( event.KeyCode() )
{
case WXK_LEFT:
@@ -418,10 +417,17 @@ void MyCanvas::OnChar( wxKeyEvent &event )
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;
refresh = TRUE;
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 );
NextChar();
}
else
{
@@ -430,8 +436,5 @@ void MyCanvas::OnChar( wxKeyEvent &event )
}
DoMoveCaret();
if ( refresh )
Refresh();
}