+void wxPopupTransientWindow::OnDestroy(wxWindowDestroyEvent& event)
+{
+ if (event.GetEventObject() == m_child)
+ m_child = NULL;
+ if (event.GetEventObject() == m_focus)
+ m_focus = NULL;
+}
+
+void wxPopupTransientWindow::OnEnter(wxMouseEvent& /*event*/)
+{
+ if ( HasCapture() )
+ {
+ ReleaseCapture();
+ }
+}
+
+void wxPopupTransientWindow::OnLeave(wxMouseEvent& /*event*/)
+{
+ CaptureMouse();
+}
+
+void wxPopupTransientWindow::OnLeftDown(wxMouseEvent& event)
+{
+ if (m_handlerPopup && m_child && m_child != this)
+ {
+ m_child->GetEventHandler()->ProcessEvent(event);
+ }
+}
+
+
+
+// If the child is the same size as the popup window then handle the event,
+// otherwise assume that there is enough of the popup showing that it will get
+// it's own Enter/Leave events. A more reliable way to detect this situation
+// would be appreciated...
+
+void wxPopupTransientWindow::OnChildEnter(wxMouseEvent& event)
+{
+ if (m_child)
+ {
+ wxSize cs = m_child->GetSize();
+ wxSize ps = GetClientSize();
+
+ if ((cs.x * cs.y) >= (ps.x * ps.y))
+ OnEnter(event);
+ }
+}
+
+void wxPopupTransientWindow::OnChildLeave(wxMouseEvent& event)
+{
+ if (m_child)
+ {
+ wxSize cs = m_child->GetSize();
+ wxSize ps = GetClientSize();
+
+ if ((cs.x * cs.y) >= (ps.x * ps.y))
+ OnLeave(event);
+ }
+}
+