// 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"
//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;
}