]> git.saurik.com Git - wxWidgets.git/commitdiff
remove wxComboBox-specific hack, override DoSetToolTip() in wxComboBox itself instead
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 26 Sep 2007 16:23:51 +0000 (16:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 26 Sep 2007 16:23:51 +0000 (16:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48951 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/combobox.h
src/msw/combobox.cpp
src/msw/tooltip.cpp

index 214b5a4a3ce14da5540ff543aff8f210caffc86c..8da813e43ed2f7f78248913d2c0fb650e7d89060 100644 (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()
index 8ced0946381fcc14b0a3a5e15a6477582dcb3196..60aa76a568826112c587dbe196a0e0e4755b89a7 100644 (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
index 0b705200f7207df181c69c6f280a7a78b10b5c95..e2965f721ff56ded5ef4c09706f4fb3d16382f3d 100644 (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__)
 }