Changed the focus-window event handling back
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -31,20 +31,17 @@ void wxFrame::DoMenuUpdates()
|
|||||||
{
|
{
|
||||||
wxMenuBar* bar = GetMenuBar();
|
wxMenuBar* bar = GetMenuBar();
|
||||||
|
|
||||||
// Process events starting with the window with the focus, if any.
|
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
|
||||||
|
|
||||||
if ( bar != NULL ) {
|
if ( bar != NULL ) {
|
||||||
int nCount = bar->GetMenuCount();
|
int nCount = bar->GetMenuCount();
|
||||||
for (int n = 0; n < nCount; n++)
|
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
|
// 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();
|
wxNode* node = menu->GetItems().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -66,7 +63,7 @@ void wxFrame::DoMenuUpdates(wxMenu* menu, wxWindow* focusWin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetSubMenu())
|
if (item->GetSubMenu())
|
||||||
DoMenuUpdates(item->GetSubMenu(), focusWin);
|
DoMenuUpdates(item->GetSubMenu(), (wxWindow*) NULL);
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
@@ -149,28 +149,6 @@ bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown)
|
|||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetExtraLong((long) toggleDown);
|
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)
|
// Send events to this toolbar instead (and thence up the window hierarchy)
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
@@ -757,27 +735,7 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event)
|
|||||||
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
|
// Do the toolbar button updates (check for EVT_UPDATE_UI handlers)
|
||||||
void wxToolBarBase::DoToolbarUpdates()
|
void wxToolBarBase::DoToolbarUpdates()
|
||||||
{
|
{
|
||||||
// First try sending the command to a window that has the focus, within a frame that
|
wxEvtHandler* evtHandler = GetEventHandler() ;
|
||||||
// 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() ;
|
|
||||||
|
|
||||||
wxNode* node = GetTools().First();
|
wxNode* node = GetTools().First();
|
||||||
while (node)
|
while (node)
|
||||||
|
@@ -655,10 +655,7 @@ void wxFrame::Command( int id )
|
|||||||
bar->Check(id,!bar->Checked(id)) ;
|
bar->Check(id,!bar->Checked(id)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process events starting with the window with the focus, if any.
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
|
||||||
|
|
||||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
|
||||||
|
|
||||||
evtHandler->ProcessEvent(commandEvent);
|
evtHandler->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
|
@@ -169,28 +169,6 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
event.SetExtraLong((long) toggleDown);
|
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);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -655,10 +655,7 @@ void wxFrame::Command( int id )
|
|||||||
bar->Check(id,!bar->Checked(id)) ;
|
bar->Check(id,!bar->Checked(id)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process events starting with the window with the focus, if any.
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
|
||||||
|
|
||||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
|
||||||
|
|
||||||
evtHandler->ProcessEvent(commandEvent);
|
evtHandler->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
|
@@ -169,28 +169,6 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown )
|
|||||||
event.SetInt( toolIndex );
|
event.SetInt( toolIndex );
|
||||||
event.SetExtraLong((long) toggleDown);
|
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);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -869,10 +869,7 @@ void wxFrame::ProcessCommand(int id)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Process events starting with the window with the focus, if any.
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
|
||||||
|
|
||||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
|
||||||
|
|
||||||
evtHandler->ProcessEvent(commandEvent);
|
evtHandler->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
|
@@ -917,10 +917,14 @@ void wxFrame::ProcessCommand(int id)
|
|||||||
bar->Check(id,!bar->Checked(id)) ;
|
bar->Check(id,!bar->Checked(id)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// Process events starting with the window with the focus, if any.
|
// Process events starting with the window with the focus, if any.
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
wxWindow* focusWin = wxFindFocusDescendant(this);
|
||||||
|
|
||||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
||||||
|
*/
|
||||||
|
|
||||||
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
evtHandler->ProcessEvent(commandEvent);
|
evtHandler->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -191,6 +191,7 @@ MSWOBJS = \
|
|||||||
..\msw\$D\dib.obj \
|
..\msw\$D\dib.obj \
|
||||||
..\msw\$D\dibutils.obj \
|
..\msw\$D\dibutils.obj \
|
||||||
..\msw\$D\dirdlg.obj \
|
..\msw\$D\dirdlg.obj \
|
||||||
|
..\msw\$D\dragimag.obj \
|
||||||
..\msw\$D\filedlg.obj \
|
..\msw\$D\filedlg.obj \
|
||||||
..\msw\$D\font.obj \
|
..\msw\$D\font.obj \
|
||||||
..\msw\$D\fontdlg.obj \
|
..\msw\$D\fontdlg.obj \
|
||||||
|
@@ -451,11 +451,7 @@ void wxFrame::ProcessCommand(int id)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Process events starting with the window with the focus, if any.
|
wxEvtHandler* evtHandler = GetEventHandler();
|
||||||
wxWindow* focusWin = wxFindFocusDescendant(this);
|
|
||||||
|
|
||||||
wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler();
|
|
||||||
|
|
||||||
evtHandler->ProcessEvent(commandEvent);
|
evtHandler->ProcessEvent(commandEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user