I think I found out how GTK+ want popup windows

to be handled...


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2005-02-06 18:24:02 +00:00
parent 2fd1cf7daf
commit f7204798e2
3 changed files with 79 additions and 36 deletions

View File

@@ -85,16 +85,7 @@ public:
}
protected:
// event handlers
#ifdef __WXMSW__
// Under MSW, we catch the kill focus event
void OnKillFocus(wxFocusEvent& event);
#else
// Under GTK+, event a transient popup window
// is a toplevel window so we need to catch
// deactivate events
void OnActivate(wxActivateEvent &event);
#endif
void OnKeyDown(wxKeyEvent& event);
private:
@@ -113,11 +104,7 @@ BEGIN_EVENT_TABLE(wxPopupWindowHandler, wxEvtHandler)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPopupFocusHandler, wxEvtHandler)
#ifdef __WXMSW__
EVT_KILL_FOCUS(wxPopupFocusHandler::OnKillFocus)
#else
EVT_ACTIVATE(wxPopupFocusHandler::OnActivate)
#endif
EVT_KEY_DOWN(wxPopupFocusHandler::OnKeyDown)
END_EVENT_TABLE()
@@ -258,7 +245,7 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
delete m_handlerPopup;
m_handlerPopup = new wxPopupWindowHandler(this);
m_child->CaptureMouse();
// m_child->CaptureMouse();
m_child->PushEventHandler(m_handlerPopup);
m_focus = winFocus ? winFocus : this;
@@ -474,7 +461,6 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
// wxPopupFocusHandler
// ----------------------------------------------------------------------------
#ifdef __WXMSW__
void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
{
// when we lose focus we always disappear - unless it goes to the popup (in
@@ -489,13 +475,6 @@ void wxPopupFocusHandler::OnKillFocus(wxFocusEvent& event)
m_popup->DismissAndNotify();
}
#else
void wxPopupFocusHandler::OnActivate(wxActivateEvent &event)
{
if (event.GetActive())
m_popup->DismissAndNotify();
}
#endif
void wxPopupFocusHandler::OnKeyDown(wxKeyEvent& event)
{