]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 652336 ] Add tooltip support to wxUniv on Windows
authorJulian Smart <julian@anthemion.co.uk>
Fri, 3 Jan 2003 12:14:59 +0000 (12:14 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 3 Jan 2003 12:14:59 +0000 (12:14 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/univ/combobox.h
include/wx/univ/radiobox.h
src/msw/tooltip.cpp
src/msw/window.cpp
src/univ/combobox.cpp
src/univ/radiobox.cpp

index afccb74711596ff55e8d14c137a155692e192c8c..532073b4601eb32851f64e2672e648f2c09d6bfb 100644 (file)
@@ -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;
index 0b9a6c48c36109b70f3061810ee6d0a7d589d635..87cad891f41f0d67548b7eb5e4dc2e6888bfd812 100644 (file)
@@ -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
index 7ed9b614e1905319c7dd4750ad34cb3afad2d514..78b93e424cee918f3030f20ace63f968b7b8ecd0 100644 (file)
@@ -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)
index 7cf2d2292afc366fb7e6119f6f2c87f46c4135ab..edb339039997009496373cc4751eeff62ec00e2f 100644 (file)
@@ -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
index 256853fbccec22a75c327a2ae08e1495e3ca8769..74b01d41744853c650f1f3d4d02c479c7179f396 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------
index 249fba0b252985e37445d3eed54f367c1842e2bd..3ad1c0730472eb4a2ee8b4c5205e2d7b2b07343d 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------