X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f8845289521c7f53e95b6dfd8275daab8b05639..3db5226517a63bcdc983e638f1a312764fe1312f:/src/gtk1/control.cpp?ds=sidebyside diff --git a/src/gtk1/control.cpp b/src/gtk1/control.cpp index f8ea0c9dc3..afcd65c371 100644 --- a/src/gtk1/control.cpp +++ b/src/gtk1/control.cpp @@ -7,10 +7,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "control.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -103,7 +99,6 @@ void wxControl::PostCreation(const wxSize& size) // GetBestSize is called. gtk_widget_ensure_style(m_widget); - InheritAttributes(); ApplyWidgetStyle(); SetInitialBestSize(size); } @@ -204,7 +199,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if ( style && style->font_desc ) { wxNativeFontInfo info; - info.description = style->font_desc; + info.description = pango_font_description_copy(style->font_desc); attr.font = wxFont(info); } else @@ -232,41 +227,50 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(void), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNew_t widget_new, bool useBase, int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; } //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(const gchar*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromStr_t widget_new, bool useBase, int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(""); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; } //static wxVisualAttributes -wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustment*), +wxControl::GetDefaultAttributesFromGTKWidget(wxGtkWidgetNewFromAdj_t widget_new, bool useBase, int state) { wxVisualAttributes attr; + // NB: we need toplevel window so that GTK+ can find the right style + GtkWidget *wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); GtkWidget* widget = widget_new(NULL); + gtk_container_add(GTK_CONTAINER(wnd), widget); attr = GetDefaultAttributesFromGTKWidget(widget, useBase, state); - gtk_widget_destroy(widget); + gtk_widget_destroy(wnd); return attr; }