From 076e41016dab3248e9772ca5e4e33e8e3af6c02c Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 1 May 2000 19:04:30 +0000 Subject: [PATCH] Tried to fix problem with wrong fonts in tool tips. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/font.cpp | 2 +- src/gtk/settings.cpp | 14 +++----------- src/gtk/tbargtk.cpp | 5 ++++- src/gtk/tooltip.cpp | 6 +++++- src/gtk1/font.cpp | 2 +- src/gtk1/settings.cpp | 14 +++----------- src/gtk1/tbargtk.cpp | 5 ++++- src/gtk1/tooltip.cpp | 6 +++++- 8 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 26a9ba0dcb..8cb33978d1 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -397,7 +397,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; -static GdkFont *GtkGetDefaultGuiFont() +GdkFont *GtkGetDefaultGuiFont() { if (!g_systemDefaultGuiFont) { diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index a0981988a2..0adcfd51b3 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -21,6 +21,8 @@ #include #include +extern GdkFont *GtkGetDefaultGuiFont(); + /* #define wxSYS_COLOUR_SCROLLBAR 0 @@ -234,17 +236,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) if (!g_systemFont) { #if 0 - GdkFont *gdk_font = (GdkFont*) NULL; - GtkWidget *widget = gtk_button_new(); - GtkStyle *def = gtk_rc_get_style( widget ); - if (def) - gdk_font = def->font; - else - { - def = gtk_widget_get_default_style(); - if (def) - gdk_font = def->font; - } + GdkFont *gdk_font = GtkGetDefaultGuiFont(); if (gdk_font) { GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 6e58b78a54..b85ed54228 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -33,6 +33,8 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -303,8 +305,9 @@ bool wxToolBar::Create( wxWindow *parent, GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) ); g_style->bg[GTK_STATE_NORMAL] = *m_bg; + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style ); - m_parent->DoAddChild( this ); diff --git a/src/gtk/tooltip.cpp b/src/gtk/tooltip.cpp index a80317beeb..109f4658a6 100644 --- a/src/gtk/tooltip.cpp +++ b/src/gtk/tooltip.cpp @@ -21,6 +21,8 @@ #include "gtk/gtk.h" #include "gdk/gdk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- @@ -72,7 +74,9 @@ void wxToolTip::Apply( wxWindow *win ) g_style->fg[GTK_STATE_NORMAL] = ss_fg; g_style->bg[GTK_STATE_NORMAL] = ss_bg; - + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); + gtk_widget_set_style( ss_tooltips->tip_window, g_style ); #else gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg ); diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 26a9ba0dcb..8cb33978d1 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -397,7 +397,7 @@ void wxFont::SetEncoding(wxFontEncoding encoding) static GdkFont *g_systemDefaultGuiFont = (GdkFont*) NULL; -static GdkFont *GtkGetDefaultGuiFont() +GdkFont *GtkGetDefaultGuiFont() { if (!g_systemDefaultGuiFont) { diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index a0981988a2..0adcfd51b3 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -21,6 +21,8 @@ #include #include +extern GdkFont *GtkGetDefaultGuiFont(); + /* #define wxSYS_COLOUR_SCROLLBAR 0 @@ -234,17 +236,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) if (!g_systemFont) { #if 0 - GdkFont *gdk_font = (GdkFont*) NULL; - GtkWidget *widget = gtk_button_new(); - GtkStyle *def = gtk_rc_get_style( widget ); - if (def) - gdk_font = def->font; - else - { - def = gtk_widget_get_default_style(); - if (def) - gdk_font = def->font; - } + GdkFont *gdk_font = GtkGetDefaultGuiFont(); if (gdk_font) { GSList *font_list = ((GdkFontPrivate*)gdk_font)->names; diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 6e58b78a54..b85ed54228 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -33,6 +33,8 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + // ---------------------------------------------------------------------------- // globals // ---------------------------------------------------------------------------- @@ -303,8 +305,9 @@ bool wxToolBar::Create( wxWindow *parent, GTK_TOOLBAR(m_toolbar)->tooltips->tip_window ) ); g_style->bg[GTK_STATE_NORMAL] = *m_bg; + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); gtk_widget_set_style( GTK_TOOLBAR(m_toolbar)->tooltips->tip_window, g_style ); - m_parent->DoAddChild( this ); diff --git a/src/gtk1/tooltip.cpp b/src/gtk1/tooltip.cpp index a80317beeb..109f4658a6 100644 --- a/src/gtk1/tooltip.cpp +++ b/src/gtk1/tooltip.cpp @@ -21,6 +21,8 @@ #include "gtk/gtk.h" #include "gdk/gdk.h" +extern GdkFont *GtkGetDefaultGuiFont(); + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- @@ -72,7 +74,9 @@ void wxToolTip::Apply( wxWindow *win ) g_style->fg[GTK_STATE_NORMAL] = ss_fg; g_style->bg[GTK_STATE_NORMAL] = ss_bg; - + gdk_font_unref( g_style->font ); + g_style->font = gdk_font_ref( GtkGetDefaultGuiFont() ); + gtk_widget_set_style( ss_tooltips->tip_window, g_style ); #else gtk_tooltips_set_colors( ss_tooltips, &ss_bg, &ss_fg );