Small change to SetFont() logic.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,6 +62,8 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( m_label.mbc_str() );
|
m_widget = gtk_label_new( m_label.mbc_str() );
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
justify = GTK_JUSTIFY_CENTER;
|
justify = GTK_JUSTIFY_CENTER;
|
||||||
@@ -89,8 +91,6 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -2758,7 +2758,7 @@ void wxWindow::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
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_NORMAL] = *m_foregroundColour.GetColor();
|
||||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||||
@@ -2766,7 +2766,7 @@ void wxWindow::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
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->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_PRELIGHT] = *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))
|
if (!wxWindowBase::SetFont(font))
|
||||||
{
|
{
|
||||||
// don't leave if the GTK widget has just
|
return FALSE;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
@@ -62,6 +62,8 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
wxControl::SetLabel(label);
|
wxControl::SetLabel(label);
|
||||||
m_widget = gtk_label_new( m_label.mbc_str() );
|
m_widget = gtk_label_new( m_label.mbc_str() );
|
||||||
|
|
||||||
|
SetFont( parent->GetFont() );
|
||||||
|
|
||||||
GtkJustification justify;
|
GtkJustification justify;
|
||||||
if ( style & wxALIGN_CENTER )
|
if ( style & wxALIGN_CENTER )
|
||||||
justify = GTK_JUSTIFY_CENTER;
|
justify = GTK_JUSTIFY_CENTER;
|
||||||
@@ -89,8 +91,6 @@ bool wxStaticText::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetBackgroundColour( parent->GetBackgroundColour() );
|
SetBackgroundColour( parent->GetBackgroundColour() );
|
||||||
SetForegroundColour( parent->GetForegroundColour() );
|
SetForegroundColour( parent->GetForegroundColour() );
|
||||||
SetFont( parent->GetFont() );
|
|
||||||
|
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -2758,7 +2758,7 @@ void wxWindow::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_foregroundColour.Ok())
|
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_NORMAL] = *m_foregroundColour.GetColor();
|
||||||
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
|
||||||
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
|
||||||
@@ -2766,7 +2766,7 @@ void wxWindow::SetWidgetStyle()
|
|||||||
|
|
||||||
if (m_backgroundColour.Ok())
|
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->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
|
||||||
style->bg[GTK_STATE_PRELIGHT] = *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))
|
if (!wxWindowBase::SetFont(font))
|
||||||
{
|
{
|
||||||
// don't leave if the GTK widget has just
|
return FALSE;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
|
||||||
|
Reference in New Issue
Block a user