1 /* MS-Windows Engine (aka GTK-Wimp)
\r
3 * Copyright (C) 2003, 2004 Raymond Penners <raymond@dotsphinx.com>
\r
4 * Includes code adapted from redmond95 by Owen Taylor, and
\r
5 * gtk-nativewin by Evan Martin
\r
7 * This library is free software; you can redistribute it and/or
\r
8 * modify it under the terms of the GNU Library General Public
\r
9 * License as published by the Free Software Foundation; either
\r
10 * version 2 of the License, or (at your option) any later version.
\r
12 * This library is distributed in the hope that it will be useful,
\r
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
\r
15 * Library General Public License for more details.
\r
17 * You should have received a copy of the GNU Library General Public
\r
18 * License along with this library; if not, write to the
\r
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
\r
20 * Boston, MA 02111-1307, USA.
\r
23 #include <windows.h>
\r
25 #include <gmodule.h>
\r
27 #include "gtk/gtk.h"
\r
29 #include "msw_style.h"
\r
30 #include "msw_rc_style.h"
\r
32 #ifndef WM_THEMECHANGED
\r
33 #define WM_THEMECHANGED 0x031A /* winxp only */
\r
36 static GModule * this_module = NULL;
\r
37 static void (*msw_rc_reset_styles) (GtkSettings * settings) = NULL;
\r
39 static GdkFilterReturn
\r
40 global_filter_func (void *xevent,
\r
44 MSG *msg = (MSG *) xevent;
\r
46 switch (msg->message)
\r
48 /* catch theme changes */
\r
49 case WM_THEMECHANGED:
\r
50 case WM_SYSCOLORCHANGE:
\r
52 if(msw_rc_reset_styles != NULL) {
\r
56 /* force all gtkwidgets to redraw */
\r
57 (*msw_rc_reset_styles) (gtk_settings_get_default());
\r
60 return GDK_FILTER_REMOVE;
\r
62 case WM_SETTINGCHANGE:
\r
63 /* catch cursor blink, etc... changes */
\r
64 msw_style_setup_system_settings ();
\r
65 return GDK_FILTER_REMOVE;
\r
68 return GDK_FILTER_CONTINUE;
\r
72 G_MODULE_EXPORT void
\r
73 theme_init (GTypeModule *module)
\r
75 msw_rc_style_register_type (module);
\r
76 msw_style_register_type (module);
\r
78 /* this craziness is required because only gtk 2.4.x and later have
\r
79 gtk_rc_reset_styles(). But we want to be able to run acceptly well
\r
80 on any GTK 2.x.x platform. */
\r
81 if(gtk_check_version(2,4,0) == NULL) {
\r
82 this_module = g_module_open(NULL, 0);
\r
85 g_module_symbol (this_module, "gtk_rc_reset_styles",
\r
86 (gpointer *)(&msw_rc_reset_styles));
\r
90 gdk_window_add_filter (NULL, global_filter_func, NULL);
\r
93 G_MODULE_EXPORT void
\r
96 gdk_window_remove_filter (NULL, global_filter_func, NULL);
\r
99 g_module_close(this_module);
\r
100 this_module = NULL;
\r
104 G_MODULE_EXPORT GtkRcStyle *
\r
105 theme_create_rc_style (void)
\r
107 return GTK_RC_STYLE (g_object_new (MSW_TYPE_RC_STYLE, NULL));
\r
110 /* The following function will be called by GTK+ when the module
\r
111 * is loaded and checks to see if we are compatible with the
\r
112 * version of GTK+ that loads us.
\r
114 G_MODULE_EXPORT const gchar*
\r
115 g_module_check_init (GModule *module)
\r
117 return gtk_check_version (2,0,0);
\r