diff --git a/modules/engines/ms-windows/ChangeLog.old b/modules/engines/ms-windows/ChangeLog.old index 9db158e16f..1518991116 100755 --- a/modules/engines/ms-windows/ChangeLog.old +++ b/modules/engines/ms-windows/ChangeLog.old @@ -1,3 +1,7 @@ +2003-08-06 Raymond Penners + + * src/*.c: Added XP theming support for progress bars. + 2003-08-05 Raymond Penners * src/xp_theme.c: Internal redesign: extracted XP specific theming diff --git a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc index 983ec124fc..e55aedd73d 100755 --- a/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc +++ b/modules/engines/ms-windows/Theme/gtk-2.0/gtkrc @@ -26,3 +26,4 @@ style "wimp-scrollbar" } class "GtkScrollbar" style "wimp-scrollbar" + diff --git a/modules/engines/ms-windows/wimp_style.c b/modules/engines/ms-windows/wimp_style.c index 844d96af6c..996619553b 100755 --- a/modules/engines/ms-windows/wimp_style.c +++ b/modules/engines/ms-windows/wimp_style.c @@ -301,6 +301,27 @@ sanitize_size (GdkWindow *window, return set_bg; } +static XpThemeElement +map_gtk_progress_bar_to_xp(GtkProgressBar *progress_bar, gboolean trough) +{ + XpThemeElement ret; + switch (progress_bar->orientation) + { + case GTK_PROGRESS_LEFT_TO_RIGHT: + case GTK_PROGRESS_RIGHT_TO_LEFT: + ret = trough + ? XP_THEME_ELEMENT_PROGRESS_TROUGH_H + : XP_THEME_ELEMENT_PROGRESS_BAR_H; + break; + default: + ret = trough + ? XP_THEME_ELEMENT_PROGRESS_TROUGH_V + : XP_THEME_ELEMENT_PROGRESS_BAR_V; + break; + } + return ret; +} + static void draw_part (GdkDrawable *drawable, GdkGC *gc, @@ -858,6 +879,19 @@ draw_box (GtkStyle *style, } } } + else if (detail && !strcmp (detail, "bar")) + { + if (widget && GTK_IS_PROGRESS_BAR (widget)) + { + GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget); + XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, FALSE); + if (xp_theme_draw (window, xp_progress_bar, + style, x, y, width, height, state_type)) + { + return; + } + } + } if (detail && strcmp (detail, "menuitem") == 0) shadow_type = GTK_SHADOW_NONE; @@ -866,7 +900,17 @@ draw_box (GtkStyle *style, { if (widget && GTK_IS_PROGRESS_BAR (widget)) { - // Blank in classic Windows + GtkProgressBar *progress_bar = GTK_PROGRESS_BAR(widget); + XpThemeElement xp_progress_bar = map_gtk_progress_bar_to_xp (progress_bar, TRUE); + if (xp_theme_draw (window, xp_progress_bar, + style, x, y, width, height, state_type)) + { + return; + } + else + { + // Blank in classic Windows + } } else { @@ -1135,14 +1179,14 @@ wimp_style_class_init (WimpStyleClass *klass) parent_class = g_type_class_peek_parent (klass); - style_class->init_from_rc = wimp_style_init_from_rc; - style_class->draw_arrow = draw_arrow; - style_class->draw_box = draw_box; - style_class->draw_check = draw_check; - style_class->draw_option = draw_option; - style_class->draw_tab = draw_tab; - style_class->draw_flat_box = draw_flat_box; - style_class->draw_expander = draw_expander; + style_class->init_from_rc = wimp_style_init_from_rc; + style_class->draw_arrow = draw_arrow; + style_class->draw_box = draw_box; + style_class->draw_check = draw_check; + style_class->draw_option = draw_option; + style_class->draw_tab = draw_tab; + style_class->draw_flat_box = draw_flat_box; + style_class->draw_expander = draw_expander; style_class->draw_extension = draw_extension; style_class->draw_box_gap = draw_box_gap; style_class->draw_shadow = draw_shadow; diff --git a/modules/engines/ms-windows/xp_theme.c b/modules/engines/ms-windows/xp_theme.c index c03b2921cb..4f7c1fd067 100755 --- a/modules/engines/ms-windows/xp_theme.c +++ b/modules/engines/ms-windows/xp_theme.c @@ -40,6 +40,7 @@ static LPCWSTR class_descriptors[] = L"Edit", L"TreeView", L"Spin", + L"Progress", }; static const short element_part_map[]= @@ -70,6 +71,10 @@ static const short element_part_map[]= BP_RADIOBUTTON, TVP_GLYPH, TVP_GLYPH, + PP_CHUNK, + PP_CHUNKVERT, + PP_BAR, + PP_BARVERT, }; @@ -200,6 +205,13 @@ xp_theme_get_handle_by_element(XpThemeElement element) klazz = XP_THEME_CLASS_SPIN; break; + case XP_THEME_ELEMENT_PROGRESS_BAR_H: + case XP_THEME_ELEMENT_PROGRESS_BAR_V: + case XP_THEME_ELEMENT_PROGRESS_TROUGH_H: + case XP_THEME_ELEMENT_PROGRESS_TROUGH_V: + klazz = XP_THEME_CLASS_PROGRESS; + break; + case XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED: case XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED: klazz = XP_THEME_CLASS_TREEVIEW; @@ -443,6 +455,13 @@ xp_theme_map_gtk_state(XpThemeElement element, GtkStateType state) ret = GLPS_OPENED; break; + case XP_THEME_ELEMENT_PROGRESS_BAR_H: + case XP_THEME_ELEMENT_PROGRESS_BAR_V: + case XP_THEME_ELEMENT_PROGRESS_TROUGH_H: + case XP_THEME_ELEMENT_PROGRESS_TROUGH_V: + ret = 0; + break; + default: switch(state) { @@ -521,3 +540,15 @@ xp_theme_is_drawable(XpThemeElement element) } return ret; } + +gboolean +xp_theme_get_system_font(LOGFONTW *lf) +{ + gboolean ret = FALSE; + if (get_theme_sys_font_func != NULL) + { + HRESULT hr = (*get_theme_sys_font_func)(NULL, TMT_MSGBOXFONT, lf); + ret = (hr == S_OK); + } + return ret; +} diff --git a/modules/engines/ms-windows/xp_theme.h b/modules/engines/ms-windows/xp_theme.h index 66b3e526b3..556d322a4d 100755 --- a/modules/engines/ms-windows/xp_theme.h +++ b/modules/engines/ms-windows/xp_theme.h @@ -34,6 +34,7 @@ typedef enum XP_THEME_CLASS_EDIT, XP_THEME_CLASS_TREEVIEW, XP_THEME_CLASS_SPIN, + XP_THEME_CLASS_PROGRESS, XP_THEME_CLASS__SIZEOF } XpThemeClass; @@ -65,6 +66,10 @@ typedef enum XP_THEME_ELEMENT_RADIO_BUTTON, XP_THEME_ELEMENT_TREEVIEW_EXPANDER_OPENED, XP_THEME_ELEMENT_TREEVIEW_EXPANDER_CLOSED, + XP_THEME_ELEMENT_PROGRESS_BAR_H, + XP_THEME_ELEMENT_PROGRESS_BAR_V, + XP_THEME_ELEMENT_PROGRESS_TROUGH_H, + XP_THEME_ELEMENT_PROGRESS_TROUGH_V, XP_THEME_ELEMENT__SIZEOF } XpThemeElement;