projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
applied the patch from Dimitri to prevent crashes with (some) interlaced GIFs
[wxWidgets.git]
/
src
/
msw
/
caret.cpp
diff --git
a/src/msw/caret.cpp
b/src/msw/caret.cpp
index 5378bc1f8f898f423fd92939e6efb2d74b8bc449..f1fd767110b7f566514595d60bec92809295f309 100644
(file)
--- a/
src/msw/caret.cpp
+++ b/
src/msw/caret.cpp
@@
-46,7
+46,9
@@
#ifdef __WIN16__
#define CALL_CARET_API(api, args) api args
#else // Win32
#ifdef __WIN16__
#define CALL_CARET_API(api, args) api args
#else // Win32
- #define CALL_CARET_API(api, args) if ( !api args ) wxLogLastError(#api)
+ #define CALL_CARET_API(api, args) \
+ if ( !api args ) \
+ wxLogLastError(_T(#api))
#endif // Win16/32
// ===========================================================================
#endif // Win16/32
// ===========================================================================
@@
-63,7
+65,7
@@
int wxCaretBase::GetBlinkTime()
int blinkTime = ::GetCaretBlinkTime();
if ( !blinkTime )
{
int blinkTime = ::GetCaretBlinkTime();
if ( !blinkTime )
{
- wxLogLastError(
"GetCaretBlinkTime"
);
+ wxLogLastError(
wxT("GetCaretBlinkTime")
);
}
return blinkTime;
}
return blinkTime;
@@
-130,6
+132,17
@@
void wxCaret::DoShow()
wxASSERT_MSG( GetWindow(), wxT("caret without window cannot be shown") );
wxASSERT_MSG( IsOk(), wxT("caret of zero size cannot be shown") );
wxASSERT_MSG( GetWindow(), wxT("caret without window cannot be shown") );
wxASSERT_MSG( IsOk(), wxT("caret of zero size cannot be shown") );
+ // we might not have created the caret yet if we had got the focus first
+ // and the caret was shown later - so do it now if we have the focus but
+ // not the caret
+ if ( !m_hasCaret && (wxWindow::FindFocus() == GetWindow()) )
+ {
+ if ( MSWCreateCaret() )
+ {
+ DoMove();
+ }
+ }
+
if ( m_hasCaret )
{
CALL_CARET_API(ShowCaret, (GetWinHwnd(GetWindow())));
if ( m_hasCaret )
{
CALL_CARET_API(ShowCaret, (GetWinHwnd(GetWindow())));
@@
-156,7
+169,26
@@
void wxCaret::DoMove()
wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
wxT("how did we lose focus?") );
wxASSERT_MSG( wxWindow::FindFocus() == GetWindow(),
wxT("how did we lose focus?") );
- CALL_CARET_API(SetCaretPos, (m_x, m_y));
+ // for compatibility with the generic version, the coordinates are
+ // client ones
+ wxPoint pt = GetWindow()->GetClientAreaOrigin();
+ CALL_CARET_API(SetCaretPos, (m_x + pt.x, m_y + pt.y));
}
//else: we don't have caret right now, nothing to do (this does happen)
}
}
//else: we don't have caret right now, nothing to do (this does happen)
}
+
+
+// ---------------------------------------------------------------------------
+// resizing the caret
+// ---------------------------------------------------------------------------
+
+void wxCaret::DoSize()
+{
+ if ( m_hasCaret )
+ {
+ m_hasCaret = FALSE;
+ CALL_CARET_API(DestroyCaret, ());
+ MSWCreateCaret();
+ DoMove();
+ }
+}