X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c6eba8f8b204b0d722db0007e3e0d5e2d2d20085..ef609210f1656775cbbd09e45d36e2abb90e47d5:/src/msw/caret.cpp diff --git a/src/msw/caret.cpp b/src/msw/caret.cpp index 9d72d6bae0..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,28 +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() { if ( m_hasCaret ) { +#ifdef __WIN16__ + ::HideCaret(GetWinHwnd(GetWindow())) ; +#else if ( !::HideCaret(GetWinHwnd(GetWindow())) ) { wxLogLastError("HideCaret"); } +#endif } } @@ -157,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) }