]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/tipwin.cpp
1. some more tests in console
[wxWidgets.git] / src / generic / tipwin.cpp
index 6dc9d80ac610c406ff4179dc1f9fd25b482e0af0..26f83781ba3ae9ae4a258d8129dc7f71be649e9b 100644 (file)
@@ -55,6 +55,8 @@ BEGIN_EVENT_TABLE(wxTipWindow, wxFrame)
     EVT_LEFT_DOWN(wxTipWindow::OnMouseClick)
     EVT_RIGHT_DOWN(wxTipWindow::OnMouseClick)
     EVT_MIDDLE_DOWN(wxTipWindow::OnMouseClick)
+    EVT_KILL_FOCUS(wxTipWindow::OnKillFocus)
+    EVT_ACTIVATE(wxTipWindow::OnActivate)
 END_EVENT_TABLE()
 
 // ----------------------------------------------------------------------------
@@ -70,8 +72,12 @@ wxTipWindow::wxTipWindow(wxWindow *parent,
 {
     // set colours
     SetForegroundColour(*wxBLACK);
+#if !defined(__WXPM__)
     SetBackgroundColour(wxColour(0xc3ffff));
-
+#else
+    // What is 0xc3ffff, try some legable documentation for those of us who don't memorize hex codes??
+    SetBackgroundColour(wxColour(*wxWHITE));
+#endif
     // set position and size
     int x, y;
     wxGetMousePosition(&x, &y);
@@ -79,8 +85,7 @@ wxTipWindow::wxTipWindow(wxWindow *parent,
 
     Adjust(text, maxLength);
 
-    // capture mouse as we want to dismiss the window when it is clicked
-    CaptureMouse();
+    SetFocus();
 
     Show(TRUE);
 }
@@ -158,7 +163,13 @@ void wxTipWindow::OnPaint(wxPaintEvent& event)
 
     // first filll the background
     dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
-    dc.SetPen(*wxBLACK_PEN);
+
+    // Under Windows, you apparently get a thin black border whether you like it or not :-(
+#ifdef __WXMSW__
+    dc.SetPen( * wxTRANSPARENT_PEN );
+#else
+    dc.SetPen( * wxBLACK_PEN );
+#endif
     dc.DrawRectangle(rect);
 
     // and then draw the text line by line
@@ -178,7 +189,16 @@ void wxTipWindow::OnPaint(wxPaintEvent& event)
 
 void wxTipWindow::OnMouseClick(wxMouseEvent& event)
 {
-    ReleaseMouse();
+    Close();
+}
+
+void wxTipWindow::OnActivate(wxActivateEvent& event)
+{
+    if (!event.GetActive())
+        Close();
+}
 
+void wxTipWindow::OnKillFocus(wxFocusEvent& event)
+{
     Close();
 }