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:
parent
e768548a12
commit
2596e9fb2c
@ -174,6 +174,8 @@ public:
|
||||
bool ResetWindowStyle(void *vrect);
|
||||
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
virtual bool Show(bool show = true);
|
||||
|
||||
protected:
|
||||
virtual void DoGetPosition(int *x, int *y) const;
|
||||
@ -187,6 +189,7 @@ protected:
|
||||
void Init();
|
||||
|
||||
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
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
@ -670,6 +670,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
void wxMDIChildFrame::Init()
|
||||
{
|
||||
m_needsResize = true;
|
||||
m_needsInitialShow = true;
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
@ -681,7 +682,6 @@ 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;
|
||||
@ -725,7 +725,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
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)
|
||||
@ -773,6 +773,12 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
||||
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)
|
||||
@ -1303,6 +1309,16 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user