X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a8f2578758be3956d1cb55503c8cb773c7c96322..1fd8a4504da7215d889e3e6234476581b0ba7adf:/src/msw/caret.cpp diff --git a/src/msw/caret.cpp b/src/msw/caret.cpp index a6fbf35525..dec7d89ea5 100644 --- a/src/msw/caret.cpp +++ b/src/msw/caret.cpp @@ -30,6 +30,7 @@ #ifndef WX_PRECOMP #include "wx/window.h" + #include "wx/log.h" #endif // WX_PRECOMP #include "wx/caret.h" @@ -59,10 +60,14 @@ int wxCaretBase::GetBlinkTime() //static void wxCaretBase::SetBlinkTime(int milliseconds) { +#ifdef __WIN16__ + ::SetCaretBlinkTime(milliseconds) ; +#else if ( !::SetCaretBlinkTime(milliseconds) ) { wxLogLastError("SetCaretBlinkTime"); } +#endif } // --------------------------------------------------------------------------- @@ -71,11 +76,15 @@ void wxCaretBase::SetBlinkTime(int milliseconds) bool wxCaret::MSWCreateCaret() { - wxASSERT_MSG( GetWindow(), "caret without window cannot be created" ); - wxASSERT_MSG( IsOk(), "caret of zero size cannot be created" ); + wxASSERT_MSG( GetWindow(), _T("caret without window cannot be created") ); + wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be created") ); if ( !m_hasCaret ) { +#ifdef __WIN16__ + ::CreateCaret(GetWinHwnd(GetWindow()), 0, m_width, m_height) ; + m_hasCaret = TRUE; +#else if ( !::CreateCaret(GetWinHwnd(GetWindow()), 0, m_width, m_height) ) { wxLogLastError("CreateCaret"); @@ -84,6 +93,7 @@ bool wxCaret::MSWCreateCaret() { m_hasCaret = TRUE; } +#endif } return m_hasCaret; @@ -111,10 +121,14 @@ void wxCaret::OnKillFocus() { m_hasCaret = FALSE; +#ifdef __WIN16__ + ::DestroyCaret() ; +#else if ( !::DestroyCaret() ) { wxLogLastError("DestroyCaret"); } +#endif } } @@ -124,27 +138,36 @@ void wxCaret::OnKillFocus() void wxCaret::DoShow() { - wxASSERT_MSG( GetWindow(), "caret without window cannot be shown" ); - wxASSERT_MSG( IsOk(), "caret of zero size cannot be shown" ); + wxASSERT_MSG( GetWindow(), _T("caret without window cannot be shown") ); + wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be shown") ); if ( !m_hasCaret ) { (void)MSWCreateCaret(); } +#ifdef __WIN16__ + ::ShowCaret(GetWinHwnd(GetWindow())) ; +#else if ( !::ShowCaret(GetWinHwnd(GetWindow())) ) { wxLogLastError("ShowCaret"); } +#endif } void wxCaret::DoHide() { - wxASSERT_MSG( m_hasCaret, "cannot hide non existent caret" ); - - if ( !::HideCaret(GetWinHwnd(GetWindow())) ) + if ( m_hasCaret ) { - wxLogLastError("HideCaret"); +#ifdef __WIN16__ + ::HideCaret(GetWinHwnd(GetWindow())) ; +#else + if ( !::HideCaret(GetWinHwnd(GetWindow())) ) + { + wxLogLastError("HideCaret"); + } +#endif } } @@ -156,10 +179,14 @@ void wxCaret::DoMove() { if ( m_hasCaret ) { +#ifdef __WIN16__ + ::SetCaretPos(m_x, m_y) ; +#else if ( !::SetCaretPos(m_x, m_y) ) { wxLogLastError("SetCaretPos"); } +#endif } //else: we don't have caret right now, nothing to do (this does happen) }