::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0);
}
-// TODO: add a direction argument (hor/vert)
-void wxMDIParentFrame::Tile()
+void wxMDIParentFrame::Tile(wxOrientation orient)
{
- ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0);
+ wxASSERT_MSG( orient == wxHORIZONTAL || orient == wxVERTICAL,
+ _T("invalid orientation value") );
+
+ ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE,
+ orient == wxHORIZONTAL ? MDITILE_HORIZONTAL
+ : MDITILE_VERTICAL, 0);
}
void wxMDIParentFrame::ArrangeIcons()
break;
case WM_SIZE:
- // as we don't (usually) resize the MDI client to exactly fit the
- // client area (we put it below the toolbar, above statusbar &c),
- // we should not pass this one to DefFrameProc
+ // though we don't (usually) resize the MDI client to exactly fit the
+ // client area we need to pass this one to DefFrameProc to allow the children to show
break;
}
void wxMDIChildFrame::Init()
{
m_needsResize = true;
+ m_needsInitialShow = true;
}
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
const wxString& name)
{
SetName(name);
- wxWindowBase::Show(true); // MDI child frame starts off shown
if ( id != wxID_ANY )
m_windowId = id;
else
mcs.cy = CW_USEDEFAULT;
- DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ;
+ DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN;
if (style & wxMINIMIZE_BOX)
msflags |= WS_MINIMIZEBOX;
if (style & wxMAXIMIZE_BOX)
MSWDestroyWindow();
}
+bool wxMDIChildFrame::Show(bool show)
+{
+ m_needsInitialShow = false;
+ return wxFrame::Show(show);
+}
+
// Set the client size (i.e. leave the calculation of borders etc.
// to wxWidgets)
void wxMDIChildFrame::DoSetClientSize(int width, int height)
MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true);
- wxSizeEvent event(wxSize(width, height), m_windowId);
+ wxSize size(width, height);
+ wxSizeEvent event(size, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
void wxMDIChildFrame::OnIdle(wxIdleEvent& event)
{
+ // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted
+ // in flicker e.g. when the frame contained controls with non-trivial
+ // layout. Since 2.5.3, the frame is created hidden as all other top level
+ // windows. In order to maintain backward compatibility, the frame is shown
+ // in OnIdle, unless Show(false) was called by the programmer before.
+ if ( m_needsInitialShow )
+ {
+ Show(true);
+ }
+
// 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