allow setting window font and bg/fg color before creation

wxMSW and wxOSX don't have a problem with it, so neither should wxGTK

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2013-01-10 06:53:14 +00:00
parent b387025d5d
commit 92ef38ee6b

View File

@@ -2020,6 +2020,8 @@ void wxWindowGTK::GTKHandleRealized()
} }
#endif #endif
GTKApplyWidgetStyle();
wxWindowCreateEvent event(static_cast<wxWindow*>(this)); wxWindowCreateEvent event(static_cast<wxWindow*>(this));
event.SetEventObject( this ); event.SetEventObject( this );
GTKProcessEvent( event ); GTKProcessEvent( event );
@@ -4009,11 +4011,11 @@ void wxWindowGTK::GTKApplyToolTip(const char* tip)
bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
{ {
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );
if (!wxWindowBase::SetBackgroundColour(colour)) if (!wxWindowBase::SetBackgroundColour(colour))
return false; return false;
if (m_widget)
{
#ifndef __WXGTK3__ #ifndef __WXGTK3__
if (colour.IsOk()) if (colour.IsOk())
{ {
@@ -4025,19 +4027,18 @@ bool wxWindowGTK::SetBackgroundColour( const wxColour &colour )
// apply style change (forceStyle=true so that new style is applied // apply style change (forceStyle=true so that new style is applied
// even if the bg colour changed from valid to wxNullColour) // even if the bg colour changed from valid to wxNullColour)
GTKApplyWidgetStyle(true); GTKApplyWidgetStyle(true);
}
return true; return true;
} }
bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
{ {
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );
if (!wxWindowBase::SetForegroundColour(colour)) if (!wxWindowBase::SetForegroundColour(colour))
{
return false; return false;
}
if (m_widget)
{
#ifndef __WXGTK3__ #ifndef __WXGTK3__
if (colour.IsOk()) if (colour.IsOk())
{ {
@@ -4049,6 +4050,7 @@ bool wxWindowGTK::SetForegroundColour( const wxColour &colour )
// apply style change (forceStyle=true so that new style is applied // apply style change (forceStyle=true so that new style is applied
// even if the bg colour changed from valid to wxNullColour): // even if the bg colour changed from valid to wxNullColour):
GTKApplyWidgetStyle(true); GTKApplyWidgetStyle(true);
}
return true; return true;
} }
@@ -4390,14 +4392,15 @@ GdkWindow *wxWindowGTK::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
bool wxWindowGTK::SetFont( const wxFont &font ) bool wxWindowGTK::SetFont( const wxFont &font )
{ {
wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") );
if (!wxWindowBase::SetFont(font)) if (!wxWindowBase::SetFont(font))
return false; return false;
if (m_widget)
{
// apply style change (forceStyle=true so that new style is applied // apply style change (forceStyle=true so that new style is applied
// even if the font changed from valid to wxNullFont): // even if the font changed from valid to wxNullFont):
GTKApplyWidgetStyle(true); GTKApplyWidgetStyle(true);
}
return true; return true;
} }