From d6b9cc87c0bad90c4016a58699842b3939fc362c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 26 Sep 2007 16:23:51 +0000 Subject: [PATCH] remove wxComboBox-specific hack, override DoSetToolTip() in wxComboBox itself instead git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/combobox.h | 5 +++++ src/msw/combobox.cpp | 12 ++++++++++++ src/msw/tooltip.cpp | 19 +------------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index 214b5a4a3c..8da813e43e 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -126,8 +126,13 @@ public: void OnUpdateDelete(wxUpdateUIEvent& event); void OnUpdateSelectAll(wxUpdateUIEvent& event); +protected: virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; +#if wxUSE_TOOLTIPS + virtual void DoSetToolTip(wxToolTip *tip); +#endif + private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) DECLARE_EVENT_TABLE() diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 8ced094638..60aa76a568 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -807,4 +807,16 @@ void wxComboBox::OnUpdateSelectAll(wxUpdateUIEvent& event) event.Enable(IsEditable() && GetLastPosition() > 0); } +#if wxUSE_TOOLTIPS + +void wxComboBox::DoSetToolTip(wxToolTip *tip) +{ + wxChoice::DoSetToolTip(tip); + + if ( tip && !HasFlag(wxCB_READONLY) ) + tip->Add(GetEditHWND()); +} + +#endif // wxUSE_TOOLTIPS + #endif // wxUSE_COMBOBOX diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index 0b705200f7..e2965f721f 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -31,7 +31,6 @@ #include "wx/msw/wrapcctl.h" // include "properly" #include "wx/app.h" #include "wx/control.h" - #include "wx/combobox.h" #endif #include "wx/tokenzr.h" @@ -395,7 +394,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 + // and all of its subcontrols (e.g. radio buttons in a radiobox) as well wxControl *control = wxDynamicCast(m_window, wxControl); if ( control ) { @@ -419,22 +418,6 @@ void wxToolTip::SetWindow(wxWindow *win) Add((WXHWND)hwnd); } } - - // VZ: it's ugly to do it here, but I don't want any major changes right - // now, later we will probably want to have wxWindow::OnGotToolTip() or - // something like this where the derived class can do such things - // itself instead of wxToolTip "knowing" about them all - wxComboBox *combo = wxDynamicCast(control, wxComboBox); - if ( combo ) - { - WXHWND hwndComboEdit = combo->GetWindowStyle() & wxCB_READONLY - ? combo->GetHWND() - : combo->GetEditHWND(); - if ( hwndComboEdit ) - { - Add(hwndComboEdit); - } - } #endif // !defined(__WXUNIVERSAL__) } -- 2.45.2