X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/42e69d6b435a4dd5415caf3750db62cf45b6f373..29f7914424a7941e9374a5445f95574f2f041659:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 234252ff00..12e2f11fef 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -53,6 +53,10 @@ #include "wx/tooltip.h" #endif // wxUSE_TOOLTIPS +#if wxUSE_CARET + #include "wx/caret.h" +#endif // wxUSE_CARET + // ---------------------------------------------------------------------------- // static data // ---------------------------------------------------------------------------- @@ -136,6 +140,10 @@ void wxWindowBase::InitBase() #if wxUSE_TOOLTIPS m_tooltip = (wxToolTip *)NULL; #endif // wxUSE_TOOLTIPS + +#if wxUSE_CARET + m_caret = (wxCaret *)NULL; +#endif // wxUSE_CARET } // common part of window creation process @@ -181,6 +189,11 @@ wxWindowBase::~wxWindowBase() wxASSERT_MSG( GetChildren().GetCount() == 0, _T("children not destroyed") ); +#if wxUSE_CARET + if ( m_caret ) + delete m_caret; +#endif // wxUSE_CARET + if ( m_windowValidator ) delete m_windowValidator; @@ -512,6 +525,24 @@ bool wxWindowBase::SetFont(const wxFont& font) return TRUE; } +#if wxUSE_CARET +void wxWindowBase::SetCaret(wxCaret *caret) +{ + if ( m_caret ) + { + delete m_caret; + } + + m_caret = caret; + + if ( m_caret ) + { + wxASSERT_MSG( m_caret->GetWindow() == this, + "caret should be created associated to this window" ); + } +} +#endif // wxUSE_CARET + // ---------------------------------------------------------------------------- // validators // ---------------------------------------------------------------------------- @@ -593,7 +624,7 @@ bool wxWindowBase::Validate() { wxWindowBase *child = node->GetData(); wxValidator *validator = child->GetValidator(); - if ( validator && validator->Validate(this) ) + if ( validator && !validator->Validate((wxWindow *)this) ) { return FALSE; }