#ifndef WX_PRECOMP
#include "wx/window.h"
+ #include "wx/log.h"
#endif // WX_PRECOMP
#include "wx/caret.h"
//static
void wxCaretBase::SetBlinkTime(int milliseconds)
{
+#ifdef __WIN16__
+ ::SetCaretBlinkTime(milliseconds) ;
+#else
if ( !::SetCaretBlinkTime(milliseconds) )
{
wxLogLastError("SetCaretBlinkTime");
}
+#endif
}
// ---------------------------------------------------------------------------
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");
{
m_hasCaret = TRUE;
}
+#endif
}
return m_hasCaret;
{
m_hasCaret = FALSE;
+#ifdef __WIN16__
+ ::DestroyCaret() ;
+#else
if ( !::DestroyCaret() )
{
wxLogLastError("DestroyCaret");
}
+#endif
}
}
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
}
}
void wxCaret::DoMove()
{
- wxASSERT_MSG( m_hasCaret, "cannot move non existent caret" );
-
- if ( !::SetCaretPos(m_x, m_y) )
+ if ( m_hasCaret )
{
- wxLogLastError("SetCaretPos");
+#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)
}