Handle updating tooltip text in wxCompositeWindow correctly.

While calling SetToolTip(wxToolTip*) overload already worked correctly for
wxCompositeWindow, using SetToolTip(wxString) did not if a tooltip already
existed, as it didn't use the virtual DoSetToolTip() in this case, resulting
in e.g. impossibility to update wxSpinCtrlDouble tooltip using this method.

Fix this by introducing DoSetToolTipText() virtual which is used by that
overload now and overriding it in wxCompositeWindow.

Also don't override DoSetToolTip() in wxSpinCtrlGenericBase any more, it is
not necessary as it's already done by its base class wxCompositeWindow.

Closes #16595.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78245 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-12-05 22:19:10 +00:00
parent 68232dec2b
commit a2b0b8dbaa
6 changed files with 14 additions and 31 deletions

View File

@@ -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)
{