// headers
// ---------------------------------------------------------------------------
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "mdi.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_MDI && !defined(__WXUNIVERSAL__)
#ifndef WX_PRECOMP
- #include "wx/setup.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/app.h"
#include "wx/log.h"
#endif
+#include "wx/stockitem.h"
#include "wx/mdi.h"
#include "wx/msw/private.h"
return win->MSWCommand(cmd, id);
}
+ if (wxCurrentPopupMenu)
+ {
+ wxMenu *popupMenu = wxCurrentPopupMenu;
+ wxCurrentPopupMenu = NULL;
+ if (popupMenu->MSWCommand(cmd, id))
+ return true;
+ }
+
// is it one of standard MDI commands?
WXWPARAM wParam = 0;
WXLPARAM lParam = 0;
bool wxMDIChildFrame::Show(bool show)
{
m_needsInitialShow = false;
- return wxFrame::Show(show);
+
+ if (!wxFrame::Show(show))
+ return false;
+
+ // KH: Without this call, new MDI children do not become active.
+ // This was added here after the same BringWindowToTop call was
+ // removed from wxTopLevelWindow::Show (November 2005)
+ if ( show )
+ ::BringWindowToTop(GetHwnd());
+
+ // we need to refresh the MDI frame window menu to include (or exclude if
+ // we've been hidden) this frame
+ wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
+ MDISetMenu(parent->GetClientWindow(), NULL, NULL);
+
+ return true;
}
// Set the client size (i.e. leave the calculation of borders etc.
bool wxMDIChildFrame::HandleWindowPosChanging(void *pos)
{
WINDOWPOS *lpPos = (WINDOWPOS *)pos;
-#if defined(__WIN95__)
+
if (!(lpPos->flags & SWP_NOSIZE))
{
RECT rectClient;
}
#endif
}
-#endif // Win95
return false;
}
minHeight = GetMinHeight();
// but allow GetSizeHints() to set the min size
- if ( minWidth != -1 )
+ if ( minWidth != wxDefaultCoord )
{
info->ptMinTrackSize.x = minWidth;
processed = true;
}
- if ( minHeight != -1 )
+ if ( minHeight != wxDefaultCoord )
{
info->ptMinTrackSize.y = minHeight;
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);
}
// ---------------------------------------------------------------------------
// style when a child is maximised (a double border looks silly.)
bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
{
-#if defined(__WIN95__)
RECT *rect = (RECT *)vrect;
wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild();
+
if (!pChild || (pChild == this))
{
HWND hwndClient = GetWinHwnd(pFrameWnd->GetClientWindow());
return true;
}
}
-#endif // Win95
return false;
}
if ( style & wxVSCROLL )
msStyle |= WS_VSCROLL;
-#if defined(__WIN95__)
DWORD exStyle = WS_EX_CLIENTEDGE;
-#else
- DWORD exStyle = 0;
-#endif
wxWindowCreationHook hook(this);
m_hWnd = (WXHWND)::CreateWindowEx
static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow)
{
- ::SendMessage(GetWinHwnd(win), WM_MDISETMENU,
-#ifdef __WIN32__
- (WPARAM)hmenuFrame, (LPARAM)hmenuWindow
-#else
- 0, MAKELPARAM(hmenuFrame, hmenuWindow)
-#endif
- );
+ if ( hmenuFrame || hmenuWindow )
+ {
+ if ( !::SendMessage(GetWinHwnd(win),
+ WM_MDISETMENU,
+ (WPARAM)hmenuFrame,
+ (LPARAM)hmenuWindow) )
+ {
+ wxLogLastError(_T("SendMessage(WM_MDISETMENU)"));
+ }
+ }
// update menu bar of the parent window
wxWindow *parent = win->GetParent();
continue;
}
- wxString strHelp(_("&Help"));
wxString strBuf(buf);
- if ( wxStripMenuCodes(strBuf) == wxStripMenuCodes(strHelp) )
+ if ( wxStripMenuCodes(strBuf) == wxGetStockLabel(wxID_HELP,false) )
{
success = true;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
}
#endif // wxUSE_MDI && !defined(__WXUNIVERSAL__)
-