fixed flicker during MDI children creation: the frame is now created hidden and shown in idle time to maintain backward compatibility
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -175,6 +175,8 @@ public:
|
|||||||
|
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DoGetPosition(int *x, int *y) const;
|
virtual void DoGetPosition(int *x, int *y) const;
|
||||||
virtual void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
@@ -187,6 +189,7 @@ protected:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_needsInitialShow; // Show must be called in idle time after Creation
|
||||||
bool m_needsResize; // flag which tells us to artificially resize the frame
|
bool m_needsResize; // flag which tells us to artificially resize the frame
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
@@ -670,6 +670,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
|||||||
void wxMDIChildFrame::Init()
|
void wxMDIChildFrame::Init()
|
||||||
{
|
{
|
||||||
m_needsResize = true;
|
m_needsResize = true;
|
||||||
|
m_needsInitialShow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||||
@@ -681,7 +682,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
SetName(name);
|
SetName(name);
|
||||||
wxWindowBase::Show(true); // MDI child frame starts off shown
|
|
||||||
|
|
||||||
if ( id != wxID_ANY )
|
if ( id != wxID_ANY )
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
@@ -725,7 +725,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
else
|
else
|
||||||
mcs.cy = CW_USEDEFAULT;
|
mcs.cy = CW_USEDEFAULT;
|
||||||
|
|
||||||
DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ;
|
DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN;
|
||||||
if (style & wxMINIMIZE_BOX)
|
if (style & wxMINIMIZE_BOX)
|
||||||
msflags |= WS_MINIMIZEBOX;
|
msflags |= WS_MINIMIZEBOX;
|
||||||
if (style & wxMAXIMIZE_BOX)
|
if (style & wxMAXIMIZE_BOX)
|
||||||
@@ -773,6 +773,12 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
MSWDestroyWindow();
|
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.
|
// Set the client size (i.e. leave the calculation of borders etc.
|
||||||
// to wxWidgets)
|
// to wxWidgets)
|
||||||
void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
void wxMDIChildFrame::DoSetClientSize(int width, int height)
|
||||||
@@ -1303,6 +1309,16 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
|
|||||||
|
|
||||||
void wxMDIChildFrame::OnIdle(wxIdleEvent& 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
|
// 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
|
// 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
|
// positioned incorrectly when they are added later - to fix this, we
|
||||||
|
Reference in New Issue
Block a user