// headers
// ---------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "mdi.h"
#endif
#pragma hdrstop
#endif
+#if wxUSE_MDI && !defined(__WXUNIVERSAL__)
+
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/frame.h"
#include "wx/log.h"
#endif
-#if wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__)
-
#include "wx/mdi.h"
#include "wx/msw/private.h"
// global variables
// ---------------------------------------------------------------------------
-extern wxWindowList wxModelessWindows; // from dialog.cpp
extern wxMenu *wxCurrentPopupMenu;
extern const wxChar *wxMDIFrameClassName; // from app.cpp
return false;
}
- wxModelessWindows.Append(this);
-
// unlike (almost?) all other windows, frames are created hidden
m_isShown = false;
wxMDIParentFrame::~wxMDIParentFrame()
{
- DestroyChildren();
-
- // already delete by DestroyChildren()
+ // see comment in ~wxMDIChildFrame
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
+#endif
m_frameStatusBar = NULL;
+ DestroyChildren();
+
if (m_windowMenu)
{
delete m_windowMenu;
WXHICON wxMDIParentFrame::GetDefaultIcon() const
{
- return (WXHICON)(wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON
- : wxDEFAULT_MDIPARENTFRAME_ICON);
+ // we don't have any standard icons (any more)
+ return (WXHICON)0;
}
// ---------------------------------------------------------------------------
// the MDI parent frame window proc
// ---------------------------------------------------------------------------
-long wxMDIParentFrame::MSWWindowProc(WXUINT message,
+WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam)
{
- long rc = 0;
+ WXLRESULT rc = 0;
bool processed = false;
switch ( message )
if ( IsMdiCommandId(id) )
{
- wxWindowList::Node *node = GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
while ( node )
{
wxWindow *child = node->GetData();
return false;
}
-long wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
+WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam)
{
MDICREATESTRUCT mcs;
- mcs.szClass = style & wxNO_FULL_REPAINT_ON_RESIZE
- ? wxMDIChildFrameClassNameNoRedraw
- : wxMDIChildFrameClassName;
+ mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
+ ? wxMDIChildFrameClassName
+ : wxMDIChildFrameClassNameNoRedraw;
mcs.szTitle = title;
mcs.hOwner = wxGetInstance();
if (x > -1)
else
mcs.cy = CW_USEDEFAULT;
- DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_THICKFRAME | WS_VISIBLE ;
+ DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ;
if (style & wxMINIMIZE_BOX)
msflags |= WS_MINIMIZEBOX;
if (style & wxMAXIMIZE_BOX)
wxAssociateWinWithHandle((HWND) GetHWND(), this);
- wxModelessWindows.Append(this);
-
return true;
}
wxMDIChildFrame::~wxMDIChildFrame()
{
- DestroyChildren();
-
- // already deleted by DestroyChildren()
+ // will be destroyed by DestroyChildren() but reset them before calling it
+ // to avoid using dangling pointers if a callback comes in the meanwhile
+#if wxUSE_TOOLBAR
m_frameToolBar = NULL;
+#endif
m_frameStatusBar = NULL;
+ DestroyChildren();
+
RemoveWindowMenu(NULL, m_hMenu);
MSWDestroyWindow();
}
// Set the client size (i.e. leave the calculation of borders etc.
-// to wxWindows)
+// to wxWidgets)
void wxMDIChildFrame::DoSetClientSize(int width, int height)
{
HWND hWnd = GetHwnd();
WXHICON wxMDIChildFrame::GetDefaultIcon() const
{
- return (WXHICON)(wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON
- : wxDEFAULT_MDICHILDFRAME_ICON);
+ // we don't have any standard icons (any more)
+ return (WXHICON)0;
}
// ---------------------------------------------------------------------------
// MDI window proc and message handlers
// ---------------------------------------------------------------------------
-long wxMDIChildFrame::MSWWindowProc(WXUINT message,
+WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam)
{
- long rc = 0;
+ WXLRESULT rc = 0;
bool processed = false;
switch ( message )
lpPos->cx = rectClient.right - rectClient.left;
lpPos->cy = rectClient.bottom - rectClient.top;
}
+#if wxUSE_TOOLBAR
wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent();
if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown())
{
pFrameWnd->GetToolBar()->Refresh();
}
+#endif
}
#endif // Win95
processed = true;
}
- return true;
+ return processed;
}
// ---------------------------------------------------------------------------
// MDI specific message translation/preprocessing
// ---------------------------------------------------------------------------
-long wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXUINT wParam, WXLPARAM lParam)
+WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
return DefMDIChildProc(GetHwnd(),
(UINT)message, (WPARAM)wParam, (LPARAM)lParam);
{
if (GetParent())
{
- wxWindowList::Node *node = GetParent()->GetChildren().GetFirst();
+ wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst();
while (node)
{
wxWindow *child = node->GetData();
wxWindow *parent = win->GetParent();
wxCHECK_RET( parent, wxT("MDI client without parent frame? weird...") );
-#ifndef __WIN16__
::SendMessage(GetWinHwnd(win), WM_MDIREFRESHMENU, 0, 0L);
-#endif
::DrawMenuBar(GetWinHwnd(parent));
}
static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam,
WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact)
{
-#ifdef __WIN32__
*activate = true;
*hwndAct = (WXHWND)lParam;
*hwndDeact = (WXHWND)wParam;
-#else // Win16
- *activate = (WXWORD)wParam;
- *hwndAct = (WXHWND)LOWORD(lParam);
- *hwndDeact = (WXHWND)HIWORD(lParam);
-#endif // Win32/Win16
}
-#endif
-// wxUSE_MDI_ARCHITECTURE && !defined(__WXUNIVERSAL__)
+#endif // wxUSE_MDI && !defined(__WXUNIVERSAL__)