Various changes to make pop up menus work
under X11. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14520 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/combobox.h" // wxComboControl
|
#include "wx/combobox.h" // wxComboControl
|
||||||
|
#include "wx/log.h"
|
||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
#ifdef __WXUNIVERSAL__
|
#ifdef __WXUNIVERSAL__
|
||||||
@@ -256,13 +257,13 @@ void wxPopupTransientWindow::Popup(wxWindow *winFocus)
|
|||||||
// otherwise everything else breaks down
|
// otherwise everything else breaks down
|
||||||
m_focus = FindFocus();
|
m_focus = FindFocus();
|
||||||
if ( m_focus )
|
if ( m_focus )
|
||||||
#endif // __WXMSW__
|
|
||||||
{
|
{
|
||||||
delete m_handlerFocus;
|
delete m_handlerFocus;
|
||||||
m_handlerFocus = new wxPopupFocusHandler(this);
|
m_handlerFocus = new wxPopupFocusHandler(this);
|
||||||
|
|
||||||
m_focus->PushEventHandler(m_handlerFocus);
|
m_focus->PushEventHandler(m_handlerFocus);
|
||||||
}
|
}
|
||||||
|
#endif // __WXMSW__
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPopupTransientWindow::Dismiss()
|
void wxPopupTransientWindow::Dismiss()
|
||||||
@@ -347,7 +348,7 @@ void wxPopupWindowHandler::OnLeftDown(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pos = event.GetPosition();
|
wxPoint pos = event.GetPosition();
|
||||||
|
|
||||||
// scrollbar on which the click occured
|
// scrollbar on which the click occured
|
||||||
|
@@ -257,6 +257,8 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// return FALSE;
|
||||||
|
|
||||||
return wxEvtHandler::ProcessEvent(event);
|
return wxEvtHandler::ProcessEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1253,9 @@ void wxMenu::OnDismiss(bool dismissParent)
|
|||||||
wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
|
wxCHECK_RET( m_invokingWindow, _T("what kind of menu is this?") );
|
||||||
|
|
||||||
m_invokingWindow->DismissPopupMenu();
|
m_invokingWindow->DismissPopupMenu();
|
||||||
SetInvokingWindow(NULL);
|
|
||||||
|
// Why reset it here? We need it for sending the event to...
|
||||||
|
// SetInvokingWindow(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1321,7 +1325,7 @@ bool wxMenu::ClickItem(wxMenuItem *item)
|
|||||||
// not applicabled
|
// not applicabled
|
||||||
isChecked = -1;
|
isChecked = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SendEvent(item->GetId(), isChecked);
|
return SendEvent(item->GetId(), isChecked);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2355,6 +2359,9 @@ bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
menu->SetInvokingWindow(this);
|
menu->SetInvokingWindow(this);
|
||||||
|
|
||||||
|
// wxLogDebug( "Name of invoking window %s", menu->GetInvokingWindow()->GetName().c_str() );
|
||||||
|
|
||||||
menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
|
menu->Popup(ClientToScreen(wxPoint(x, y)), wxSize(0, 0));
|
||||||
|
|
||||||
// this is not very useful if the menu was popped up because of the mouse
|
// this is not very useful if the menu was popped up because of the mouse
|
||||||
@@ -2390,9 +2397,6 @@ void wxWindow::DismissPopupMenu()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
|
wxCHECK_RET( ms_evtLoopPopup, _T("no popup menu shown") );
|
||||||
|
|
||||||
char *crash = NULL;
|
|
||||||
(*crash) = 0;
|
|
||||||
|
|
||||||
ms_evtLoopPopup->Exit();
|
ms_evtLoopPopup->Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -468,7 +468,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
|
|
||||||
win = wxGetWindowFromTable(window);
|
win = wxGetWindowFromTable(window);
|
||||||
if (!win)
|
if (!win)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
wxString windowClass = win->GetClassInfo()->GetClassName();
|
wxString windowClass = win->GetClassInfo()->GetClassName();
|
||||||
@@ -661,7 +661,7 @@ bool wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
g_nextFocus = win;
|
g_nextFocus = win;
|
||||||
|
|
||||||
win->SetFocus();
|
win->SetFocus();
|
||||||
return TRUE;
|
// return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ bool wxApp::OnInitGui()
|
|||||||
delete wxLog::SetActiveTarget(new wxLogStderr);
|
delete wxLog::SetActiveTarget(new wxLogStderr);
|
||||||
|
|
||||||
if (!wxAppBase::OnInitGui())
|
if (!wxAppBase::OnInitGui())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
GetMainColormap( wxApp::GetDisplay() );
|
GetMainColormap( wxApp::GetDisplay() );
|
||||||
|
|
||||||
@@ -920,13 +920,13 @@ Window wxGetWindowParent(Window window)
|
|||||||
#endif
|
#endif
|
||||||
Window* children = NULL;
|
Window* children = NULL;
|
||||||
|
|
||||||
// #define XQueryTree(d,w,r,p,c,nc) GrQueryTree(w,p,c,nc)
|
// #define XQueryTree(d,w,r,p,c,nc) GrQueryTree(w,p,c,nc)
|
||||||
int res = 1;
|
int res = 1;
|
||||||
#if !wxUSE_NANOX
|
#if !wxUSE_NANOX
|
||||||
res =
|
res =
|
||||||
#endif
|
#endif
|
||||||
XQueryTree((Display*) wxGetDisplay(), window, & root, & parent,
|
XQueryTree((Display*) wxGetDisplay(), window, & root, & parent,
|
||||||
& children, & noChildren);
|
& children, & noChildren);
|
||||||
if (children)
|
if (children)
|
||||||
XFree(children);
|
XFree(children);
|
||||||
if (res)
|
if (res)
|
||||||
|
Reference in New Issue
Block a user