X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b387025d5d6ba9ca0d860b9962fdbbd5d0723dab..3e5f88c6d2cdb2d4b0de4f44146a9839dc55f129:/src/gtk/window.cpp?ds=sidebyside diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index def1a71657..3805f1ba5a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2580,6 +2580,9 @@ void wxWindowGTK::PostCreation() if (!WX_IS_PIZZA(gtk_widget_get_parent(m_widget)) && !GTK_IS_WINDOW(m_widget)) gtk_widget_set_size_request(m_widget, m_width, m_height); + // apply any font or color changes made before creation + GTKApplyWidgetStyle(); + InheritAttributes(); SetLayoutDirection(wxLayout_Default); @@ -4009,46 +4012,46 @@ void wxWindowGTK::GTKApplyToolTip(const char* tip) bool wxWindowGTK::SetBackgroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); - if (!wxWindowBase::SetBackgroundColour(colour)) return false; -#ifndef __WXGTK3__ - if (colour.IsOk()) + if (m_widget) { - // We need the pixel value e.g. for background clearing. - m_backgroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); - } +#ifndef __WXGTK3__ + if (colour.IsOk()) + { + // We need the pixel value e.g. for background clearing. + m_backgroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); + } #endif - // apply style change (forceStyle=true so that new style is applied - // even if the bg colour changed from valid to wxNullColour) - GTKApplyWidgetStyle(true); + // apply style change (forceStyle=true so that new style is applied + // even if the bg colour changed from valid to wxNullColour) + GTKApplyWidgetStyle(true); + } return true; } bool wxWindowGTK::SetForegroundColour( const wxColour &colour ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); - if (!wxWindowBase::SetForegroundColour(colour)) - { return false; - } -#ifndef __WXGTK3__ - if (colour.IsOk()) + if (m_widget) { - // We need the pixel value e.g. for background clearing. - m_foregroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); - } +#ifndef __WXGTK3__ + if (colour.IsOk()) + { + // We need the pixel value e.g. for background clearing. + m_foregroundColour.CalcPixel(gtk_widget_get_colormap(m_widget)); + } #endif - // apply style change (forceStyle=true so that new style is applied - // even if the bg colour changed from valid to wxNullColour): - GTKApplyWidgetStyle(true); + // apply style change (forceStyle=true so that new style is applied + // even if the bg colour changed from valid to wxNullColour): + GTKApplyWidgetStyle(true); + } return true; } @@ -4390,14 +4393,15 @@ GdkWindow *wxWindowGTK::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const bool wxWindowGTK::SetFont( const wxFont &font ) { - wxCHECK_MSG( m_widget != NULL, false, wxT("invalid window") ); - if (!wxWindowBase::SetFont(font)) return false; - // apply style change (forceStyle=true so that new style is applied - // even if the font changed from valid to wxNullFont): - GTKApplyWidgetStyle(true); + if (m_widget) + { + // apply style change (forceStyle=true so that new style is applied + // even if the font changed from valid to wxNullFont): + GTKApplyWidgetStyle(true); + } return true; }