From: Robert Roebling Date: Sun, 14 Nov 1999 17:04:36 +0000 (+0000) Subject: Small change to SetFont() logic. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/454e2a22c0af20663f302565e1835d820ee1b6dd Small change to SetFont() logic. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index 2055e54fd5..011b4b21a6 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -62,6 +62,8 @@ bool wxStaticText::Create(wxWindow *parent, wxControl::SetLabel(label); m_widget = gtk_label_new( m_label.mbc_str() ); + SetFont( parent->GetFont() ); + GtkJustification justify; if ( style & wxALIGN_CENTER ) justify = GTK_JUSTIFY_CENTER; @@ -89,8 +91,6 @@ bool wxStaticText::Create(wxWindow *parent, SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index fc518a25ab..3a99320b83 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2758,7 +2758,7 @@ void wxWindow::SetWidgetStyle() if (m_foregroundColour.Ok()) { - m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) ); style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); @@ -2766,7 +2766,7 @@ void wxWindow::SetWidgetStyle() if (m_backgroundColour.Ok()) { - m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) ); style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); @@ -2896,26 +2896,7 @@ bool wxWindow::SetFont( const wxFont &font ) if (!wxWindowBase::SetFont(font)) { - // don't leave if the GTK widget has just - // been realized - if (!m_delayedFont) return FALSE; - } - - GdkWindow *window = (GdkWindow*) NULL; - if (m_wxwindow) - window = GTK_PIZZA(m_wxwindow)->bin_window; - else - window = GetConnectWidget()->window; - - if (!window) - { - // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedFont = TRUE; - - // pretend we have done something - return TRUE; + return FALSE; } wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ); diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index 2055e54fd5..011b4b21a6 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -62,6 +62,8 @@ bool wxStaticText::Create(wxWindow *parent, wxControl::SetLabel(label); m_widget = gtk_label_new( m_label.mbc_str() ); + SetFont( parent->GetFont() ); + GtkJustification justify; if ( style & wxALIGN_CENTER ) justify = GTK_JUSTIFY_CENTER; @@ -89,8 +91,6 @@ bool wxStaticText::Create(wxWindow *parent, SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); - SetFont( parent->GetFont() ); - Show( TRUE ); return TRUE; diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index fc518a25ab..3a99320b83 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2758,7 +2758,7 @@ void wxWindow::SetWidgetStyle() if (m_foregroundColour.Ok()) { - m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + m_foregroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) ); style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); @@ -2766,7 +2766,7 @@ void wxWindow::SetWidgetStyle() if (m_backgroundColour.Ok()) { - m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + m_backgroundColour.CalcPixel( gtk_widget_get_colormap( m_widget ) ); style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); @@ -2896,26 +2896,7 @@ bool wxWindow::SetFont( const wxFont &font ) if (!wxWindowBase::SetFont(font)) { - // don't leave if the GTK widget has just - // been realized - if (!m_delayedFont) return FALSE; - } - - GdkWindow *window = (GdkWindow*) NULL; - if (m_wxwindow) - window = GTK_PIZZA(m_wxwindow)->bin_window; - else - window = GetConnectWidget()->window; - - if (!window) - { - // indicate that a new style has been set - // but it couldn't get applied as the - // widget hasn't been realized yet. - m_delayedFont = TRUE; - - // pretend we have done something - return TRUE; + return FALSE; } wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );