Fix setting tooltips for generic wxSpinCtrl.
Forward the tooltip set for the control to its subcontrols. Closes #9817. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -489,6 +489,7 @@ All (GUI):
|
|||||||
- Added wxFont::Underlined() and MakeUnderlined() methods.
|
- Added wxFont::Underlined() and MakeUnderlined() methods.
|
||||||
- Added wxFont::SetSymbolicSize() and related methods.
|
- Added wxFont::SetSymbolicSize() and related methods.
|
||||||
- Fix SVG files generation in locales using decimal comma (snowleopard).
|
- Fix SVG files generation in locales using decimal comma (snowleopard).
|
||||||
|
- Fix setting tooltips for generic wxSpinCtrl (Catalin Raceanu).
|
||||||
|
|
||||||
GTK:
|
GTK:
|
||||||
|
|
||||||
|
@@ -82,6 +82,9 @@ public:
|
|||||||
virtual bool Enable(bool enable = true);
|
virtual bool Enable(bool enable = true);
|
||||||
virtual bool Show(bool show = true);
|
virtual bool Show(bool show = true);
|
||||||
virtual bool Reparent(wxWindowBase *newParent);
|
virtual bool Reparent(wxWindowBase *newParent);
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
virtual void DoSetToolTip(wxToolTip *tip);
|
||||||
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
// get the subcontrols
|
// get the subcontrols
|
||||||
wxTextCtrl *GetText() const { return m_textCtrl; }
|
wxTextCtrl *GetText() const { return m_textCtrl; }
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/spinctrl.h"
|
#include "wx/spinctrl.h"
|
||||||
|
#include "wx/tooltip.h"
|
||||||
|
|
||||||
#if wxUSE_SPINCTRL
|
#if wxUSE_SPINCTRL
|
||||||
|
|
||||||
@@ -192,6 +193,10 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent,
|
|||||||
|
|
||||||
m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style);
|
m_textCtrl = new wxSpinCtrlTextGeneric(this, value, style);
|
||||||
m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
|
m_spinButton = new wxSpinCtrlButtonGeneric(this, style);
|
||||||
|
#if wxUSE_TOOLTIPS
|
||||||
|
m_textCtrl->SetToolTip(GetToolTipText());
|
||||||
|
m_spinButton->SetToolTip(GetToolTipText());
|
||||||
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
m_spin_value = m_spinButton->GetValue();
|
m_spin_value = m_spinButton->GetValue();
|
||||||
|
|
||||||
@@ -321,6 +326,33 @@ bool wxSpinCtrlGenericBase::Reparent(wxWindowBase *newParent)
|
|||||||
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
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Handle sub controls events
|
// Handle sub controls events
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user