diff --git a/docs/changes.txt b/docs/changes.txt index a9f6d35cbd..d905100266 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -123,6 +123,7 @@ wxMSW: - Drastically improve efficiency of selecting all items in wxDataViewCtrl. - Fix wxMenuEvent::GetMenu() for wxEVT_MENU_{OPEN,CLOSE} in MDI frames. - Added support for reading multi string values to wxRegKey (Carl Godkin). +- Fix updating wxSpinCtrlDouble tooltip text (Laurent Poujoulat). wxOSX/Cocoa: diff --git a/include/wx/compositewin.h b/include/wx/compositewin.h index a58d2e7e6c..0a9bbdff81 100644 --- a/include/wx/compositewin.h +++ b/include/wx/compositewin.h @@ -113,6 +113,16 @@ public: } #if wxUSE_TOOLTIPS + virtual void DoSetToolTipText(const wxString &tip) + { + BaseWindowClass::DoSetToolTipText(tip); + + // Use a variable to disambiguate between SetToolTip() overloads. + void (wxWindowBase::*func)(const wxString&) = &wxWindowBase::SetToolTip; + + SetForAllParts(func, tip); + } + virtual void DoSetToolTip(wxToolTip *tip) { BaseWindowClass::DoSetToolTip(tip); diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index a35cc8a4a4..3a914ef64d 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -83,9 +83,6 @@ public: // forward these functions to all subcontrols virtual bool Enable(bool enable = true); virtual bool Show(bool show = true); -#if wxUSE_TOOLTIPS - virtual void DoSetToolTip(wxToolTip *tip); -#endif // wxUSE_TOOLTIPS virtual bool SetBackgroundColour(const wxColour& colour); diff --git a/include/wx/window.h b/include/wx/window.h index 128d35de0e..b1f52a6325 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -1312,7 +1312,7 @@ public: #if wxUSE_TOOLTIPS // the easiest way to set a tooltip for a window is to use this method - void SetToolTip( const wxString &tip ); + void SetToolTip( const wxString &tip ) { DoSetToolTipText(tip); } // attach a tooltip to the window, pointer can be NULL to remove // existing tooltip void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); } @@ -1787,6 +1787,7 @@ protected: virtual void DoCentre(int dir); #if wxUSE_TOOLTIPS + virtual void DoSetToolTipText( const wxString &tip ); virtual void DoSetToolTip( wxToolTip *tip ); #endif // wxUSE_TOOLTIPS diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 9b9da9a023..5640c43103 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -2282,7 +2282,7 @@ wxString wxWindowBase::GetToolTipText() const return m_tooltip ? m_tooltip->GetTip() : wxString(); } -void wxWindowBase::SetToolTip( const wxString &tip ) +void wxWindowBase::DoSetToolTipText( const wxString &tip ) { // don't create the new tooltip if we already have one if ( m_tooltip ) diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index e14aa5b4b1..1a577dcde7 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -350,32 +350,6 @@ bool wxSpinCtrlGenericBase::Show(bool show) return true; } -#if wxUSE_TOOLTIPS -void wxSpinCtrlGenericBase::DoSetToolTip(wxToolTip *tip) -{ - // Notice that we must check for the subcontrols not being NULL (as they - // could be if we were created with the default ctor and this is called - // before Create() for some reason) and that we can't call SetToolTip(tip) - // because this would take ownership of the wxToolTip object (twice). - if ( m_textCtrl ) - { - if ( tip ) - m_textCtrl->SetToolTip(tip->GetTip()); - else - m_textCtrl->SetToolTip(NULL); - } - - if ( m_spinButton ) - { - if( tip ) - m_spinButton->SetToolTip(tip->GetTip()); - else - m_spinButton->SetToolTip(NULL); - } - - wxWindowBase::DoSetToolTip(tip); -} -#endif // wxUSE_TOOLTIPS bool wxSpinCtrlGenericBase::SetBackgroundColour(const wxColour& colour) {