]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/tipwin.cpp
fix for focus event sending
[wxWidgets.git] / src / generic / tipwin.cpp
index f712aed83f07e4a0ae244c84c305fe8e6d6cd035..06e94b763647df466649055c08b57a5cbe93ea56 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "wx/tipwin.h"
 #include "wx/timer.h"
 
 #include "wx/tipwin.h"
 #include "wx/timer.h"
+#include "wx/settings.h"
 
 // ----------------------------------------------------------------------------
 // constants
 
 // ----------------------------------------------------------------------------
 // constants
@@ -99,12 +100,14 @@ wxTipWindow::wxTipWindow(wxWindow *parent,
 {
     // set colours
     SetForegroundColour(*wxBLACK);
 {
     // set colours
     SetForegroundColour(*wxBLACK);
-#if !defined(__WXPM__)
-    SetBackgroundColour(wxColour(0xc3ffff));
+
+#ifdef __WXMSW__
+    wxColour bkCol(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_INFOBK));
 #else
 #else
-    // What is 0xc3ffff, try some legable documentation for those of us who don't memorize hex codes??
-    SetBackgroundColour(wxColour(*wxWHITE));
+    wxColour bkCol(wxColour(255, 255, 225));
 #endif
 #endif
+    SetBackgroundColour(bkCol);
+
     // set position and size
     int x, y;
     wxGetMousePosition(&x, &y);
     // set position and size
     int x, y;
     wxGetMousePosition(&x, &y);
@@ -127,7 +130,7 @@ wxTipWindow::~wxTipWindow()
     }
 }
 
     }
 }
 
-void wxTipWindow::OnMouseClick(wxMouseEvent& event)
+void wxTipWindow::OnMouseClick(wxMouseEvent& WXUNUSED(event))
 {
     Close();
 }
 {
     Close();
 }
@@ -138,9 +141,14 @@ void wxTipWindow::OnActivate(wxActivateEvent& event)
         Close();
 }
 
         Close();
 }
 
-void wxTipWindow::OnKillFocus(wxFocusEvent& event)
+void wxTipWindow::OnKillFocus(wxFocusEvent& WXUNUSED(event))
 {
 {
+    // Under Windows at least, we will get this immediately
+    // because when the view window is focussed, the
+    // tip window goes out of focus.
+#ifdef __WXGTK__
     Close();
     Close();
+#endif
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
@@ -154,12 +162,12 @@ wxTipWindowView::wxTipWindowView(wxWindow *parent)
 {
     // set colours
     SetForegroundColour(*wxBLACK);
 {
     // set colours
     SetForegroundColour(*wxBLACK);
-#if !defined(__WXPM__)
-    SetBackgroundColour(wxColour(0xc3ffff));
+#ifdef __WXMSW__
+    wxColour bkCol(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_INFOBK));
 #else
 #else
-    // What is 0xc3ffff, try some legable documentation for those of us who don't memorize hex codes??
-    SetBackgroundColour(wxColour(*wxWHITE));
+    wxColour bkCol(wxColour(255, 255, 225));
 #endif
 #endif
+    SetBackgroundColour(bkCol);
     m_creationTime = wxGetLocalTime();
 }
 
     m_creationTime = wxGetLocalTime();
 }
 
@@ -226,7 +234,7 @@ void wxTipWindowView::Adjust(const wxString& text, wxCoord maxLength)
                   2*(TEXT_MARGIN_Y + 1) + parent->m_textLines.GetCount()*parent->m_heightLine);
 }
 
                   2*(TEXT_MARGIN_Y + 1) + parent->m_textLines.GetCount()*parent->m_heightLine);
 }
 
-void wxTipWindowView::OnPaint(wxPaintEvent& event)
+void wxTipWindowView::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxTipWindow* parent = (wxTipWindow*) GetParent();
     if (!parent)
 {
     wxTipWindow* parent = (wxTipWindow*) GetParent();
     if (!parent)
@@ -265,14 +273,15 @@ void wxTipWindowView::OnPaint(wxPaintEvent& event)
     }
 }
 
     }
 }
 
-void wxTipWindowView::OnMouseClick(wxMouseEvent& event)
+void wxTipWindowView::OnMouseClick(wxMouseEvent& WXUNUSED(event))
 {
     GetParent()->Close();
 }
 
 {
     GetParent()->Close();
 }
 
-void wxTipWindowView::OnKillFocus(wxFocusEvent& event)
+void wxTipWindowView::OnKillFocus(wxFocusEvent& WXUNUSED(event))
 {
     // Workaround the kill focus event happening just after creation in wxGTK
     if (wxGetLocalTime() > m_creationTime + 1)
         GetParent()->Close();
 }
 {
     // Workaround the kill focus event happening just after creation in wxGTK
     if (wxGetLocalTime() > m_creationTime + 1)
         GetParent()->Close();
 }
+