- m_popped_handler = false;
-
- if (child->GetEventHandler() != (wxEvtHandler*)m_handlerPopup)
- child->PushEventHandler((wxEvtHandler*)m_handlerPopup);
- if (!child->HasCapture())
- child->CaptureMouse();
-
- child->SetFocus();
- }
-}
-void ComplexTransientPopup::PopPopupHandler(wxWindow* child)
-{
- if (child && m_handlerPopup && !m_popped_handler)
- {
- m_popped_handler = true;
-
- if (child->GetEventHandler() == (wxEvtHandler*)m_handlerPopup)
- child->PopEventHandler(false);
- if (child->HasCapture())
- child->ReleaseMouse();
-
- child->SetFocus();
- }
-}
-
-#if USE_TIMER_TO_PUSHPOP
-void ComplexTransientPopup::OnTimer( wxTimerEvent &WXUNUSED(event) )
-{
- if (!IsShown()) return;
-
- m_mouse = ScreenToClient(wxGetMousePosition());
-
- wxWindow *child = GetChild();
- if (!child) return; // nothing to do
-
- wxRect clientRect(wxPoint(0,0), GetClientSize());
- wxLogMessage(wxT("CTW::OnTimer mouse(%d, %d), popped %d, m_handlerPopup %d"), m_mouse.x, m_mouse.y, m_popped_handler, m_handlerPopup);
- // pop the event handler if inside the child window or
- // restore the event handler if not in the child window
- if (clientRect.Inside(m_mouse))
- PopPopupHandler(child);
- else
- PushPopupHandler(child);
-}
-
-void ComplexTransientPopup::StartTimer()
-{
- if (!m_timer)
- m_timer = new wxTimer(this, wxID_ANY);
-
- m_timer->Start(200, false);
-}
-
-void ComplexTransientPopup::StopTimer()
-{
- if (m_timer)
- {
- if (m_timer->IsRunning())
- m_timer->Stop();
- delete m_timer;
- m_timer = NULL;
- }
-}
-
-#else // USE_TIMER_TO_PUSHPOP
-void ComplexTransientPopup::OnIdle( wxIdleEvent& event )
-{
- if (IsShown())
- {
- m_mouse = ScreenToClient(wxGetMousePosition());
- wxLogMessage(wxT("CTW::OnIdle mouse(%d, %d), popped %d, m_handlerPopup %d"), m_mouse.x, m_mouse.y, m_popped_handler, m_handlerPopup);
-
- wxWindow *child = GetChild();
- if (!child) return; // nothing to do
-
- wxRect clientRect(wxPoint(0,0), GetClientSize());
- //wxPrintf(wxT("**DropDownPopup::OnIdle mouse %d %d -- %d %d %d\n"), m_mouse.x, m_mouse.y, m_popped_handler, m_child, m_handlerPopup); fflush(stdout);
- // pop the event handler if inside the child window or
- // restore the event handler if not in the child window
- if (clientRect.Inside(m_mouse))
- PopPopupHandler(child);
- else
- PushPopupHandler(child);