-private:
- void Init();
- DECLARE_EVENT_TABLE()
-};
-
-//----------------------------------------------------------------------------
-// ComplexTransientPopup
-//----------------------------------------------------------------------------
-BEGIN_EVENT_TABLE(ComplexTransientPopup, SimpleTransientPopup)
- EVT_KEY_DOWN(ComplexTransientPopup::OnKeyDown)
- EVT_MOUSE_EVENTS(ComplexTransientPopup::OnMouse)
-#if USE_TIMER_TO_PUSHPOP
- EVT_TIMER( wxID_ANY, ComplexTransientPopup::OnTimer )
-#endif // USE_TIMER_TO_PUSHPOP
-END_EVENT_TABLE()
-
-void ComplexTransientPopup::Init()
-{
-#if USE_TIMER_TO_PUSHPOP
- m_timer = NULL;
-#endif // USE_TIMER_TO_PUSHPOP
- m_popped_handler = false;
-}
-
-ComplexTransientPopup::~ComplexTransientPopup()
-{
-#if USE_TIMER_TO_PUSHPOP
- StopTimer();
-#endif // USE_TIMER_TO_PUSHPOP
-}
-
-void ComplexTransientPopup::PushPopupHandler(wxWindow* child)
-{
- if (child && m_handlerPopup && m_popped_handler)
- {
- 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)