+bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom);
+
+// ----------------------------------------------------------------------------
+// wxSystemObjects
+// ----------------------------------------------------------------------------
+
+struct wxSystemObjects
+{
+ wxColour m_colBtnFace,
+ m_colBtnShadow,
+ m_colBtnHighlight,
+ m_colHighlight,
+ m_colHighlightText,
+ m_colListBox,
+ m_colWindow,
+ m_colWindowText,
+ m_colBtnText,
+ m_colMenuItemHighlight,
+ m_colTooltip,
+ m_colTooltipText,
+ m_colMenubarBg;
+
+ wxFont m_fontSystem;
+};
+
+static wxSystemObjects gs_objects;
+
+void wxClearGtkSystemObjects()
+{
+ gs_objects.m_colBtnFace = wxColour();
+ gs_objects.m_colBtnShadow = wxColour();
+ gs_objects.m_colBtnHighlight = wxColour();
+ gs_objects.m_colHighlightText = wxColour();
+ gs_objects.m_colListBox = wxColour();
+ gs_objects.m_colWindow = wxColour();
+ gs_objects.m_colWindowText = wxColour();
+ gs_objects.m_colBtnText = wxColour();
+ gs_objects.m_colMenuItemHighlight = wxColour();
+ gs_objects.m_colTooltip = wxColour();
+ gs_objects.m_colTooltipText = wxColour();
+ gs_objects.m_colMenubarBg = wxColour();
+ gs_objects.m_fontSystem = wxNullFont;
+}
+
+// ----------------------------------------------------------------------------
+// wxSystemSettings implementation
+// ----------------------------------------------------------------------------
+
+// kind of widget to use in GetColourFromGTKWidget
+enum wxGtkWidgetType
+{
+ wxGTK_BUTTON,
+ wxGTK_LIST,
+ wxGTK_MENUITEM,
+ wxGTK_TEXTCTRL,
+ wxGTK_MENUBAR,
+};
+
+// the colour we need
+enum wxGtkColourType
+{
+ wxGTK_FG,
+ wxGTK_BG,
+ wxGTK_BASE
+};
+
+// wxSystemSettings::GetColour() helper: get the colours from a GTK+
+// widget style, return true if we did get them
+static bool GetColourFromGTKWidget(GdkColor& gdkColor,
+ wxGtkWidgetType type = wxGTK_BUTTON,
+ GtkStateType state = GTK_STATE_NORMAL,
+ wxGtkColourType colour = wxGTK_BG)
+{
+ GtkWidget *widget;
+ switch ( type )
+ {
+ default:
+ wxFAIL_MSG( _T("unexpected GTK widget type") );
+ // fall through
+
+ case wxGTK_BUTTON:
+ widget = gtk_button_new();
+ break;
+
+ case wxGTK_TEXTCTRL:
+ widget = gtk_text_view_new();
+ break;
+
+ case wxGTK_LIST:
+ widget = gtk_tree_view_new_with_model(
+ (GtkTreeModel*)gtk_list_store_new(1, G_TYPE_INT));
+ break;
+
+ case wxGTK_MENUITEM:
+ widget = gtk_menu_item_new();
+ break;
+
+ case wxGTK_MENUBAR:
+ widget = gtk_menu_bar_new();
+ break;
+ }
+
+ GtkStyle *def = gtk_rc_get_style( widget );
+ if ( !def )
+ def = gtk_widget_get_default_style();
+
+ const bool ok = def != NULL;
+ if (ok)
+ {
+ switch ( colour )
+ {
+ default:
+ wxFAIL_MSG( _T("unexpected GTK colour type") );
+ // fall through
+
+ case wxGTK_FG:
+ gdkColor = def->fg[state];
+ break;
+
+ case wxGTK_BG:
+ gdkColor = def->bg[state];
+ break;
+
+ case wxGTK_BASE:
+ gdkColor = def->base[state];
+ break;
+ }
+ }
+
+ gtk_object_sink((GtkObject*)widget);