do allow calling Hide() on the window before it is created

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-05-20 13:16:53 +00:00
parent 09e02fc7a2
commit 3cc5704485

View File

@@ -2824,28 +2824,39 @@ void wxWindowGTK::DoScreenToClient( int *x, int *y ) const
bool wxWindowGTK::Show( bool show )
{
wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") );
if (!wxWindowBase::Show(show))
if ( !wxWindowBase::Show(show) )
{
// nothing to do
return false;
}
if (show && m_showOnIdle)
// notice that we may call Hide() before the window is created and this is
// actually useful to create it hidden initially -- but we can't call
// Show() before it is created
if ( !m_widget )
{
// deferred
wxASSERT_MSG( !show, "can't show invalid window" );
return true;
}
else
if ( show )
{
if (show)
gtk_widget_show(m_widget);
else
gtk_widget_hide(m_widget);
wxShowEvent eventShow(GetId(), show);
eventShow.SetEventObject(this);
HandleWindowEvent(eventShow);
if ( m_showOnIdle )
{
// defer until later
return true;
}
gtk_widget_show(m_widget);
}
else // hide
{
gtk_widget_hide(m_widget);
}
wxShowEvent eventShow(GetId(), show);
eventShow.SetEventObject(this);
HandleWindowEvent(eventShow);
return true;
}