set tooltips for the both subcontrols (patch 1622531)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-01-07 16:00:11 +00:00
parent bf41d9034a
commit a2dc658bba
2 changed files with 21 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "wx/containr.h"
class WXDLLIMPEXP_CORE wxTextCtrl;
class WXDLLEXPORT wxToolTip;
extern WXDLLEXPORT_DATA(const wxChar) wxButtonNameStr[];
@ -51,6 +52,7 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
virtual void DoSetToolTip( wxToolTip *tip );
public: // public API

View File

@ -30,11 +30,13 @@
wxUSE_FONTPICKERCTRL
#include "wx/pickerbase.h"
#include "wx/tooltip.h"
#ifndef WX_PRECOMP
#include "wx/textctrl.h"
#endif
// ============================================================================
// implementation
// ============================================================================
@ -122,6 +124,23 @@ void wxPickerBase::PostCreation()
SetMinSize( m_sizer->GetMinSize() );
}
void wxPickerBase::DoSetToolTip( wxToolTip *tip )
{
// don't set the tooltip on us but rather on our two child windows
// as otherwise it would appear only when the cursor is placed on the
// small area around the child windows which belong to wxPickerBase
m_picker->SetToolTip(tip);
// do a copy as wxWindow will own the pointer we pass
m_text->SetToolTip(tip ? new wxToolTip(tip->GetTip()) : NULL);
}
// ----------------------------------------------------------------------------
// wxPickerBase - event handlers
// ----------------------------------------------------------------------------
void wxPickerBase::OnTextCtrlKillFocus(wxFocusEvent &)
{
wxASSERT(m_text);