From 987b30982754518c1939468d76acf016499ff06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Mon, 11 Nov 2002 00:03:19 +0000 Subject: [PATCH] fixed wxSYS_DEFAULT_GUI_FONT (I wonder how could it work for anybody before...) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/settings.cpp | 20 +++++++++++++++++++- src/gtk1/settings.cpp | 20 +++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 9aed45b5a9..736ed76aba 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -16,6 +16,7 @@ #include "wx/debug.h" #include "wx/module.h" #include "wx/cmndata.h" +#include "wx/fontutil.h" #include #include @@ -326,8 +327,25 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) { if (!g_systemFont) { +#ifdef __WXGTK20__ + GtkWidget *widget = gtk_button_new(); + GtkStyle *def = gtk_rc_get_style( widget ); + if (!def) + def = gtk_widget_get_default_style(); + if (def) + { + wxNativeFontInfo info; + info.description = def->font_desc; + g_systemFont = new wxFont(info); + } + else + { + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } + gtk_widget_destroy( widget ); +#else g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); - +#endif } return *g_systemFont; } diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 9aed45b5a9..736ed76aba 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -16,6 +16,7 @@ #include "wx/debug.h" #include "wx/module.h" #include "wx/cmndata.h" +#include "wx/fontutil.h" #include #include @@ -326,8 +327,25 @@ wxFont wxSystemSettingsNative::GetFont( wxSystemFont index ) { if (!g_systemFont) { +#ifdef __WXGTK20__ + GtkWidget *widget = gtk_button_new(); + GtkStyle *def = gtk_rc_get_style( widget ); + if (!def) + def = gtk_widget_get_default_style(); + if (def) + { + wxNativeFontInfo info; + info.description = def->font_desc; + g_systemFont = new wxFont(info); + } + else + { + g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); + } + gtk_widget_destroy( widget ); +#else g_systemFont = new wxFont( 12, wxSWISS, wxNORMAL, wxNORMAL ); - +#endif } return *g_systemFont; }