From: Julian Smart Date: Fri, 3 Jan 2003 12:14:59 +0000 (+0000) Subject: Applied patch [ 652336 ] Add tooltip support to wxUniv on Windows X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d4e5272b3a2abfb9d365df93c54c52de965ba7ef?ds=inline Applied patch [ 652336 ] Add tooltip support to wxUniv on Windows git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/univ/combobox.h b/include/wx/univ/combobox.h index afccb74711..532073b460 100644 --- a/include/wx/univ/combobox.h +++ b/include/wx/univ/combobox.h @@ -160,6 +160,10 @@ public: virtual bool Enable(bool enable = TRUE); virtual bool Show(bool show = TRUE); +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + protected: // override the base class virtuals involved into geometry calculations virtual wxSize DoGetBestClientSize() const; diff --git a/include/wx/univ/radiobox.h b/include/wx/univ/radiobox.h index 0b9a6c48c3..87cad891f4 100644 --- a/include/wx/univ/radiobox.h +++ b/include/wx/univ/radiobox.h @@ -84,6 +84,10 @@ public: virtual wxString GetLabel() const; virtual void SetLabel(const wxString& label); +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip( wxToolTip *tip ); +#endif // wxUSE_TOOLTIPS + // wxUniversal-only methods // another Append() version diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 7ed9b614e1..78b93e424c 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -352,7 +352,7 @@ void wxToolTip::SetWindow(wxWindow *win) { Add(m_window->GetHWND()); } - +#if !defined(__WXUNIVERSAL__) // and all of its subcontrols (e.g. radiobuttons in a radiobox) as well wxControl *control = wxDynamicCast(m_window, wxControl); if ( control ) @@ -393,6 +393,7 @@ void wxToolTip::SetWindow(wxWindow *win) Add(hwndComboEdit); } } +#endif // !defined(__WXUNIVERSAL__) } void wxToolTip::SetTip(const wxString& tip) diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 7cf2d2292a..edb3390399 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -1519,7 +1519,7 @@ void wxWindowMSW::DoSetToolTip(wxToolTip *tooltip) wxWindowBase::DoSetToolTip(tooltip); if ( m_tooltip ) - m_tooltip->SetWindow(this); + m_tooltip->SetWindow((wxWindow *)this); } #endif // wxUSE_TOOLTIPS diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index 256853fbcc..74b01d4174 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -41,6 +41,7 @@ #include "wx/validate.h" #endif +#include "wx/tooltip.h" #include "wx/popupwin.h" #include "wx/univ/renderer.h" @@ -351,6 +352,29 @@ bool wxComboControl::Show(bool show) return TRUE; } +#if wxUSE_TOOLTIPS +void wxComboControl::DoSetToolTip(wxToolTip *tooltip) +{ + wxControl::DoSetToolTip(tooltip); + + // Set tool tip for button and text box + if (m_text && m_btn) + { + if (tooltip) + { + const wxString &tip = tooltip->GetTip(); + m_text->SetToolTip(tip); + m_btn->SetToolTip(tip); + } + else + { + m_text->SetToolTip(NULL); + m_btn->SetToolTip(NULL); + } + } +} +#endif // wxUSE_TOOLTIPS + // ---------------------------------------------------------------------------- // popup window handling // ---------------------------------------------------------------------------- diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index 249fba0b25..3ad1c07304 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -36,6 +36,8 @@ #include "wx/validate.h" #endif +#include "wx/tooltip.h" + #include "wx/univ/theme.h" #include "wx/univ/renderer.h" #include "wx/univ/inphand.h" @@ -341,6 +343,23 @@ void wxRadioBox::SetLabel(const wxString& label) wxStaticBox::SetLabel(label); } +#if wxUSE_TOOLTIPS +void wxRadioBox::DoSetToolTip(wxToolTip *tooltip) +{ + wxControl::DoSetToolTip(tooltip); + + // Also set them for all Radio Buttons + size_t count = m_buttons.GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + if (tooltip) + m_buttons[n]->SetToolTip(tooltip->GetTip()); + else + m_buttons[n]->SetToolTip(NULL); + } +} +#endif // wxUSE_TOOLTIPS + // ---------------------------------------------------------------------------- // buttons positioning // ----------------------------------------------------------------------------