From 16f9478ee3f074530a4a897879eda252b3887a7b Mon Sep 17 00:00:00 2001 From: cinamod Date: Tue, 30 Dec 2003 17:22:30 +0000 Subject: [PATCH] toward bug 853775 --- modules/engines/ms-windows/ChangeLog.old | 7 ++++++ modules/engines/ms-windows/wimp_style.c | 28 +++++++++++++--------- modules/engines/ms-windows/xp_theme.c | 23 ++++++++++++++---- modules/engines/ms-windows/xp_theme.h | 2 +- modules/engines/ms-windows/xp_theme_defs.h | 4 ++++ 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/modules/engines/ms-windows/ChangeLog.old b/modules/engines/ms-windows/ChangeLog.old index 2e4ea98c8f..225a7dcc4c 100755 --- a/modules/engines/ms-windows/ChangeLog.old +++ b/modules/engines/ms-windows/ChangeLog.old @@ -1,3 +1,10 @@ +2003-12-30 Dom Lachowicz + + * src/wimp_style.c + * src/xp_theme.c + * src/xp_theme.h + * src/xp_theme_defs.h: Toward 853775, get toolbar button borders correct + 2003-12-30 Dom Lachowicz * src/wimp_style.c: Fix bug 852354 to my liking diff --git a/modules/engines/ms-windows/wimp_style.c b/modules/engines/ms-windows/wimp_style.c index 44033a9bd1..3e6c1da3e9 100755 --- a/modules/engines/ms-windows/wimp_style.c +++ b/modules/engines/ms-windows/wimp_style.c @@ -556,7 +556,7 @@ setup_wimp_rc_style(void) (font_ptr ? "font_name" : "#"), (font_ptr ? font_ptr : " font name should go here")); gtk_rc_parse_string(buf); - + /* Enable coloring for menu bars. */ font_ptr = sys_font_to_pango_font (XP_THEME_CLASS_MENU, XP_THEME_FONT_MENU,font_buf, sizeof (font_buf)); g_snprintf(buf, sizeof (buf), @@ -568,7 +568,7 @@ setup_wimp_rc_style(void) btn_face.green, btn_face.blue); gtk_rc_parse_string(buf); - + /* enable tooltip fonts */ font_ptr = sys_font_to_pango_font (XP_THEME_CLASS_STATUS, XP_THEME_FONT_STATUS,font_buf, sizeof (font_buf)); g_snprintf(buf, sizeof (buf), @@ -582,7 +582,7 @@ setup_wimp_rc_style(void) (font_ptr ? "font_name" : "#"), (font_ptr ? font_ptr : " font name should go here")); gtk_rc_parse_string(buf); - + g_snprintf(buf, sizeof (buf), "style \"wimp-tooltips\" = \"wimp-default\"\n" "{bg[NORMAL] = { %d, %d, %d }\n" @@ -591,7 +591,7 @@ setup_wimp_rc_style(void) tooltip_back.green, tooltip_back.blue); gtk_rc_parse_string(buf); - + /* enable font theming for status bars */ font_ptr = sys_font_to_pango_font (XP_THEME_CLASS_STATUS, XP_THEME_FONT_STATUS,font_buf, sizeof (font_buf)); g_snprintf(buf, sizeof (buf), @@ -603,7 +603,7 @@ setup_wimp_rc_style(void) (font_ptr ? font_ptr : " font name should go here"), btn_face.red, btn_face.green, btn_face.blue); gtk_rc_parse_string(buf); - + /* enable coloring for text on buttons TODO: use GetThemeMetric for the border and outside border */ g_snprintf(buf, sizeof (buf), @@ -636,7 +636,7 @@ setup_wimp_rc_style(void) progress_back.blue, btn_face.red, btn_face.green, btn_face.blue); gtk_rc_parse_string(buf); - + /* scrollbar thumb width and height */ g_snprintf(buf, sizeof (buf), "style \"wimp-vscrollbar\" = \"wimp-default\"\n" @@ -648,7 +648,7 @@ setup_wimp_rc_style(void) GetSystemMetrics(SM_CYVTHUMB), get_system_metric(XP_THEME_CLASS_SCROLLBAR, SM_CXVSCROLL)); gtk_rc_parse_string(buf); - + g_snprintf(buf, sizeof (buf), "style \"wimp-hscrollbar\" = \"wimp-default\"\n" "{GtkRange::slider-width = %d\n" @@ -659,7 +659,7 @@ setup_wimp_rc_style(void) GetSystemMetrics(SM_CXHTHUMB), get_system_metric(XP_THEME_CLASS_SCROLLBAR, SM_CYHSCROLL)); gtk_rc_parse_string(buf); - + /* radio/check button sizes */ g_snprintf(buf, sizeof (buf), "style \"wimp-checkbutton\" = \"wimp-button\"\n" @@ -1284,6 +1284,12 @@ draw_box (GtkStyle *style, width, height, state_type, area)) return; } + else if (GTK_IS_TOOLBAR (widget->parent)) + { + if (xp_theme_draw(window, XP_THEME_ELEMENT_TOOLBAR_BUTTON, style, x, y, + width, height, state_type, area)) + return; + } else { gboolean is_default = !strcmp (detail, "buttondefault"); @@ -1433,15 +1439,15 @@ draw_box (GtkStyle *style, else if (widget && GTK_IS_SCALE(widget)) { gboolean is_vertical = GTK_IS_VSCALE(widget); - + parent_class->draw_box (style, window, state_type, GTK_SHADOW_NONE, area, widget, detail, x, y, width, height); - + if(is_vertical) parent_class->draw_box(style, window, state_type, GTK_SHADOW_ETCHED_IN, area, NULL, NULL, (2 * x + width)/2, y, 1, height); else parent_class->draw_box(style, window, state_type, GTK_SHADOW_ETCHED_IN, area, NULL, NULL, x, (2 * y + height)/2, width, 1); - + return; } } diff --git a/modules/engines/ms-windows/xp_theme.c b/modules/engines/ms-windows/xp_theme.c index aabd27f14b..a8bd4a3463 100755 --- a/modules/engines/ms-windows/xp_theme.c +++ b/modules/engines/ms-windows/xp_theme.c @@ -240,7 +240,7 @@ xp_theme_get_handle_by_element (XpThemeElement element) klazz = XP_THEME_CLASS_STATUS; break; - case XP_THEME_ELEMENT_TOOLBAR: + case XP_THEME_ELEMENT_TOOLBAR_BUTTON: klazz = XP_THEME_CLASS_TOOLBAR; break; @@ -357,9 +357,22 @@ xp_theme_map_gtk_state (XpThemeElement element, GtkStateType state) } break; - case XP_THEME_ELEMENT_TOOLBAR: - ret = 1; - break; + case XP_THEME_ELEMENT_TOOLBAR_BUTTON: + switch (state) + { + case GTK_STATE_ACTIVE: + ret = TS_PRESSED; + break; + case GTK_STATE_PRELIGHT: + ret = TS_HOT; + break; + case GTK_STATE_INSENSITIVE: + ret = TS_DISABLED; + break; + default: + ret = TS_NORMAL; + } + break; case XP_THEME_ELEMENT_TAB_PANE: ret = 1; @@ -665,7 +678,7 @@ xp_theme_draw (GdkWindow *win, XpThemeElement element, GtkStyle *style, HDC dc; GdkDrawable *drawable; int part_state; - + if (! xp_theme_is_drawable (element)) return FALSE; diff --git a/modules/engines/ms-windows/xp_theme.h b/modules/engines/ms-windows/xp_theme.h index 30e2c6d704..f393b56d9b 100755 --- a/modules/engines/ms-windows/xp_theme.h +++ b/modules/engines/ms-windows/xp_theme.h @@ -83,7 +83,7 @@ typedef enum XP_THEME_ELEMENT_REBAR_GRIPPER_H, XP_THEME_ELEMENT_REBAR_GRIPPER_V, XP_THEME_ELEMENT_REBAR_CHEVRON, - XP_THEME_ELEMENT_TOOLBAR, + XP_THEME_ELEMENT_TOOLBAR_BUTTON, XP_THEME_ELEMENT_MENU_ITEM, XP_THEME_ELEMENT_MENU_SEPARATOR, XP_THEME_ELEMENT_STATUS_GRIPPER, diff --git a/modules/engines/ms-windows/xp_theme_defs.h b/modules/engines/ms-windows/xp_theme_defs.h index ff9238d851..4b9ad8e32c 100644 --- a/modules/engines/ms-windows/xp_theme_defs.h +++ b/modules/engines/ms-windows/xp_theme_defs.h @@ -75,6 +75,10 @@ typedef HANDLE HTHEME; #define RP_CHEVRON 4 #define TP_BUTTON 1 +#define TS_NORMAL 1 +#define TS_HOT 2 +#define TS_PRESSED 3 +#define TS_DISABLED 4 #define TTSS_NORMAL 1