From a2dc658bbaa0f323293eb78dc098e87fb52ebe9c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 7 Jan 2007 16:00:11 +0000 Subject: [PATCH] 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 --- include/wx/pickerbase.h | 2 ++ src/common/pickerbase.cpp | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/wx/pickerbase.h b/include/wx/pickerbase.h index 417767664c..b49fc3e7b8 100644 --- a/include/wx/pickerbase.h +++ b/include/wx/pickerbase.h @@ -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 diff --git a/src/common/pickerbase.cpp b/src/common/pickerbase.cpp index f025426193..05ff622e36 100644 --- a/src/common/pickerbase.cpp +++ b/src/common/pickerbase.cpp @@ -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); -- 2.45.2