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:
parent
68232dec2b
commit
a2b0b8dbaa
@ -123,6 +123,7 @@ wxMSW:
|
|||||||
- Drastically improve efficiency of selecting all items in wxDataViewCtrl.
|
- Drastically improve efficiency of selecting all items in wxDataViewCtrl.
|
||||||
- Fix wxMenuEvent::GetMenu() for wxEVT_MENU_{OPEN,CLOSE} in MDI frames.
|
- Fix wxMenuEvent::GetMenu() for wxEVT_MENU_{OPEN,CLOSE} in MDI frames.
|
||||||
- Added support for reading multi string values to wxRegKey (Carl Godkin).
|
- Added support for reading multi string values to wxRegKey (Carl Godkin).
|
||||||
|
- Fix updating wxSpinCtrlDouble tooltip text (Laurent Poujoulat).
|
||||||
|
|
||||||
wxOSX/Cocoa:
|
wxOSX/Cocoa:
|
||||||
|
|
||||||
|
@ -113,6 +113,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#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)
|
virtual void DoSetToolTip(wxToolTip *tip)
|
||||||
{
|
{
|
||||||
BaseWindowClass::DoSetToolTip(tip);
|
BaseWindowClass::DoSetToolTip(tip);
|
||||||
|
@ -83,9 +83,6 @@ public:
|
|||||||
// forward these functions to all subcontrols
|
// forward these functions to all subcontrols
|
||||||
virtual bool Enable(bool enable = true);
|
virtual bool Enable(bool enable = true);
|
||||||
virtual bool Show(bool show = true);
|
virtual bool Show(bool show = true);
|
||||||
#if wxUSE_TOOLTIPS
|
|
||||||
virtual void DoSetToolTip(wxToolTip *tip);
|
|
||||||
#endif // wxUSE_TOOLTIPS
|
|
||||||
|
|
||||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
virtual bool SetBackgroundColour(const wxColour& colour);
|
||||||
|
|
||||||
|
@ -1312,7 +1312,7 @@ public:
|
|||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
// the easiest way to set a tooltip for a window is to use this method
|
// 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
|
// attach a tooltip to the window, pointer can be NULL to remove
|
||||||
// existing tooltip
|
// existing tooltip
|
||||||
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
|
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
|
||||||
@ -1787,6 +1787,7 @@ protected:
|
|||||||
virtual void DoCentre(int dir);
|
virtual void DoCentre(int dir);
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
|
virtual void DoSetToolTipText( const wxString &tip );
|
||||||
virtual void DoSetToolTip( wxToolTip *tip );
|
virtual void DoSetToolTip( wxToolTip *tip );
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
|
@ -2282,7 +2282,7 @@ wxString wxWindowBase::GetToolTipText() const
|
|||||||
return m_tooltip ? m_tooltip->GetTip() : wxString();
|
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
|
// don't create the new tooltip if we already have one
|
||||||
if ( m_tooltip )
|
if ( m_tooltip )
|
||||||
|
@ -350,32 +350,6 @@ bool wxSpinCtrlGenericBase::Show(bool show)
|
|||||||
return true;
|
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)
|
bool wxSpinCtrlGenericBase::SetBackgroundColour(const wxColour& colour)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user