-extern GdkFont *GtkGetDefaultGuiFont();
-
-
-/*
-#define wxSYS_COLOUR_SCROLLBAR 0
-#define wxSYS_COLOUR_BACKGROUND 1
-#define wxSYS_COLOUR_ACTIVECAPTION 2
-#define wxSYS_COLOUR_INACTIVECAPTION 3
-#define wxSYS_COLOUR_MENU 4
-#define wxSYS_COLOUR_WINDOW 5
-#define wxSYS_COLOUR_WINDOWFRAME 6
-#define wxSYS_COLOUR_MENUTEXT 7
-#define wxSYS_COLOUR_WINDOWTEXT 8
-#define wxSYS_COLOUR_CAPTIONTEXT 9
-#define wxSYS_COLOUR_ACTIVEBORDER 10
-#define wxSYS_COLOUR_INACTIVEBORDER 11
-#define wxSYS_COLOUR_APPWORKSPACE 12
-#define wxSYS_COLOUR_HIGHLIGHT 13
-#define wxSYS_COLOUR_HIGHLIGHTTEXT 14
-#define wxSYS_COLOUR_BTNFACE 15
-#define wxSYS_COLOUR_BTNSHADOW 16
-#define wxSYS_COLOUR_GRAYTEXT 17
-#define wxSYS_COLOUR_BTNTEXT 18
-#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
-#define wxSYS_COLOUR_BTNHIGHLIGHT 20
-
-#define wxSYS_COLOUR_3DDKSHADOW 21
-#define wxSYS_COLOUR_3DLIGHT 22
-#define wxSYS_COLOUR_INFOTEXT 23
-#define wxSYS_COLOUR_INFOBK 24
-
-#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
-#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
-#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
-#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
-#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
-#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
-*/
-
-#define SHIFT (8*(sizeof(short int)-sizeof(char)))
-
-//wxColour *g_systemWinColour = (wxColour *) NULL;
-wxColour *g_systemBtnFaceColour = (wxColour *) NULL;
-wxColour *g_systemBtnShadowColour = (wxColour *) NULL;
-wxColour *g_systemBtnHighlightColour = (wxColour *) NULL;
-wxColour *g_systemHighlightColour = (wxColour *) NULL;
-wxColour *g_systemHighlightTextColour = (wxColour *) NULL;
-wxColour *g_systemListBoxColour = (wxColour *) NULL;
-wxColour *g_systemBtnTextColour = (wxColour *) NULL;
-
-wxFont *g_systemFont = (wxFont *) NULL;
-
-void wxSystemSettings::Done()
+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);
+
+ return ok;
+}
+
+static void GetTooltipColors()