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
This commit is contained in:
Vadim Zeitlin 2007-09-26 16:23:51 +00:00
parent c282ec4402
commit d6b9cc87c0
3 changed files with 18 additions and 18 deletions

View File

@ -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()

View File

@ -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

View File

@ -31,7 +31,6 @@
#include "wx/msw/wrapcctl.h" // include <commctrl.h> "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__)
}