extracted wxFrame::MSWTranslateMessage() implementation into new MSWDoTranslateMessage so that it can be reused by wxMDIChildFrame; this allows to pass the correct window to ::TranslateAccelerator() and fix UI updating of the MDI child menu items (bug 1214439)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
a1a1ca8998
commit
1ac7660914
@ -122,13 +122,22 @@ protected:
|
|||||||
// propagate our state change to all child frames
|
// propagate our state change to all child frames
|
||||||
void IconizeChildFrames(bool bIconize);
|
void IconizeChildFrames(bool bIconize);
|
||||||
|
|
||||||
// we add menu bar accel processing
|
// override base class version to add menu bar accel processing
|
||||||
bool MSWTranslateMessage(WXMSG* pMsg);
|
virtual bool MSWTranslateMessage(WXMSG *msg)
|
||||||
|
{
|
||||||
|
return MSWDoTranslateMessage(this, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the real implementation of MSWTranslateMessage(), also used by
|
||||||
|
// wxMDIChildFrame
|
||||||
|
bool MSWDoTranslateMessage(wxFrame *frame, WXMSG *msg);
|
||||||
|
|
||||||
// window proc for the frames
|
// window proc for the frames
|
||||||
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
virtual WXLRESULT MSWWindowProc(WXUINT message,
|
||||||
|
WXWPARAM wParam,
|
||||||
|
WXLPARAM lParam);
|
||||||
|
|
||||||
// handle WM_INITMENUPOPUP message
|
// handle WM_INITMENUPOPUP message to generate wxEVT_MENU_OPEN
|
||||||
bool HandleInitMenuPopup(WXHMENU hMenu);
|
bool HandleInitMenuPopup(WXHMENU hMenu);
|
||||||
|
|
||||||
virtual bool IsMDIChild() const { return false; }
|
virtual bool IsMDIChild() const { return false; }
|
||||||
|
@ -726,7 +726,7 @@ WXHICON wxFrame::GetDefaultIcon() const
|
|||||||
// preprocessing
|
// preprocessing
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
|
bool wxFrame::MSWDoTranslateMessage(wxFrame *frame, WXMSG *pMsg)
|
||||||
{
|
{
|
||||||
if ( wxWindow::MSWTranslateMessage(pMsg) )
|
if ( wxWindow::MSWTranslateMessage(pMsg) )
|
||||||
return true;
|
return true;
|
||||||
@ -737,7 +737,7 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
|
|||||||
if ( menuBar )
|
if ( menuBar )
|
||||||
{
|
{
|
||||||
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
|
const wxAcceleratorTable& acceleratorTable = menuBar->GetAccelTable();
|
||||||
return acceleratorTable.Translate(this, pMsg);
|
return acceleratorTable.Translate(frame, pMsg);
|
||||||
}
|
}
|
||||||
#endif // wxUSE_MENUS && wxUSE_ACCEL
|
#endif // wxUSE_MENUS && wxUSE_ACCEL
|
||||||
|
|
||||||
|
@ -1165,7 +1165,9 @@ WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXL
|
|||||||
|
|
||||||
bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
||||||
{
|
{
|
||||||
return wxFrame::MSWTranslateMessage(msg);
|
// we must pass the parent frame to ::TranslateAccelerator(), otherwise it
|
||||||
|
// doesn't do its job correctly for MDI child menus
|
||||||
|
return MSWDoTranslateMessage((wxMDIChildFrame *)GetParent(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user