-// delete g_systemWinColour;
- delete g_systemBtnFaceColour;
- delete g_systemBtnShadowColour;
- delete g_systemBtnHighlightColour;
- delete g_systemHighlightColour;
- delete g_systemHighlightTextColour;
- delete g_systemListBoxColour;
- delete g_systemFont;
+public:
+ bool OnInit() { return TRUE; }
+ void OnExit()
+ {
+ //delete g_systemWinColour;
+ delete g_systemBtnFaceColour;
+ delete g_systemBtnShadowColour;
+ delete g_systemBtnHighlightColour;
+ delete g_systemHighlightColour;
+ delete g_systemHighlightTextColour;
+ delete g_systemListBoxColour;
+ delete g_systemFont;
+ delete g_systemBtnTextColour;
+ }
+ DECLARE_DYNAMIC_CLASS(wxSystemSettingsModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxSystemSettingsModule, wxModule)
+
+// ----------------------------------------------------------------------------
+// wxSystemSettings implementation
+// ----------------------------------------------------------------------------
+
+// kind of widget to use in GetColourFromGTKWidget
+enum wxGtkWidgetType
+{
+ wxGTK_BUTTON,
+ wxGTK_LIST
+};
+
+// 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, false to use defaults
+static bool GetColourFromGTKWidget(int& red, int& green, int& blue,
+ 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_LIST:
+ widget = gtk_list_new();
+ }
+
+ GtkStyle *def = gtk_rc_get_style( widget );
+ if ( !def )
+ def = gtk_widget_get_default_style();
+
+ bool ok;
+ if ( def )
+ {
+ GdkColor *col;
+ switch ( colour )
+ {
+ default:
+ wxFAIL_MSG( _T("unexpected GTK colour type") );
+ // fall through
+
+ case wxGTK_FG:
+ col = def->fg;
+ break;
+
+ case wxGTK_BG:
+ col = def->bg;
+ break;
+
+ case wxGTK_BASE:
+ col = def->base;
+ break;
+ }
+
+ red = col[state].red;
+ green = col[state].green;
+ blue = col[state].blue;
+
+ ok = TRUE;
+ }
+ else
+ {
+ ok = FALSE;
+ }
+
+ gtk_widget_destroy( widget );
+
+ return ok;