merged 2.2 branch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -132,6 +132,10 @@ BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame)
|
||||
EVT_IDLE(wxMDIChildFrame::OnIdle)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
END_EVENT_TABLE()
|
||||
@@ -222,6 +226,9 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
|
||||
wxModelessWindows.Append(this);
|
||||
|
||||
// unlike (almost?) all other windows, frames are created hidden
|
||||
m_isShown = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -559,8 +566,7 @@ bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd)
|
||||
{
|
||||
// this shouldn't happen because it means that our messages are being
|
||||
// lost (they're not sent to the parent frame nor to the children)
|
||||
wxFAIL_MSG(wxT("MDI parent frame is not active, "
|
||||
"yet there is no active MDI child?"));
|
||||
wxFAIL_MSG(wxT("MDI parent frame is not active, yet there is no active MDI child?"));
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -583,17 +589,20 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
{
|
||||
MSG *pMsg = (MSG *)msg;
|
||||
|
||||
// first let the current child get it
|
||||
if ( m_currentChild && m_currentChild->GetHWND() &&
|
||||
m_currentChild->MSWTranslateMessage(msg) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( m_acceleratorTable.Translate(this, msg) )
|
||||
// then try out accel table (will also check the menu accels)
|
||||
if ( wxFrame::MSWTranslateMessage(msg) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// finally, check for MDI specific built in accel keys
|
||||
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN )
|
||||
{
|
||||
if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg))
|
||||
@@ -607,8 +616,9 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
// wxMDIChildFrame
|
||||
// ===========================================================================
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
void wxMDIChildFrame::Init()
|
||||
{
|
||||
m_needsResize = TRUE;
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
@@ -1136,7 +1146,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
||||
(LPSTR)(LPCLIENTCREATESTRUCT)&ccs);
|
||||
if ( !m_hWnd )
|
||||
{
|
||||
wxLogLastError("CreateWindowEx(MDI client)");
|
||||
wxLogLastError(wxT("CreateWindowEx(MDI client)"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1196,6 +1206,22 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
|
||||
}
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
|
||||
{
|
||||
// MDI child frames get their WM_SIZE when they're constructed but at this
|
||||
// moment they don't have any children yet so all child windows will be
|
||||
// positioned incorrectly when they are added later - to fix this, we
|
||||
// generate an artificial size event here
|
||||
if ( m_needsResize )
|
||||
{
|
||||
m_needsResize = FALSE; // avoid any possibility of recursion
|
||||
|
||||
SendSizeEvent();
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// non member functions
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -1204,10 +1230,11 @@ static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
|
||||
{
|
||||
::SendMessage(GetWinHwnd(win), WM_MDISETMENU,
|
||||
#ifdef __WIN32__
|
||||
(WPARAM)hmenuFrame, (LPARAM)hmenuWindow);
|
||||
(WPARAM)hmenuFrame, (LPARAM)hmenuWindow
|
||||
#else
|
||||
0, MAKELPARAM(hmenuFrame, hmenuWindow));
|
||||
0, MAKELPARAM(hmenuFrame, hmenuWindow)
|
||||
#endif
|
||||
);
|
||||
|
||||
// update menu bar of the parent window
|
||||
wxWindow *parent = win->GetParent();
|
||||
@@ -1236,18 +1263,18 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( wxStripMenuCodes(wxString(buf)).IsSameAs(wxT("Help")) )
|
||||
if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) )
|
||||
{
|
||||
success = TRUE;
|
||||
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
|
||||
(UINT)subMenu, wxT("&Window"));
|
||||
(UINT)subMenu, _("&Window"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !success )
|
||||
{
|
||||
::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, wxT("&Window"));
|
||||
::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1271,7 +1298,7 @@ static void RemoveWindowMenu(wxWindow *win, WXHMENU menu)
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( wxStripMenuCodes(wxString(buf)).IsSameAs(wxT("Window")) )
|
||||
if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Window")) )
|
||||
{
|
||||
success = TRUE;
|
||||
::RemoveMenu(hmenu, i, MF_BYPOSITION);
|
||||
|
Reference in New Issue
Block a user