From 6c41a418df66b66711eba536526a3085f690782e Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 8 Apr 1999 14:42:46 +0000 Subject: [PATCH] Changed the focus-window event handling back git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/framecmn.cpp | 11 ++++------- src/common/tbarbase.cpp | 44 +---------------------------------------- src/gtk/frame.cpp | 5 +---- src/gtk/tbargtk.cpp | 22 --------------------- src/gtk1/frame.cpp | 5 +---- src/gtk1/tbargtk.cpp | 22 --------------------- src/motif/frame.cpp | 5 +---- src/msw/frame.cpp | 4 ++++ src/msw/makefile.vc | 1 + src/stubs/frame.cpp | 6 +----- 10 files changed, 14 insertions(+), 111 deletions(-) diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 163b00a160..591382e187 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -31,20 +31,17 @@ void wxFrame::DoMenuUpdates() { wxMenuBar* bar = GetMenuBar(); - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxFindFocusDescendant(this); - if ( bar != NULL ) { int nCount = bar->GetMenuCount(); for (int n = 0; n < nCount; n++) - DoMenuUpdates(bar->GetMenu(n), focusWin); + DoMenuUpdates(bar->GetMenu(n), (wxWindow*) NULL); } } // update a menu and all submenus recursively -void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin) +void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* WXUNUSED(focusWin)) { - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); + wxEvtHandler* evtHandler = GetEventHandler(); wxNode* node = menu->GetItems().First(); while (node) { @@ -66,7 +63,7 @@ void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin) } if (item->GetSubMenu()) - DoMenuUpdates(item->GetSubMenu(), focusWin); + DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL); } node = node->Next(); } diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 77034f80a4..793ef3787b 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -149,28 +149,6 @@ bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown) event.SetEventObject(this); event.SetExtraLong((long) toggleDown); - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) - return TRUE; - // Send events to this toolbar instead (and thence up the window hierarchy) GetEventHandler()->ProcessEvent(event); @@ -757,27 +735,7 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event) // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) void wxToolBarBase::DoToolbarUpdates() { - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler() ; + wxEvtHandler* evtHandler = GetEventHandler() ; wxNode* node = GetTools().First(); while (node) diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index a217593847..c018c5b163 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -655,10 +655,7 @@ void wxFrame::Command( int id ) bar->Check(id,!bar->Checked(id)) ; } - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxFindFocusDescendant(this); - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); + wxEvtHandler* evtHandler = GetEventHandler(); evtHandler->ProcessEvent(commandEvent); } diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 3523a06f3b..7f7d9cbc8b 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -169,28 +169,6 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) event.SetInt( toolIndex ); event.SetExtraLong((long) toggleDown); - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) - return TRUE; - GetEventHandler()->ProcessEvent(event); return TRUE; diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index a217593847..c018c5b163 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -655,10 +655,7 @@ void wxFrame::Command( int id ) bar->Check(id,!bar->Checked(id)) ; } - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxFindFocusDescendant(this); - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); + wxEvtHandler* evtHandler = GetEventHandler(); evtHandler->ProcessEvent(commandEvent); } diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 3523a06f3b..7f7d9cbc8b 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -169,28 +169,6 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) event.SetInt( toolIndex ); event.SetExtraLong((long) toggleDown); - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) - return TRUE; - GetEventHandler()->ProcessEvent(event); return TRUE; diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 2e3f2f78a1..98682e8b99 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -869,10 +869,7 @@ void wxFrame::ProcessCommand(int id) } */ - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxFindFocusDescendant(this); - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); + wxEvtHandler* evtHandler = GetEventHandler(); evtHandler->ProcessEvent(commandEvent); } diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 4cfcc231d6..a96d6d99b6 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -917,10 +917,14 @@ void wxFrame::ProcessCommand(int id) bar->Check(id,!bar->Checked(id)) ; } +/* // Process events starting with the window with the focus, if any. wxWindow* focusWin = wxFindFocusDescendant(this); wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); +*/ + + wxEvtHandler* evtHandler = GetEventHandler(); evtHandler->ProcessEvent(commandEvent); } diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index 1d685d6314..84e6b7303a 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -191,6 +191,7 @@ MSWOBJS = \ ..\msw\$D\dib.obj \ ..\msw\$D\dibutils.obj \ ..\msw\$D\dirdlg.obj \ + ..\msw\$D\dragimag.obj \ ..\msw\$D\filedlg.obj \ ..\msw\$D\font.obj \ ..\msw\$D\fontdlg.obj \ diff --git a/src/stubs/frame.cpp b/src/stubs/frame.cpp index 48ff977bda..0a15c650af 100644 --- a/src/stubs/frame.cpp +++ b/src/stubs/frame.cpp @@ -451,11 +451,7 @@ void wxFrame::ProcessCommand(int id) } */ - // Process events starting with the window with the focus, if any. - wxWindow* focusWin = wxFindFocusDescendant(this); - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler(); - + wxEvtHandler* evtHandler = GetEventHandler(); evtHandler->ProcessEvent(commandEvent); } -- 2.45.2