Bug #313627. Make win32 theme's handling of toolbars, handleboxes, and

2005-11-12  Dom Lachowicz <cinamod@hotmail.com>

	* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
	theme's handling of toolbars, handleboxes, and menubars more in-line
	with Microsoft's IE style.
	* modules/engines/ms-windows/*.c: Indentation cleanups
This commit is contained in:
Dom Lachowicz 2005-11-12 14:20:51 +00:00 committed by Dom Lachowicz
parent 82f12b610d
commit 5411a3a1a2
6 changed files with 2856 additions and 2504 deletions

View File

@ -1,3 +1,10 @@
2005-11-12 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
theme's handling of toolbars, handleboxes, and menubars more in-line
with Microsoft's IE style.
* modules/engines/ms-windows/*.c: Indentation cleanups
2005-11-12 Matthias Clasen <mclasen@redhat.com>
Make builtin icons work in gtk_window_set_icon_name()

View File

@ -1,3 +1,10 @@
2005-11-12 Dom Lachowicz <cinamod@hotmail.com>
* modules/engines/ms-windows/msw_style.c: Bug #313627. Make win32
theme's handling of toolbars, handleboxes, and menubars more in-line
with Microsoft's IE style.
* modules/engines/ms-windows/*.c: Indentation cleanups
2005-11-12 Matthias Clasen <mclasen@redhat.com>
Make builtin icons work in gtk_window_set_icon_name()

View File

@ -34,8 +34,7 @@ GType msw_type_rc_style = 0;
void
msw_rc_style_register_type (GTypeModule * module)
{
static const GTypeInfo object_info =
{
static const GTypeInfo object_info = {
sizeof (MswRcStyleClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
@ -75,4 +74,3 @@ msw_rc_style_create_style (GtkRcStyle *rc_style)
{
return g_object_new (MSW_TYPE_STYLE, NULL);
}

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,7 @@ static GModule * this_module = NULL;
static void (*msw_rc_reset_styles) (GtkSettings * settings) = NULL;
static GdkFilterReturn
global_filter_func (void *xevent,
GdkEvent *event,
gpointer data)
global_filter_func (void *xevent, GdkEvent * event, gpointer data)
{
MSG *msg = (MSG *) xevent;
@ -50,7 +48,8 @@ global_filter_func (void *xevent,
case WM_THEMECHANGED:
case WM_SYSCOLORCHANGE:
if(msw_rc_reset_styles != NULL) {
if (msw_rc_reset_styles != NULL)
{
xp_theme_reset ();
msw_style_init ();
@ -77,9 +76,10 @@ theme_init (GTypeModule *module)
msw_style_register_type (module);
/* this craziness is required because only gtk 2.4.x and later have
gtk_rc_reset_styles(). But we want to be able to run acceptly well
on any GTK 2.x.x platform. */
if(gtk_check_version(2,4,0) == NULL) {
gtk_rc_reset_styles(). But we want to be able to run acceptly well on
any GTK 2.x.x platform. */
if (gtk_check_version (2, 4, 0) == NULL)
{
this_module = g_module_open (NULL, 0);
if (this_module)
@ -96,7 +96,8 @@ theme_exit (void)
{
gdk_window_remove_filter (NULL, global_filter_func, NULL);
if(this_module) {
if (this_module)
{
g_module_close (this_module);
this_module = NULL;
}

View File

@ -42,6 +42,7 @@
#endif
#ifndef TMT_CAPTIONFONT
/* These aren't in mingw's "w32api" headers, nor in the Platform SDK
* headers.
*/
@ -80,8 +81,7 @@
#define TRS_NORMAL 1
static const LPCWSTR class_descriptors[] =
{
static const LPCWSTR class_descriptors[] = {
L"Scrollbar", /* XP_THEME_CLASS_SCROLLBAR */
L"Button", /* XP_THEME_CLASS_BUTTON */
L"Header", /* XP_THEME_CLASS_HEADER */
@ -101,8 +101,7 @@ static const LPCWSTR class_descriptors[] =
L"Trackbar" /* XP_THEME_CLASS_TRACKBAR */
};
static const short element_part_map[]=
{
static const short element_part_map[] = {
BP_CHECKBOX,
BP_CHECKBOX,
BP_PUSHBUTTON,
@ -161,20 +160,26 @@ static HTHEME open_themes[XP_THEME_CLASS__SIZEOF];
typedef HRESULT (FAR PASCAL * GetThemeSysFontFunc)
(HTHEME hTheme, int iFontID, OUT LOGFONT * plf);
typedef int (FAR PASCAL *GetThemeSysSizeFunc)
(HTHEME hTheme, int iSizeId);
typedef COLORREF (FAR PASCAL *GetThemeSysColorFunc)(HTHEME hTheme, int iColorID);
typedef HTHEME (FAR PASCAL *OpenThemeDataFunc)
(HWND hwnd, LPCWSTR pszClassList);
typedef int (FAR PASCAL * GetThemeSysSizeFunc) (HTHEME hTheme, int iSizeId);
typedef COLORREF (FAR PASCAL * GetThemeSysColorFunc) (HTHEME hTheme,
int iColorID);
typedef HTHEME (FAR PASCAL * OpenThemeDataFunc) (HWND hwnd,
LPCWSTR pszClassList);
typedef HRESULT (FAR PASCAL * CloseThemeDataFunc) (HTHEME theme);
typedef HRESULT (FAR PASCAL * DrawThemeBackgroundFunc)
(HTHEME hTheme, HDC hdc, int iPartId, int iStateId,
const RECT * pRect, const RECT * pClipRect);
typedef HRESULT (FAR PASCAL *EnableThemeDialogTextureFunc)(HWND hwnd, DWORD dwFlags);
typedef HRESULT (FAR PASCAL * EnableThemeDialogTextureFunc) (HWND hwnd,
DWORD dwFlags);
typedef BOOL (FAR PASCAL * IsThemeActiveFunc) (VOID);
typedef BOOL (FAR PASCAL * IsAppThemedFunc) (VOID);
typedef BOOL (FAR PASCAL *IsThemeBackgroundPartiallyTransparentFunc)(HTHEME hTheme, int iPartId, int iStateId);
typedef HRESULT (FAR PASCAL *DrawThemeParentBackgroundFunc)(HWND hwnd, HDC hdc, RECT *prc);
typedef BOOL (FAR PASCAL *
IsThemeBackgroundPartiallyTransparentFunc) (HTHEME hTheme,
int iPartId,
int iStateId);
typedef HRESULT (FAR PASCAL * DrawThemeParentBackgroundFunc) (HWND hwnd,
HDC hdc,
RECT * prc);
static GetThemeSysFontFunc get_theme_sys_font_func = NULL;
static GetThemeSysColorFunc get_theme_sys_color_func = NULL;
@ -185,7 +190,8 @@ static DrawThemeBackgroundFunc draw_theme_background_func = NULL;
static EnableThemeDialogTextureFunc enable_theme_dialog_texture_func = NULL;
static IsThemeActiveFunc is_theme_active_func = NULL;
static IsAppThemedFunc is_app_themed_func = NULL;
static IsThemeBackgroundPartiallyTransparentFunc is_theme_partially_transparent_func = NULL;
static IsThemeBackgroundPartiallyTransparentFunc
is_theme_partially_transparent_func = NULL;
static DrawThemeParentBackgroundFunc draw_theme_parent_background_func = NULL;
static void
@ -215,19 +221,42 @@ xp_theme_init (void)
if (!uxtheme_dll)
return;
is_app_themed_func = (IsAppThemedFunc) GetProcAddress(uxtheme_dll, "IsAppThemed");
is_app_themed_func =
(IsAppThemedFunc) GetProcAddress (uxtheme_dll, "IsAppThemed");
if(is_app_themed_func) {
is_theme_active_func = (IsThemeActiveFunc) GetProcAddress(uxtheme_dll, "IsThemeActive");
open_theme_data_func = (OpenThemeDataFunc) GetProcAddress(uxtheme_dll, "OpenThemeData");
close_theme_data_func = (CloseThemeDataFunc) GetProcAddress(uxtheme_dll, "CloseThemeData");
draw_theme_background_func = (DrawThemeBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeBackground");
enable_theme_dialog_texture_func = (EnableThemeDialogTextureFunc) GetProcAddress(uxtheme_dll, "EnableThemeDialogTexture");
get_theme_sys_font_func = (GetThemeSysFontFunc) GetProcAddress(uxtheme_dll, "GetThemeSysFont");
get_theme_sys_color_func = (GetThemeSysColorFunc) GetProcAddress(uxtheme_dll, "GetThemeSysColor");
get_theme_sys_metric_func = (GetThemeSysSizeFunc) GetProcAddress(uxtheme_dll, "GetThemeSysSize");
is_theme_partially_transparent_func = (IsThemeBackgroundPartiallyTransparentFunc) GetProcAddress(uxtheme_dll, "IsThemeBackgroundPartiallyTransparent");
draw_theme_parent_background_func = (DrawThemeParentBackgroundFunc) GetProcAddress(uxtheme_dll, "DrawThemeParentBackground");
if (is_app_themed_func)
{
is_theme_active_func =
(IsThemeActiveFunc) GetProcAddress (uxtheme_dll,
"IsThemeActive");
open_theme_data_func =
(OpenThemeDataFunc) GetProcAddress (uxtheme_dll,
"OpenThemeData");
close_theme_data_func =
(CloseThemeDataFunc) GetProcAddress (uxtheme_dll,
"CloseThemeData");
draw_theme_background_func =
(DrawThemeBackgroundFunc) GetProcAddress (uxtheme_dll,
"DrawThemeBackground");
enable_theme_dialog_texture_func =
(EnableThemeDialogTextureFunc) GetProcAddress (uxtheme_dll,
"EnableThemeDialogTexture");
get_theme_sys_font_func =
(GetThemeSysFontFunc) GetProcAddress (uxtheme_dll,
"GetThemeSysFont");
get_theme_sys_color_func =
(GetThemeSysColorFunc) GetProcAddress (uxtheme_dll,
"GetThemeSysColor");
get_theme_sys_metric_func =
(GetThemeSysSizeFunc) GetProcAddress (uxtheme_dll,
"GetThemeSysSize");
is_theme_partially_transparent_func =
(IsThemeBackgroundPartiallyTransparentFunc)
GetProcAddress (uxtheme_dll,
"IsThemeBackgroundPartiallyTransparent");
draw_theme_parent_background_func =
(DrawThemeParentBackgroundFunc) GetProcAddress (uxtheme_dll,
"DrawThemeParentBackground");
}
}
@ -266,7 +295,8 @@ xp_theme_get_handle_by_class (XpThemeClass klazz)
{
if (!open_themes[klazz] && open_theme_data_func)
{
open_themes[klazz] = open_theme_data_func(NULL, class_descriptors[klazz]);
open_themes[klazz] =
open_theme_data_func (NULL, class_descriptors[klazz]);
}
return open_themes[klazz];
}
@ -686,7 +716,8 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
case XP_THEME_ELEMENT_MENU_ITEM:
case XP_THEME_ELEMENT_MENU_SEPARATOR:
switch(state) {
switch (state)
{
case GTK_STATE_SELECTED:
ret = MS_SELECTED;
break;
@ -699,7 +730,8 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
break;
case XP_THEME_ELEMENT_LINE_H:
switch(state) {
switch (state)
{
/* LHS_FLAT, LHS_RAISED, LHS_SUNKEN */
ret = LHS_RAISED;
break;
@ -707,7 +739,8 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state)
break;
case XP_THEME_ELEMENT_LINE_V:
switch(state) {
switch (state)
{
/* LVS_FLAT, LVS_RAISED, LVS_SUNKEN */
ret = LVS_RAISED;
break;
@ -797,7 +830,8 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style,
part_state = xp_theme_map_gtk_state (element, state_type);
draw_theme_background_func(theme, dc, element_part_map[element], part_state, &rect, pClip);
draw_theme_background_func (theme, dc, element_part_map[element],
part_state, &rect, pClip);
gdk_win32_hdc_release (drawable, style->dark_gc[state_type], 0);
return TRUE;
@ -831,7 +865,8 @@ xp_theme_is_drawable (XpThemeElement element)
}
gboolean
xp_theme_get_system_font (XpThemeClass klazz, XpThemeFont fontId, OUT LOGFONT *lf)
xp_theme_get_system_font (XpThemeClass klazz, XpThemeFont fontId,
OUT LOGFONT * lf)
{
if (xp_theme_is_active () && get_theme_sys_font_func != NULL)
{
@ -844,32 +879,42 @@ xp_theme_get_system_font (XpThemeClass klazz, XpThemeFont fontId, OUT LOGFONT *l
switch (fontId)
{
case XP_THEME_FONT_CAPTION:
themeFont = TMT_CAPTIONFONT; break;
themeFont = TMT_CAPTIONFONT;
break;
case XP_THEME_FONT_MENU:
themeFont = TMT_MENUFONT; break;
themeFont = TMT_MENUFONT;
break;
case XP_THEME_FONT_STATUS:
themeFont = TMT_STATUSFONT; break;
themeFont = TMT_STATUSFONT;
break;
case XP_THEME_FONT_MESSAGE:
default:
themeFont = TMT_MSGBOXFONT; break;
themeFont = TMT_MSGBOXFONT;
break;
}
/* if theme is NULL, it will just return the GetSystemFont() value */
return ((*get_theme_sys_font_func)(theme, themeFont, lf) == S_OK);
/* if theme is NULL, it will just return the GetSystemFont()
value */
return ((*get_theme_sys_font_func) (theme, themeFont, lf) ==
S_OK);
}
return FALSE;
}
gboolean
xp_theme_get_system_color (XpThemeClass klazz, int colorId, OUT DWORD * pColor)
xp_theme_get_system_color (XpThemeClass klazz, int colorId,
OUT DWORD * pColor)
{
if (xp_theme_is_active () && get_theme_sys_color_func != NULL)
{
HTHEME theme = xp_theme_get_handle_by_class (klazz);
/* if theme is NULL, it will just return the GetSystemColor() value */
/* if theme is NULL, it will just return the GetSystemColor()
value */
*pColor = (*get_theme_sys_color_func) (theme, colorId);
return TRUE;
}
return FALSE;
}
@ -880,9 +925,11 @@ xp_theme_get_system_metric (XpThemeClass klazz, int metricId, OUT int * pVal)
{
HTHEME theme = xp_theme_get_handle_by_class (klazz);
/* if theme is NULL, it will just return the GetSystemMetrics() value */
/* if theme is NULL, it will just return the GetSystemMetrics()
value */
*pVal = (*get_theme_sys_metric_func) (theme, metricId);
return TRUE;
}
return FALSE;
}