]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/tooltip.cpp
better learn the operators...
[wxWidgets.git] / src / msw / tooltip.cpp
index 128c77e852b8ed075b717a5841d64e412d67e49d..930748cdbf1cf5b33ac47d6beaf93417fbf405fa 100644 (file)
@@ -32,7 +32,7 @@
 #include "wx/tooltip.h"
 #include "wx/msw/private.h"
 
 #include "wx/tooltip.h"
 #include "wx/msw/private.h"
 
-#if defined(__WIN95__) && (!defined(__GNUWIN32__) || defined(__MINGW32__))
+#if defined(__WIN95__) && !((defined(__GNUWIN32_OLD__) || defined(__TWIN32__)) && !defined(__CYGWIN10__))
     #include <commctrl.h>
 #endif
 
     #include <commctrl.h>
 #endif
 
@@ -207,7 +207,7 @@ WXHWND wxToolTip::GetToolTipCtrl()
     if ( !ms_hwndTT )
     {
         ms_hwndTT = (WXHWND)::CreateWindow(TOOLTIPS_CLASS,
     if ( !ms_hwndTT )
     {
         ms_hwndTT = (WXHWND)::CreateWindow(TOOLTIPS_CLASS,
-                                           (LPSTR)NULL,
+                                           (LPCTSTR)NULL,
                                            TTS_ALWAYSTIP,
                                            CW_USEDEFAULT, CW_USEDEFAULT,
                                            CW_USEDEFAULT, CW_USEDEFAULT,
                                            TTS_ALWAYSTIP,
                                            CW_USEDEFAULT, CW_USEDEFAULT,
                                            CW_USEDEFAULT, CW_USEDEFAULT,
@@ -240,6 +240,8 @@ void wxToolTip::RelayEvent(WXMSG *msg)
 // ctor & dtor
 // ----------------------------------------------------------------------------
 
 // ctor & dtor
 // ----------------------------------------------------------------------------
 
+IMPLEMENT_ABSTRACT_CLASS(wxToolTip, wxObject)
+
 wxToolTip::wxToolTip(const wxString &tip)
          : m_text(tip)
 {
 wxToolTip::wxToolTip(const wxString &tip)
          : m_text(tip)
 {
@@ -303,25 +305,25 @@ void wxToolTip::Add(WXHWND hWnd)
                     hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
                     if ( !hfont )
                     {
                     hfont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
                     if ( !hfont )
                     {
-                        wxLogLastError("GetStockObject(DEFAULT_GUI_FONT)");
+                        wxLogLastError(wxT("GetStockObject(DEFAULT_GUI_FONT)"));
                     }
                 }
 
                 HDC hdc = CreateCompatibleDC(NULL);
                 if ( !hdc )
                 {
                     }
                 }
 
                 HDC hdc = CreateCompatibleDC(NULL);
                 if ( !hdc )
                 {
-                    wxLogLastError("CreateCompatibleDC(NULL)");
+                    wxLogLastError(wxT("CreateCompatibleDC(NULL)"));
                 }
 
                 if ( !SelectObject(hdc, hfont) )
                 {
                 }
 
                 if ( !SelectObject(hdc, hfont) )
                 {
-                    wxLogLastError("SelectObject(hfont)");
+                    wxLogLastError(wxT("SelectObject(hfont)"));
                 }
 
                 SIZE sz;
                 if ( !GetTextExtentPoint(hdc, m_text, index, &sz) )
                 {
                 }
 
                 SIZE sz;
                 if ( !GetTextExtentPoint(hdc, m_text, index, &sz) )
                 {
-                    wxLogLastError("GetTextExtentPoint");
+                    wxLogLastError(wxT("GetTextExtentPoint"));
                 }
 
                 DeleteDC(hdc);
                 }
 
                 DeleteDC(hdc);
@@ -374,6 +376,22 @@ void wxToolTip::SetWindow(wxWindow *win)
             Add((WXHWND)hwnd);
         }
     }
             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);
+        }
+    }
 }
 
 void wxToolTip::SetTip(const wxString& tip)
 }
 
 void wxToolTip::SetTip(const wxString& tip)